Thursday, December 31, 2009

Welcome Jagansindia 2010!!


Tuesday, December 29, 2009

Happy New Year 2010!!


Tuesday, December 22, 2009

Project Animation


Thursday, September 3, 2009

World Wide Free SMS

Please enter a cell phone number:

NO Dashes - Example: 7361829726


Please choose your recipient's provider:



Wednesday, August 26, 2009

Creating a Custom Cursor

  1. Create a Movieclip for the custom cursor, say a small circle and name the instance say, 'cust_cursor'. The instance name of a symbol is used to control it using Actionscript commands (Refer to Flash Photo Masking for this example).
  2. Select the Movieclip instance 'cust_cursor' on the stage and reduce the Alpha value to 40 and write the following Actionscript code for it as given below:
  3. onClipEvent(load)
    {
    Mouse.hide();
    this.startDrag();
    }



    Fig: Simple Custom Cursor in Flash

  1. The 'hide' method of the predefined object 'Mouse' is used to hide the standard cursor. The keyword 'this' is used to reference the Movieclip instance 'cust_cursor'.
  2. We use the 'startDrag' action of the Movieclip to use the movieclip as a custom cursor.
  3. The Custom Cursor Movieclip can also be Animated and used as a Mask as shown in the example below.
  4. Save your work and test the Movie (Ctrl + Enter). That's it you have learnt how to create a movieclip as a custom cursor in Flash.

Sunday, July 12, 2009

File Upload using PHP

Create an Upload-File Form

To allow users to upload files from a form can be very useful.

Look at the following HTML form for uploading files




Notice the following about the HTML form above:

  • The enctype attribute of the
    tag specifies which content-type to use when submitting the form. "multipart/form-data" is used when a form requires binary data, like the contents of a file, to be uploaded
  • The type="file" attribute of the tag specifies that the input should be processed as a file. For example, when viewed in a browser, there will be a browse-button next to the input field
  • Note: Allowing users to upload files is a big security risk. Only permit trusted users to perform file uploads.


    Create The Upload Script

    The "upload_file.php" file contains the code for uploading a file:

    0)
    {
    echo "Error: " . $_FILES["file"]["error"] . "
    ";
    }
    else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "
    ";
    echo "Type: " . $_FILES["file"]["type"] . "
    ";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
    ";
    echo "Stored in: " . $_FILES["file"]["tmp_name"];
    }
    ?>

    By using the global PHP $_FILES array you can upload files from a client computer to the remote server.

    The first parameter is the form's input name and the second index can be either "name", "type", "size", "tmp_name" or "error". Like this:

    • $_FILES["file"]["name"] - the name of the uploaded file
    • $_FILES["file"]["type"] - the type of the uploaded file
    • $_FILES["file"]["size"] - the size in bytes of the uploaded file
    • $_FILES["file"]["tmp_name"] - the name of the temporary copy of the file stored on the server
    • $_FILES["file"]["error"] - the error code resulting from the file upload

    This is a very simple way of uploading files. For security reasons, you should add restrictions on what the user is allowed to upload.


    Restrictions on Upload

    In this script we add some restrictions to the file upload. The user may only upload .gif or .jpeg files and the file size must be under 20 kb:

    0)
    {
    echo "Error: " . $_FILES["file"]["error"] . "
    ";
    }
    else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "
    ";
    echo "Type: " . $_FILES["file"]["type"] . "
    ";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
    ";
    echo "Stored in: " . $_FILES["file"]["tmp_name"];
    }
    }
    else
    {
    echo "Invalid file";
    }
    ?>

    Note: For IE to recognize jpg files the type must be pjpeg, for FireFox it must be jpeg.


    Saving the Uploaded File

    The examples above create a temporary copy of the uploaded files in the PHP temp folder on the server.

    The temporary copied files disappears when the script ends. To store the uploaded file we need to copy it to a different location:

    0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "
    ";
    }
    else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "
    ";
    echo "Type: " . $_FILES["file"]["type"] . "
    ";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
    ";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
    ";

    if (file_exists("upload/" . $_FILES["file"]["name"]))
    {
    echo $_FILES["file"]["name"] . " already exists. ";
    }
    else
    {
    move_uploaded_file($_FILES["file"]["tmp_name"],
    "upload/" . $_FILES["file"]["name"]);
    echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
    }
    }
    }
    else
    {
    echo "Invalid file";
    }
    ?>

    The script above checks if the file already exists, if it does not, it copies the file to the specified folder.

    Note: This example saves the file to a new folder called "upload"

