Tweening with ActionScript

So the Tween/Transition stuff wasn’t put in the Flash documentation. Good news is that there’s now an article on the Developer Center about using the classes. Bad news is the article came from me 😉

If you haven’t used the classes yet, check the article out out anyway, see if it helps you with your Flash work. Fairly simple article (had to keep that word count in check…)

macromedia.com/devnet/mx/flash/articles/tweening.html

If you have any ideas for expanding the content, or wish to share some of your own tips, please comment below.

68 Responses to Tweening with ActionScript

  1. mikey lee says:

    You’re hot.

  2. steve w says:

    Jen – This is what I’ve been looking for. Just try finding this anywhere on the web. Thanks a lot for putting this together. Gonna definitely put this to good use!!Can you shed any light on why this wasn’t in the documentation for such a worthy feature?

  3. solomon71 says:

    Great article, it is nice to see that Macromedia published something on this. I think that you should have mentioned more about the Transition manager class.In the “mx.transitions.TransitionManager.start(eventObj.target, {type:mx.transitions.Zoom, direction:0, duration:1, easing:mx.transitions.easing.Bounce.easeOut, param1:empty, param2:empty});” code, the direction property of 0 is reveal the object and a value of 1 is hide the object.Also, there are events that let you know when the transition has finished, in case you want to make a call based on this event. See the following:var transListener:Object = new Object();transListener.allTransitionsInDone = function(evt):Void{// direction value of 0trace(evt.type + ” triggered”);};transMC.addEventListener(“allTransitionsInDone”, transListener);transListener.allTransitionsOutDone = function(evt):Void{// direction value of 1trace(evt.type + ” triggered”);};transMC.addEventListener(“allTransitionsOutDone”, transListener);

  4. ericd says:

    http://www.ericd.net/blog_images/transitions.htmli whipped something up about this a few weeks ago – good to get that info out there.jen – you have wild eyes.

  5. Peter Witham says:

    Great article, thanks for putting in the effort.

  6. Great tutorial, Jen!

  7. Syed Mazhar Hasan Qadri says:

    The article seems great advancement but i m having problems when i try to follow that. when followed the steps on page 3 of that article, i got this error message:**Error** C:\Documents and Settings\Administrator\Local Settings\Application Data\Macromedia\Flash MX 2004\en\Configuration\Classes\mx\events\EventDispatcher.as: Line 15: The name of this class, ‘mx.events.EventDispatcher’, conflicts with the name of another class that was loaded, ‘mx.events.EventDispatcher’.{**Error** C:\Documents and Settings\Administrator\Local Settings\Application Data\Macromedia\Flash MX 2004\en\Configuration\Classes\mx\transitions\TransitionManager.as: Line 33: There is no method with the name ‘EventDispatcher’.private static var __mixinFED = EventDispatcher.initialize (TransitionManager.prototype);**Error** C:\Documents and Settings\Administrator\Local Settings\Application Data\Macromedia\Flash MX 2004\en\Configuration\Classes\mx\transitions\Transition.as: Line 40: There is no method with the name ‘EventDispatcher’.private static var __mixinFED = EventDispatcher.initialize (Transition.prototype);Total ActionScript Errors: 3 Reported Errors: 3i used this code as indicated in that article:mx.transitions.TransitionManager.start(img1_mc, {type:mx.transitions.Zoom, direction:0, duration:1, easing:mx.transitions.easing.Bounce.easeOut, param1:empty, param2:empty});where img1_mc is my movieclip to be zoomed outplease tell me how can i solve this prob.

  8. Tom says:

    Great article!I would have added some more technical stuff to it. However, for an introduction to the topic its very good. Also, your aim might have been just to write something for AS beginners.I will try to find some technical documentation on these two classes as I think they will be very usefull after reading your paper about them.

  9. jdehaan says:

    Hi everyone,Thanks for the feedback! I agree that it would have been nice to have the room for some increasingly technical examples – maybe that’ll help argue for a part 2 ;)Syed, you might want to try a clean uninstall/reinstall of Flash. It appears as though there are problems with the classes on your hard drive. In case there are other issues, you might want to start with a fresh install.Regards,Jen.

  10. pim says:

    Gr8 stuffFor quick and dirty coding, if you don’t want to bother with eventListenres, you can just write:my_mc.allTransitionsInDone = function(){trace(“allTransitionsInDone”)}cheersPim

  11. pim says:

    About the quick and dirty code I just posted, I remember why I did it, the listeners don’t work on MovieClips, it does the job with ‘forms’ but not with MovieClip.I remembered some sweating there ;))//pim

  12. Nick says:

    Hi Jen,Great article – as a newby-ish to Flash, I really appreciate stuff that makes sense to me! The problem is, the more you know, the more questions you have! Can you shed some light on this one please?I’m developing motion tweens of jpg’s and matching their animation to an MP3 track that is also running (basically a music video). These motion tweens need to be done manually so that I can quickly match them to the music and check them out by simply hitting enter. However I would love their fade in and fade outs to be handled by the transition class (or tween class) as per your article (by making the jpg’s movie symbols). However when I add your code to create a transition in, it stops the manually created tween that I have put on the timeline – seems to override it (but I want it to fade in whilst also running my tween motion). I can get around it by putting the motion tween on the symbols timeline but that affects the workflow (i.e. I can’t then easily check out the movement against the music by hitting enter).Do you know of a way of making the actionscripted transition play whilst also allowing the manually created tween to play on the main timeline? If so that would be a great help.Many ThanksNick

  13. Monk says:

    I though this article was great, but there is one huge question that I think a few people have. And that would be, how would you use these tweening classes on multiple movieclip properties? For example on the “_xscale” and “_yscale” at the same time without having to write it in the following way:import mx.transitions.Tween;import mx.transitions.easing.*;new Tween(ball_mc, “_xscale”, Elastic.easeOut, 0, 200, 3, true);new Tween(ball_mc, “_yscale”, Elastic.easeOut, 0, 200, 3, true);Is there no way to write it as follows;import mx.transitions.Tween;import mx.transitions.easing.*;new Tween(ball_mc, [“_xscale”,”_yscale”] Elastic.easeOut, 0, [200,200] 3, true);What I’m getting at is, is there a neater way of doing this?

  14. pim says:

    There is another undocumented tween class in mx2004 that allows you to do this, the script goes like this:import mx.effects.Tweenmc.onTweenUpdate = function(args) {this._x = args[0];this._y = args[1];}t = new mx.effects.Tween(mc, [mc._x, mc._y], [300, 200], 3000);I found it here, the forum is in french (one of the best I know):http://www.tweenpix.net/archives/000057.htmlThe only problem I see in this example is the lack of support for easing functions.If you dig into the class the last function is:// defaults to sinfunction easingEquation(t,b,c,d){return c/2 * ( Math.sin( Math.PI * (t/d-0.5) ) + 1 ) + b;}I think you could easily update it and have easing supported.Hope this helpsCheers,Pim

  15. criz says:

    Great article!! Its already saving me countless hours of tweening.thanks!

  16. Will says:

    Excellent stuff yound lady. thank you!

  17. Devon O. says:

    Excellent article. I’m glad to see Macromedia finally officially acknowledge the use of these incredible classes.Can’t help but wonder where the naming conventions of “ball_tween” and “ball_mc” came from, though. Seems very reminiscent of the two tutorials here and here.Very well done though..d.

  18. jdehaan says:

    Yep, and many other books and artices I am sure has used the naming convention of “ball” for bouncing ball tutorials (and the other half follows best practices). Next time I’ll resort to something more creative for my balls, like my fave “pelican_mc” or “gnome_tween”.Other queries, will try to look into those this weekend! Thanks,Jen.

  19. Kenneth says:

    One question: i’m doing resizing, so i’m using _width/_xscale, but it always expands/shrinks to the right/bottom, is it possible to get it to do it from the center ?Thanks,Kenneth

  20. Kenneth says:

    One question: i’m doing resizing, so i’m using _width/_xscale, but it always expands/shrinks to the right/bottom, is it possible to get it to do it from the center ?Thanks,Kenneth

  21. eric says:

    From a garbage collection standpoint, how does one remove/delete a tween?outTween.onMotionFinished = function(){//insert garbage collector here???}Thanks in advance, -e.

  22. Jeff says:

    re: garbage collection:the onMotionFinished method is passed the instance of the tween class as an agrument, so you should be able to clean it up like so:outTween.onMotionFinished = function(item){delete item;}

  23. Jeff says:

    When tweening the _xscale/_yscale or height/width, its always going to go from the 0,0 point (the registration point). If your movieClip has the reg point in the top left, as the scale increases, it will grow down and left. If you set your registration point to the center, it will grow out to all sides equally.

  24. Sin says:

    The problem gets bigger when you want to zoom a particular zone. You will have to move your image with every scale you do. I tried this, but Flash doesn’t understand well floats…i supose.

  25. jeffH says:

    Is there any way to use the Wipe transition and have it Wipe down (vertical mask)?

  26. Anonymous says:

    Does anyone know how to use the removeAllTransitions() method in the TransitionManger class.I can’t seem to get it to work.I’m trying to invoke the method from within an instance of class.Thanks

  27. joe jordan says:

    Hey, is there a way i can put this in my class and pass vars to what type of transitons?

  28. Garry Schafer says:

    Is it possible to Tween a moviclip’s _tint?

  29. Terrance says:

    Garry, I don’t think you can use the tween/transition classes to modify the tint, although there may be some hacks. I think some alternate tween classes (non-MM) may offer some more advanced animation features.Check out http://laco.wz.cz/tween/?page=docs/tween

  30. Jesse Voogt says:

    For the transition parameter object, there are some parameters and values I don’t understand. This is the context: “…param1: empty, param2: empty…”. I am building a class using these transitions, and since ’empty’ has not been defined as a parameter, it won’t allow me to put the undeclared variable as the value of either param1 or param2. What am I missing here?Also, how about soom good documentation on how to use mx.transitions.TransitionManager without simply using the static method. I have made several instances of the TransitionManager by using the “new” keyword:var myTM = new TransitionManager(content_mc);and later on:myTM.startTransition(trans_params);This works fine for some transitions, like Fade, but Blinds & Iris don’t work like this. No clue why…

  31. Sarah says:

    Is Macromedia going to formally document these great classes anytime soon. This is a great tutorial, but I’d benefit much more from an API or more advanced doc.Cheers,Sarah

  32. Trent says:

    Jesse,The param1 and param2 are only used a few select transitions. I believe you can safely ignore them if they aren’t needed. Otherwise, instead of “empty”, try passing a “null” or “undefined” instead.As for static vs non-static calls to the TransitionManager, i’ve never tried. But, if it doesn’t work reliably, why not just use the static methods? Or am i missing something?-t

  33. Luiz says:

    Can anyone tell me where what is the difference between using onTweenEnd and onMotionFinished?ThanksLuiz

  34. Luiz says:

    Oh! There are 2 tween classes, mx.effects.Tween and mx.transitions.Tween. What a mess! Will macromedia ever chose between one of them?Anyway, since in my last post I was very objective, I’d just like to thank you – Jen – for the great documentation you published in the macromedia developer center.Thanks for your attentionByeLuiz

  35. peter says:

    Luiz,The two tween classes are used in different places. I believe the mx.effects.Tween class is used in a few of the components (Accordion, ComboBox, DataGrid, Menu, Tree, List), whereas the mx.transitions.Tween class is used by the Transition class (which i guess also includes TransitionManager class).My guess is that the two classes are kept separate on purpose due to performance or available features or some other optimization.

  36. peter says:

    Luiz,I think you already found your answer, but as for the differences between onMotionFinished and onTweenEnd, it depends which one of the two Tween classes you decide to use.As for some code, you can see the differences here:[actionscript]import mx.transitions.easing.*var ballTween:Object = new mx.transitions.Tween(ball_mc, “_x”, Elastic.easeOut, 0, 300, 3, true);ballTween.onMotionFinished = function() {  trace(“mx.transitions.Tween.onMotionFinished()”);}box_mc.onTweenUpdate = function(value:Number) {  this._x = value;}box_mc.onTweenEnd = function(value:Number) {  trace(“mx.effects.Tween.onTweenEnd()”);}var tw:Object = new mx.effects.Tween(box_mc, 0, 300, 3000);tw.easingEquation = Elastic.easeOut;[/actionscript]

  37. Jesse Voogt says:

    Thanks for explaining “param1” & “param2” — i made them null for now, although i still don’t know which transitions use them(?). About the static vs. instance methods of TransitionManager: The reason for using the instance method on my part was to be able to use some of the other instance methods, such as removeAllTransitions() && addTransition(). All I was able to figure out was that all the transitions that didn’t seem to work with the static method used masks. Currently I’m employing a hack that takes care of my problem, for now. The hack is based on the TransitionManager code:content.__transitionManager = new TransitionManager (content);by accessing content.__transitionManager after a call to TransitionManager.start(), I was able to use instance methods after all. Maybe later I will understand more of what is going on here…

  38. peter says:

    Sorry for the long post, but hopefully this will help somebody out there:/**direction* 0:In* 1:Outduration* # secondsstartPoint* 1:Top left* 2:Top center* 3:Top right* 4:Left center* 5:Center* 6:Right center* 7:Bottom left* 8:Bottom center* 9:Bottom right*/import mx.transitions.*;import mx.transitions.easing.*;TransitionManager.start(target_mc,{type:Iris,direction:0,duration:2,easing:None.easeNone,startPoint:5, // 1,2,3,4,5,6,7,8,9shape:”SQUARE” // SQUARE|CIRCLE});TransitionManager.start(target_mc,{type:Wipe,direction:0,duration:2,easing:None.easeNone,startPoint:1, // 1,2,3,4,6,7,8,9 (no 5)param2:empty});TransitionManager.start(target_mc,{type:PixelDissolve,direction:0,duration:2,easing:None.easeNone,xSections:10, // 1-50ySections:10 // 1-50});TransitionManager.start(target_mc,{type:Blinds,direction:0,duration:2,easing:None.easeNone,numStrips:10, // 1-50dimension:1 // 1:Vertical, 0:Horizontal});TransitionManager.start(target_mc,{type:Fade,direction:0,duration:2,easing:None.easeNone,param1:empty,param2:empty});TransitionManager.start(target_mc,{type:Fly,direction:0,duration:2,easing:None.easeNone,startPoint:6, // 1,2,3,4,6,7,8,9 (no 5)param2:empty});TransitionManager.start(target_mc,{type:Zoom,direction:0,duration:2,easing:None.easeNone,param1:empty,param2:empty});TransitionManager.start(target_mc,{type:Squeeze,direction:0,duration:2,easing:None.easeNone,dimension:1, // 1:Vertical, 0:Horizontalparam2:empty});TransitionManager.start(target_mc,{type:Rotate,direction:0,duration:2,easing:None.easeNone,ccw:false, // false|truedegrees:360 // degrees >= 1});TransitionManager.start(target_mc,{type:Photo,direction:0,duration:2,easing:None.easeNone,param1:empty,param2:empty});

  39. peter says:

    Jesse,So, the transitions that use “param1” or “param2” are; Wipe, Fade, Fly, Zoom, Squeeze, and Photo.Hope that helps_peter

  40. peter says:

    Another hidden gem, hot off the presses.it seems that the Transitions class has some static variables for in and out transitions:class mx.transitions.Transition {#include “Version.as”public static var IN:Number = 0;public static var OUT:Number = 1;So, to use that, you can just do:import mx.transitions.*;import mx.transitions.easing.*;TransitionManager.start(target_mc,{type:Iris,direction:Transition.IN,duration:2,easing:None.easeNone,startPoint:5, // 1,2,3,4,5,6,7,8,9shape:”SQUARE” // SQUARE|CIRCLE});

  41. peter says:

    Another day, another tip.looking through the Iris class, you can see that there are actually constants for the two shape types (CIRCLE and SQUARE). Not surprisingly, the constants are also named CIRCLE and SQUARE, so here be the sample code (note that the shape is now Iris.SQUARE instead of hardcoding the string “SQUARE”):import mx.transitions.*;import mx.transitions.easing.*;this.createEmptyMovieClip(“img1_mc”, 10);var mclListener:Object = new Object();mclListener.onLoadInit = function (target_mc:MovieClip):Void {    TransitionManager.start(target_mc, {type:Iris, direction:Transition.IN, duration:6, easing:Elastic.easeInOut, shape:Iris.SQUARE});}var my_mcl:MovieClipLoader = new MovieClipLoader();my_mcl.addListener(mclListener);my_mcl.loadClip(“http://www.flash-mx.com/images/image1.jpg“, img1_mc);

  42. peter says:

    Not sure if anybody even cares, but i mananged to dig up the default values for each of the Transitions. So if you’re using the TransitionManager class and something isnt working as expected, the transition may be using one of these default values…Global default params: {duration:2, direction:0 (or Transition.IN), easing:None.easeNone}[Transition Blinds] numStrips:10, dimension:0 (or horizontal)[Transition Fade] (no params)[Transition Fly] startPoint:4[Transition Iris] startPoint:5, shape:”SQUARE” (or Iris.SQUARE)[Transition Photo] (no params)[Transition PixelDissolve] xSections:10, ySections:10[Transition Squeeze] dimension:0 (or _xscale)[Transition Rotate] ccw:true, degrees:360[Transition Wipe] startPoint:4[Transition Zoom] (no params)Note: The default tween is actually a private method within the Transition class (Transition._noEase) although the equation is exactly the same as the equation in easing.None.easeNone.

  43. Ty Gossman says:

    Anybody know if there’s any other resources about using classes transitions & tweens, on the web, in print, or undersea scrolls…lol?I’m looking for the extreme shortcut version as usual. What about any actual .fla’s invoking any of the above, for tweaking at my perusal?Thanks.Email me by taking out the underscores or stop by the friends of Ed publisher forums’ I’ve been hanging out over there a bit lately…http://friendsofed.infopop.net/2/OpenTopic

  44. peter says:

    Are you looking for something specific Ty? Most of the code examples i pasted above are pretty much cut-paste.

  45. Luis Casillas says:

    I was wondering if anyone has used or seen the tweening classes in conjunction with XML data-bound image loaders? If so, can you share where I can find them?

  46. Katy Jackson says:

    This is great info, but I’m having a little trouble tweaking it for my specific use. I’d like the user to be able to click a button and then have a new movie clip transition in (much like a slide, but for various reasons, I’m not using slides). The movie clip isn’t on the stage when the user clicks the button so if I add the following code to the button:on (release) {_root.attachMovie(“mvclip-slide-1″,”slide1_mc”,1000);mx.transitions.TransitionManager.start(slide1_mc, {type:mx.transitions.Zoom,direction:0, duration:1, easing:mx.transitions.easing.Bounce.easeOut, param1:empty, param2:empty});}what happens is that the movie clip gets attached and the transition line of code is ignored. Is there a way I can attach or create a movie clip and then transition that in using the transitions class? Or should I have it already on the stage with the alpha set to 0?

  47. peter says:

    Katy,Your code worked for me using a Button symbol, but worked like you described using a movie clip as a button.What you can try is referring to the attached movie clip as _root.slide1_mc in the tween call, like so:[code]on (release) {_root.attachMovie(“mvclip-slide-1”, “slide1_mc”, 1000);mx.transitions.TransitionManager.start(_root.slide1_mc, {type:mx.transitions.Zoom, direction:0, duration:1, easing:mx.transitions.easing.Bounce.easeOut, param1:empty, param2:empty});}[/code]Or, the slightly sneakier method:[code]on (release) {var slide_mc:MovieClip = _root.attachMovie(“mvclip-slide-1”, “slide1_mc”, 1000);mx.transitions.TransitionManager.start(slide_mc, {type:mx.transitions.Zoom, direction:0, duration:1, easing:mx.transitions.easing.Bounce.easeOut, param1:empty, param2:empty});}[/code]The attachMovie() method returns a reference to the newly attached movie clip. So the previous code works for either a button or movie clip.Enjoy

  48. Katy Jackson says:

    You’re right, Peter, I was using a movie clip like a button. I should have made that clear. It’s still not working for me and I wonder if the problem is that I’m doing this from a movie loaded under _root, so I can’t put the attached movie clip on _root. I don’t see why that should make a difference, but perhaps it does.

  49. Katy Jackson says:

    Never mind and I post my silly mistake so that others like me need not suffer needlessly. I was referencing the instance name created in the attachMovie command – “slide1_mc” in the example below, when I should have been referencing the variable name “slide_mc”. Works great now – thanks for the help.

  50. Andrew King says:

    Is there any way of stopping a tween whilst it’s still going? Deleting the reference to it doesn’t work.

  51. Andy says:

    Hi Everyone!Finally found something about this stuff! YAY.I was just wondering if anyone had any success getting the onMotionStarted event to fire? When I try it doesn’t seem to work. I got onMotionStopped fine, but I would like to store the tween instance passed back through onMotionStarted (like in onMotionStopped) so that I can call a stop() on the tween to cancel onEnterFrame if need be. Anyone have any ideas?Running tween.onMotionStarted comes up with not much at all like http://wiki.media-box.net/documentation/flash/tween/onmotionstartedhelpful no. I’m guessing this is an undocumented feature of the tween class?

  52. peter says:

    Andy,You can get the onMotionStarted event to fire if you explicitly call the start() method in the Tween class, but i cant get the event to generate automatically at the beginning of each tween. Although, it shouldnt really matter since you should always know when the tween gets called anyways. Not sure why it doesnt fire. Maybe because the tween is started before the animation begins. *shrugs*Anyways, here’s a bit of code. Maybe it helps…[code]var ball_tween:Object = new mx.transitions.Tween(ball_mc, “_x”, mx.transitions.easing.Elastic.easeOut, 0, 300, 5, true);ball_tween.onMotionStarted = function() {  trace(“Started”);};ball_tween.onMotionStopped = function() {  trace(“Stopped”);};ball_mc.onRelease = function() {  ball_tween.stop();  ball_tween.start();};[/code]

  53. Andy says:

    Thanks for that peter very useful!Got that working great.I had a dig in the tween class and it looks as if the constructor calls the start(); method directly. I’m guessing that by adding the onMotionStarted handler after you create the new tween instance the start handler isnt defined when the constructor makes the call to start().

  54. Liza says:

    Hi Jen, want to say first that your article is great find.Hoping you can help as no one else seems to have documentation… is it possible to stop/pause an animation that uses the tween class? I would like to use playback/stop/rewind buttons to control the animation (so you could pause a movie then hit play to continue).Any ideas would be greatly appreciated. Thanks.Liza

  55. Brent says:

    Jen – thank you for your article – HUGE! And I cast my vote for a part 2 if it gets deeper into the nuts and bolts of the classes.Sorry for the long-ish post, but I have a question: has anyone satisfactorily used Tween() for a rollOver/rollOut state on a button? I tried the following://CODEimport mx.transitions.Tween;import mx.transitions.easing.*;ball_btn.onRollOver = function() {new Tween(ball_mc, “_x”, Regular.easeOut, ball_mc._x, 450, 3, true);};ball_btn.onRollOut = function() {new Tween(ball_mc, “_x”, Regular.easeOut, ball_mc._x, 50, 1, true);};//Using this method, without naming the tween, runs the risk of the tweens getting overlapped if a user rolls Over and Out quickly, essentially not ending the Over tween while starting the Out, and then jumping to the Over’s final position. Yuck.So, I end up doing the following://CODEimport mx.transitions.Tween;import mx.transitions.easing.*;var ball_in:Object;var ball_out:Object;ball_btn.onRollOver = function() {ball_out.stop();ball_in = new Tween(ball_mc, “_x”, Regular.easeOut, ball_mc._x, 450, 2, true);};ball_btn.onRollOut = function() {ball_in.stop();ball_out = new Tween(ball_mc, “_x”, Regular.easeOut, ball_mc._x, 50, 1, true);};//Works and all, but it seems a little kludgy. Has anyone discovered a solution that I’m just NOT seeing here? Thanks again for all the great work Jen (and all others who have offered tips in these posts!)

  56. Eric Muyser says:

    Brent,It seems to me that the Tween’s don’t overlap. Your first code works fine, doesn’t it?———————————————–I would also like to know how to Tween _tint. I wont stop until I find out how. On a post, http://www.actionscript.org/forums/showthread.php3?t=86593, Grimshaw provides a semi-working version of tweening color.BTW, great article Jen!

  57. Adham Elrayyes says:

    Jen,How would you go around in combining two transitions (i.e. wipe and fade) for an MC.For example, it wipes from top to bottom while fading in.

  58. peter says:

    Adham, you can just combine the two transitions by calling them back-to-back, like so:[code]import mx.transitions.*;import mx.transitions.easing.*;// FadeTransitionManager.start(target_mc, {type:Fade, direction:0, duration:2, easing:None.easeNone});// WipeTransitionManager.start(target_mc, {type:Wipe, direction:0, duration:2, easing:Strong.easeIn, startPoint:1});[/code](Where “target_mc” is the instance name of a MovieClip on the Stage.)Hope that helps,_peter

  59. Now here is one to wrap your noodle around. How do I use variable objects, as opposed to just a hardcoded object?example: instead of using:fadeClientLogo = new Tween(object, “_alpha”, Normal.easeOut, object._alpha, 0, .1, true)I would like the object to be a variable that holds the name of WHATEVER I load into it, so that I can make this code a bit more reuseable. So I would want to write something like this (but the below code doesn’t work…thus the problem):fadeClientLogo = new Tween(_root+”.clientGridMC.logoHolder”+logoNumber, “_alpha”, Normal.easeOut, _root+”.clientGridMC.logoHolder”+logoNumber+”._alpha”, 0, .1, true)See if you can crack that nut for me. Otherwise, I have to repeat the code 16 time, simply to change the object name from “logoHolder1” to “logoHolder2”, etc…etc.

  60. BTW, great article Jen. I have gotten a lot of use out of this technique!You have a mailing list of any sort so I know when new articles have been posted??

  61. Jane_D says:

    Hi all,I noticed the discussion about “param1” & “param2” for use in transitions and I see where param1 is discussed thoroughly, however, it appears that “param2” is never used in any of the transition types. My question is why have a “param2”, if it is not used for anything?Jane_D

  62. velasquez says:

    “Posted by jdehaan at January 4, 2005 11:25 AMCommentsYou’re hot.”LOLgreat article by the way, very handy.

  63. Rob Cutforth says:

    Hi Jen,It’s been asked here a few times, but I am gonna ask it again just in case someone has found out the answer since…How do you stop the blooming things mid-Tween?

  64. Rob Cutforth says:

    Oops, the answer came to me almost the second I posted my last comment. After trying to over complicate things by trying to remove the tween andtweenName = new Tween(); I thought to myself, “Wait, how do you stop a tween that’s running on the timeline?”Yeah, tweenName.stop();D’oh.

  65. suBi says:

    Hi Jen,working on a one frame only flash animation that uses tween classes and some loader components to dynamically load images. When i publish, the thing works fine in all browsers. But if i refresh, it doesn’t in IE 6 and 7 while it does in Firefox, Safari etc… what do i do?? Its a school project and until its done.. i can’t be able to post it anywhere to show you the problem. using a PC with adobe flash cs3.

  66. suBi says:

    and since its a one frame only animation and no timeline tween was done (all was done in actionscript), when i refresh in IE 6/7 the swf goes to a state as my stage is set at.

  67. dereck says:

    ActionScript.org is the premier ActionScript developer community online for Flash and Flex users.