Random object appearance by action script

ActionScripting   Date: 15 May 2007 5:19 pm Add comments

In this detailed lesson, you will see how to create random effect and apply it on any picture using the action script. You will also learn how to Import any picture into a flash, how to use action script panel and more.

Example:

Step 1

Create a new flash document. Select Modify > Document (shortcut key: Ctrl+J ). Set the width of your document as whatever you want. Select the background color as whatever you like. Set your Flash movie’s frame rate to 8 and click ok.

Step 2

Find somewhere any cool image that you will use as backgroud and Import it (Shortcut key: Ctrl+R) into a flash. You can also if you like download my picture.

img11.jpg

Step 3

Double click on layer 1 to rename its name into a background. After that, create a new layer above the background layer and name it text.

Step 4

Take the Text Tool (A), choose any font, size, and type some little text. For this example I have typed “kiss me”. See the picture below.

img24.gif

Step 5

While the text is still selected, press F8 key (Convert to Symbol) to convert this text into a Movie Clip Symbol.

img34.gif

Step 6

While the new made Movie Clip (text) is still selected, go to the Action Script Panel (F9) below the stage and enter the following action script code inside the actions panel:

onClipEvent(enterFrame)
{
_alpha=random(100);
_x=_x=random(250);
_y=_y=random(250);
}

Step 7

Take the Selection Tool (V), select the text, and press few times Ctrl+D key (Duplicate) to duplicate this text few times. After that, place it all around. See the picture below.

img46.gif

Test your Movie (Ctrl+Enter).

We’re done!

Have a nice day!

Download source file (.fla)

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Login
eXTReMe Tracker