Create a variable to store the item to shake: var itemToShake:MovieClip;
flower.addEventListener(MouseEvent.ROLL_OVER,jiggle); function jiggle(e:Event):void { var timer:Timer=new Timer(2,1000000); timer.addEventListener(TimerEvent.TIMER,shakeBtn); timer.start(); itemToShake = e.currentTarget; } function shakeBtn(e:Event) { itemToShake.main.rotation+=Math.random()*8-4; itemToShake.main.x+=Math.random()*8-4; itemToShake.main.y+=Math.random()*8-4; } -----Original Message----- From: "Lehr, Theodore" <ted_l...@federal.dell.com> Date: Wed, 28 Apr 2010 08:59:05 To: Flash Coders List<flashcoders@chattyfig.figleaf.com> Subject: RE: [Flashcoders] passing obj name no - I think because the e at that point is for the timer.... ________________________________________ From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Eric E. Dolecki [edole...@gmail.com] Sent: Wednesday, April 28, 2010 8:49 AM To: Flash Coders List Subject: Re: [Flashcoders] passing obj name function shakeBtn(e:Event):void { e.target.main.rotation+=Math.random()*8-4; I think that should work On Wed, Apr 28, 2010 at 8:36 AM, Lehr, Theodore <ted_l...@federal.dell.com>wrote: > so I have: > flower.addEventListener(MouseEvent.ROLL_OVER,jiggle); > > function jiggle(e:Event):void > { > var timer:Timer=new Timer(2,1000000); > timer.addEventListener(TimerEvent.TIMER,shakeBtn); > timer.start(); > } > > function shakeBtn(e:Event) > { > flower.main.rotation+=Math.random()*8-4; > flower.main.x+=Math.random()*8-4; > flower.main.y+=Math.random()*8-4; > } > > How can I pass mc name ("flower") down to shakeBtn so that I can reuse the > function.... > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- http://ericd.net Interactive design and development _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders