Simple Tweening: Actionscript Problem

  • diminisheduk
  • Born
  • Born
  • No Avatar
  • Joined: Dec 12, 2007
  • Posts: 1
  • Status: Offline

Post December 12th, 2007, 7:54 am

hey there, i have an assignment due in to university this friday and i'm having trouble getting two things to function correctly. i know these two problems are amateur as that is the level i am at, but any help to correct them would be really appreciated!

for the assignment i have been asked to create a simple city scene in which a car drives past on the road at the bottom and where the sky turns from daytime to night time.

i have created the scene and have encountered the following:

the sky goes from night to day (the wrong way round from how it should be) and the car, consisting of a rectangle and two circles for wheels, although using the same speed settings, goes across the screen with the body and wheels all going at different speeds.

...here is the code for the sky effect:

// make sky go from day to night
new Tween(skyBlack, "_alpha", Smooth.easeIn, 100, 10, 30, true);

...and here is the code for the car:

// animate the car
new Tween(wheel1, "_x", Soft.easeOut, 820, -220, 3, true);
new Tween(wheel2, "_x", Soft.easeOut, 880, -220, 3, true);
new Tween(carBody, "_x", Soft.easeOut, 820, -220, 3, true);

i have also been asked to make stars come out in random positions but that really scares me lol...

i have attatched the file in question so hopefully that will help.

thanks again for all feedback received!
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post December 12th, 2007, 7:54 am

  • MikeStrider
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Dec 13, 2007
  • Posts: 6
  • Status: Offline

Post December 13th, 2007, 1:50 pm

this is how i would compete your assignment

http://www.windsornaturopath.com/Untitled-1.swf

Use layers not actionscript
create a box and turn it to a movie clip
use the alpha box to do fading
fade blue out and black in

Image
  • tarafenton
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 12, 2005
  • Posts: 19
  • Loc: Fort Lauderdale, FL USA
  • Status: Offline

Post December 14th, 2007, 12:34 pm

// make sky go from day to night

new Tween(skyDay, "_alpha", Smooth.easeIn, 100, 10, 30, true);
or
new Tween(skyBlack, "_alpha", Smooth.easeIn, 0, 10, 30, true);
...and here is the code for the car:

// animate the car
-220 is the end point for all but if it starts at a different point it will move at different speeds but end up in the same point
820 is 60 less than 880
so new Tween(wheel2, "_x", Soft.easeOut, 880, -220, 3, true); should be changed to new Tween(wheel2, "_x", Soft.easeOut, 880, -160, 3, true);
  • MikeStrider
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Dec 13, 2007
  • Posts: 6
  • Status: Offline

Post December 14th, 2007, 12:38 pm

I have never used this new Tween code ... looks interesting ... is there an advantage to doin it in code rather then frames ?
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post December 15th, 2007, 1:36 am

Yes there are more advantages using actionscript than just using the flash editor. Imagine you want to do a snow effect. I doubt you will have the patience to do by hand all the snowflakes :D.
In the tween case , you can make a function with the target as parameter, so you can pass any movieclip for tweening. You can also control the tween at every step, thanks to the Listener object.
This will reduce quite a lot the amount of work.
i.e.:
Code: [ Select ]
var myTween;
function DoTween(mcTarget:MovieClip):Void
{
  myTween = new Tween(mcTarget, "_alpha", Smooth.easeIn, 100, 10, 30, true);
}
  1. var myTween;
  2. function DoTween(mcTarget:MovieClip):Void
  3. {
  4.   myTween = new Tween(mcTarget, "_alpha", Smooth.easeIn, 100, 10, 30, true);
  5. }
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 98 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.