Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-09-2012, 03:57 PM   #1
flip-Ed
Registered User
 
Join Date: Dec 2011
Location: India
Posts: 38
Default stage.addEventListener vs mc.addEventListener

Hi
Can someone please explain the difference between stage.addEventListener and mc.addEventListener

I made a code and added the function by saying stage.addEventListener(Event.ENTER_FRAME, func);


in my function I wrote for example
function func(e:Event):void{
mc.x +=10;
}
and so on


now I want to add the listener to a certain movieclip so i changed it to mc.addEventListener(Event.ENTER_FRAME, func); but that doesnt work

for this one I tried changing the code to
function func(e:Event):void{
e.target.x +=10;
}

so I can use this function on multiple movieclips instead of only the one called 'mc'


what am I doing wrong?

Thanks!

Last edited by flip-Ed; 02-09-2012 at 04:00 PM.
flip-Ed is offline   Reply With Quote
Old 02-09-2012, 06:46 PM   #2
PBFrO
Senior Member
 
Join Date: Jan 2007
Location: Orange County, CA
Posts: 573
Default

Try

ActionScript Code:
mc.addEventListener(Event.ENTER_FRAME, func); function func(e:Event):void{ e.currentTarget.x +=10; }
__________________
My Portfolio
PBFrO is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:54 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.