Monday, June 8, 2009

Flash Tweening

The term "Tweening" is derived from "in between".

Sometimes you want to add an effect that is graduated over several frames.

For example, moving a car from the left side of the movie to the right side.

Instead of moving the car a little bit on each frame, you can simply:
  • position the car on the first frame,

  • then insert a keyframe where the car should stop

  • and finally tell Flash to tween between the two keyframes.


Tweening simply means going from one keyframe to another while taking small steps for each of the ordinary frames in between.




In this tutorial you can learn to make:
  • Motion Guide Tweenings

    (Moving objects from A to B along a customized path)


  • Tint Tweenings

    (Graduated color changing of an object.)


  • Shape Tweenings

    (Graduated change of one object into another)

Flash Buttons

The only object type in Flash, that can detect mouse events is the Button object.

This means that there is only one way to make buttons with Flash: Creating a button object.

This may sound a bit too simplified, but many are confused by the techniques behind the more sophisticated buttons, that we will cover later in this tutorial.

Creating a button that changes upon mouseover-events is extremely simple. All you really have to do is to tell Flash how you want the button to look 1) in normal state, 2) when the mouse moves over the button and 3) when the user clicks the button.

Once you've learned this 3-step technique you can create buttons in seconds.

However, the buttons you create this way are: simple (that's why they're so easy to make anyway).

If you want to create really fancy buttons you should use a slightly different technique based on movie clips.





THE THREE DIFFERENT OBJECT TYPES

Flash handles three types of objects:
  • Graphics

  • Buttons

  • Movieclips


Graphics objects
You probably allready noticed that when you edit Graphics objects you have the entire timeline available for it.
This means that Graphics objects aren't limited to static elements. You can easily create looping animations - simply by creating Graphic objects that uses more than one frame in the timeline.

Button objects
Buttons are different from this. When you create a Button object you only have four frames in the timeline.

One is for drawing the button in normal state.

Another is for drawing the button when a mouse-over is detected.

The third is for drawing the button as you want it to look when the user clicks the button.

The last frame is used to specify which area you want mouse events to react to. That is: you can create a button that only reacts to mouseevents on certain areas of the drawing, - like the center of the button for example.

Movie clip objects
The final object-type: Movieclips, is similar to Graphics objects - on the surface.

In both cases you can create entire animations that can be dragged onto your main movie. But while animations made as Graphics objects simply loops over and over you can control the Movieclips completely.




THE TRICK BEHIND FANCY FLASH BUTTONS

You can create more fancy buttons based on very simple programming. (You do not have to be a programmer to learn to do this!).

Actions added to frames give complete access to controlling movieclips. This means that you can use "Play", "Stop", and "Goto Frame" commands on a movieclip, that is triggered when a certain mouse event is detected on a button.

Now - if the button is invisible and placed on top of the movie clip it will work as if the movieclip itself was able to detect mouse events.




The next pages will teach you - step by step - how to create both simple and advanced buttons.

Flash Introduction

The drawing tools in Flash let you create and modify shapes for the artwork in your movies. For an interactive introduction to drawing in Flash, choose Help > Lessons > Drawing in your Flash program.

The tools for painting are kept in the "Tools" bar, usually positioned at the left top of your Flash Screen.

Flash Drawing Toolbar.

On the following pages we will guide you through the use of each of these tools, starting with the simplest.

But before going through the different tools, we will look at the way Flash handle drawings.

The most important thing to understand is the distinction between outlines and fills.

When you draw a line there is no fill - only the outline.

When you draw a rectangle (or a circle) you actually draw two things: The outline (border) and the fill. Unlike most other programs, Flash doesn't automatically combine these two into one object.