Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-25-2010, 08:36 AM   #1
teambuddies
Registered User
 
Join Date: Dec 2010
Posts: 8
Default [AS3] Advance function in event listener

I want to know if there is a way to use adavance function declaration in add event listener

Ex:
normally in addeventlistener we use this.
Code:
army.addEventListener (Event.ENTER_FRAME, movearmy);

function movearmy(event:Event):void{
//the code
}
but i want to use the advance function
ex:
Code:
function movearmy (event:Event, Object:MovieClip){
//the code
}
i want to place army in the object. but how to use it in addEventListener?

I use this:
Code:
army.addEventListener (Event.ENTER_FRAME, movearmy(, army));
but it give error.

Srr for the english...
teambuddies is offline   Reply With Quote
Old 12-26-2010, 03:10 AM   #2
VZX
Registered User
 
Join Date: Oct 2010
Posts: 15
Default

I usually have trouble with this. But before I know this method, I just tried to make a work around so that the event listener doesn't need extra information.

Best way you can do is to subclass Event for the passed object
i.e.
Class PassedObject extends Event.
{
data1:Object;
data2:Object;
}

That way, you can unpack the object later in the listener
VZX 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 10:36 AM.

///
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.