On Wed, Nov 25, 2009 at 4:26 PM, beno - <[email protected]> wrote:
> On Wed, Nov 25, 2009 at 3:36 PM, Barry Hannah <[email protected]> wrote: > >> Try: >> >> public function myLeftHand(e:Event=null):void { >> // >> } >> >> >> The myLeftHand method is being called when an event fires, so the event >> must be passed in as a method parameter. "Event=null" allows the event >> to be optional - so you could also call it without dispatching an event. >> > > This worked. > >> >> Whomever told you to use enterframe to have something happen on frame 20 >> made a mistake. It's a valid way to get it working, I personally think >> an enterframe loop is a waste of resource for that case and, more >> importantly, I just don't think you're there yet. Go back to putting an >> action on the timeline at frame 20. >> > > You have a good point, of course. But I am going to do this anyway. I will > be calling this mc many times. Besides, I firmly believe that the "right" > way to do this is calling the event as I enter frames. I have to learn it > sooner or later if I'm ever going to do anything substantial with Flash. > That much is obvious to me. Actually, the below code works, but isn't pretty > on screen so will have to be tweaked. I also just noticed (and am > re-posting) that this code doesn't trigger on frame 20 after all, but rather > on frame 1. Please advise. > > > public function myLeftHand(e:Event=null):void > { > var mcHandInstance2:mcHand = new mcHand(); > addChild(mcHandInstance2); > mcHandInstance2.x = 800; > mcHandInstance2.y = 200; > if (e.target.currentFrame == 20) TweenMax.to(mcHandInstance2, 2, > {x:200, startAt:{totalProgress:1}}).reverse(); > } > > >> Paul Andrews also wrote: > > Beno, The problem with the above line is pretty obvious. It is so obvious, > that I am going to let you find it for yourself. If you look at some > examples using TweenMax, it should jump out at you. > > You're right. I didn't look at examples because I was focused on counting > parenthesis and braces! Sorry. > beno > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

