Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-30-2009, 07:48 PM   #1
sgonzal
Registered User
 
Join Date: May 2009
Posts: 26
Default moving an object

Hello,

I'm new to action scripting, and am trying to get away from tweening using a lot of frames in my movie clips and timelines. I want to be able to use actionscript and do everything in one actions frame.

Might any one assist me with getting an object to appear as if it is getting bigger as it is getting closer from a distance. Also, the object is moving from one side of the stage area to the other as it is getting closer, like in a zig-zag motion. I'm trying to get the same effect like those flying things in the old arcade game "Battle Zone".

Here is the code I started with:

import fl.transitions.Tween;
import fl.transitions.easing.*;


new Tween(logo_mc,"x", None.easeNone, 250, -300, 3,true);
width = logo_mc.width + 30;
height = logo_mc.height + 30;

I realize there is more I need to do to this code, but I am clueless now and I can't seem to find the right code for this anywhere else.

Any assistance with this will be highly appreciated.

thanks
sgonzal is offline   Reply With Quote
Old 12-30-2009, 08:07 PM   #2
zuperxtreme
Member
 
Join Date: Dec 2007
Posts: 85
Default

You should check out GreenSock's TweenLite/Max, it's fast, free and very easy to use:

http://blog.greensock.com/tweenlite/

From left to right, and scaling to twice the size is simply:

import com.greensock.*;
mc.x = mc.y = 0;
TweenLite.to(mc, 1, {x:340, y:340, scaleX:2, scaleY:2});
zuperxtreme is offline   Reply With Quote
Old 12-30-2009, 08:56 PM   #3
sgonzal
Registered User
 
Join Date: May 2009
Posts: 26
Default thanks

thanks zuperxtreme but I prefer to use Flash actionscript. I wonder if I could use a similar code using flash actionscript? Maybe even use the same code you suggested.

thanks
sgonzal is offline   Reply With Quote
Old 12-30-2009, 09:29 PM   #4
zuperxtreme
Member
 
Join Date: Dec 2007
Posts: 85
Default

TweenLite IS actionscript. It's built around it, all you need to do is download and place the folder "com" where your fla is.

If you don't want to use it, here's a tutorial on AS3's own Tween class: http://www.zedia.net/actionscript-3-tweens-tutorial/
zuperxtreme is offline   Reply With Quote
Old 12-30-2009, 10:00 PM   #5
sgonzal
Registered User
 
Join Date: May 2009
Posts: 26
Default thanks

thanks, I appreciate it.
sgonzal is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:55 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.