RE: [Flashcoders] passing obj name
lol - thanks everyone - good stuff From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Keith Reinfeld [keithreinf...@comcast.net] Sent: Wednesday, April 28, 2010 9:39 AM To: nat...@mynarcik.com; 'Flash Coders List' Subject: RE: [Flashcoders] passing obj name > 100 There's a whole lotta shakin' goin' on... Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ 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
Re: [Flashcoders] passing obj name
Oops - I didn't truly read the email - my apologies. Storing the target is probably a decent way to go. On Wed, Apr 28, 2010 at 9:33 AM, Nathan Mynarcik wrote: > 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,100); > 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" > Date: Wed, 28 Apr 2010 08:59:05 > To: Flash Coders List > 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 > wrote: > > > so I have: > > flower.addEventListener(MouseEvent.ROLL_OVER,jiggle); > > > > function jiggle(e:Event):void > > { > > var timer:Timer=new Timer(2,100); > > 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 > -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] passing obj name
> 100 There's a whole lotta shakin' goin' on... Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] passing obj name
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,100); 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" Date: Wed, 28 Apr 2010 08:59:05 To: Flash Coders List 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 wrote: > so I have: > flower.addEventListener(MouseEvent.ROLL_OVER,jiggle); > > function jiggle(e:Event):void > { > var timer:Timer=new Timer(2,100); > 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
RE: [Flashcoders] passing obj name
Maybe: var shakable:*; flower.addEventListener(MouseEvent.ROLL_OVER,jiggle); function jiggle(e:Event):void { shakable = e.currentTarget; var timer:Timer=new Timer(2,100); 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: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders- > boun...@chattyfig.figleaf.com] 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,100); > 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
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 wrote: > so I have: > flower.addEventListener(MouseEvent.ROLL_OVER,jiggle); > > function jiggle(e:Event):void > { > var timer:Timer=new Timer(2,100); > 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
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 wrote: > so I have: > flower.addEventListener(MouseEvent.ROLL_OVER,jiggle); > > function jiggle(e:Event):void > { > var timer:Timer=new Timer(2,100); > 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