Maybe: 

var shakable:*; 

flower.addEventListener(MouseEvent.ROLL_OVER,jiggle);

function jiggle(e:Event):void
{
        shakable = e.currentTarget;
     var timer:Timer=new Timer(2,1000000);
     timer.addEventListener(TimerEvent.TIMER,shakeBtn);
     timer.start();
}

function shakeBtn(e:Event)
{
     shakable.main.rotation+=Math.random()*8-4;
     shakable.main.x+=Math.random()*8-4;
     shakable.main.y+=Math.random()*8-4;
}

Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net

> -----Original Message-----
> From: [email protected] [mailto:flashcoders-
> [email protected]] On Behalf Of Lehr, Theodore
> Sent: Wednesday, April 28, 2010 7:36 AM
> To: Flash Coders List
> Subject: [Flashcoders] passing obj name
> 
> 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
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to