changing shape through action script - Flash Tutorials
 
  Buy Ebooks, Video Games, DVDs, Electronics and more !
Home | Help Forums | Web Design Tutorials | Free Swishmax Downloads Make Money Online Blog . Free Image and Photo Sharing and Hosting

 

 

Company

Home

Nework Details

Tutorials

SWiSH 2

SWiSHMax

Flash MX

PHP & MySQL

HTML / JScript

Adobe Photoshop

Corel Draw

Gimp

Miscellaneous

Downloads

Templates

Plugins

Fonts

Wallpapers

Free Images

Scripts and Codes

Products

E-Books

SWiSH BB

SWiSH Templates

SWiSH-DB Newsletter
Subscribe to our newsletter : GO
  Partners / Affiliates

   Free image hosting
   Web Design Pakistan
   Swish Templates
   SWiSH Climax
   Talkfreelance Community
   Template Desire
   Lite boards
   Script Sector
   GimpTalk
   13dots
   Idea Designs
   PHP Cafe
   Sposatoettore
   Free swishmax templates
   Swishzone

Manage your site with Flax Article Content Management System
changing shape through action script
Category : Flash | Level : Beginner | Language : English
Ask Question | Read Comments | Post tutorial | Previous | Next

Web www.swish-db.com

hi 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:-
CODE
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:-
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:-
CODE
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:-
CODE
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:-
CODE
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.... smile.gif
Hope this tutorial was useful..... smile.gif




© 2002-2005 Flaxweb Network | Article Manager | Gimp Tutorials Library | RAD C++ Library | Free C/C++ Sourcecode |
Sites of interest : Web Design Blog | Swish Templates | Swishmax Ebook | Photoshop Templates | Gimp Tutorials | Text Forum | Make Money Online