Our Flash tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Flash Tutorials Changing Shape Through Action Script
Your Ad Here

Changing Shape Through Action Script


Changing Shape Through Action ScriptHi all.....this will tell you how to change a shape through action scriptong.....

Create two layers:

  • "Object"
  • "Script"

in the main movie at "Object" layer.....

Draw a shape and convert it to movie clip....name it "object1" and then on the "script" layer.....go to frame 1 and add this action:

xy = "20";
right = "20";
left = "-30";

The next step:

Go inside the Movie Clip Symbol and convert the shape into another Movie clip and name it "object2"...

Inside the "object1" movie clip......create another layer called "script"...then go to frame 1 of "script" and add the following code:-

s = s - Math.random(500);
if (s > _root.left) {
gotoAndPlay(5);
} else {
gotoAndPlay(1);
}

The next step:

Now go inside the "object2" movie clip symbol......

Create a layer called "script"....

On frame 1 add this action:

setProperty(this, _xscale, Random(50)+50);
setProperty(this, _yscale, Random(50)+50);
ny = Random(50)+50;
nx = Random(50)+50;

Create a blank key frame next to it and add this action:

setProperty(this, _xscale, this._xscale +( (nx - this._xscale) /8));
setProperty(this, _yscale, this._yscale +( (ny - this._yscale) /8));

And create another frame(frame 3 that is) and add this action:

if ((this._xscale >= (nx-1) and this._xscale <= (nx+1)) and (this._yscale >= (ny-1) and this._yscale <= (ny+1))) {
ny = Random(90)+10;
nx = Random(90)+10;
}
gotoAndPlay(2);

Remember...on the "object2" symbol.......the object layer must hav 3 frames too(if u dont know how to do that then create two frames (not keyframes) beside it...i tell u again....not keyframes.

And then exit the symbol and go to the main scene and TEST ur movie....

Hope this tutorial was useful.....



Author's URL: n0wfel
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

Internet & computing Flash is a vector-based moving graphics format created by Macromedia for the publication of animations on the World Wide Web. More Flash & Swish: Most Popular Materials | Fresh Materials | More Flash Tutorials at FlashPerfection.com

Add comments to "Changing Shape Through Action Script"

Only registered users can write comment

Reader's comments