Twango Posted August 31, 2010 Share Posted August 31, 2010 Hi, I use As3/CS5,I (generally) use:MovieClip.addEventListener(MouseEvent.CLICK, declareFunc);function declareFunc(M:MouseEvent):void{stop();}but i want to just do MovieClip.addEventListener(MouseEvent.CLICK, gotoAndStop(2));or somthing, but this gets an error, how can i fix this?Thanks Link to comment Share on other sites More sharing options...
Ingolme Posted August 31, 2010 Share Posted August 31, 2010 Hi, I use As3/CS5,I (generally) use:MovieClip.addEventListener(MouseEvent.CLICK, declareFunc);function declareFunc(M:MouseEvent):void{stop();}but i want to just do MovieClip.addEventListener(MouseEvent.CLICK, gotoAndStop(2));or somthing, but this gets an error, how can i fix this?Thanks When adding an event listener, you can only send a reference to a function. If you use parenthesis you're running the function right there and sending the return value as the event handler. Since the return value of gotoAndStop() is not a function, it throws an error.Something like this should work:MovieClip.addEventListener(MouseEvent.CLICK, declareFunc);function declareFunc(M:MouseEvent):void{gotoAndStop(2);} Link to comment Share on other sites More sharing options...
Twango Posted September 1, 2010 Author Share Posted September 1, 2010 Ok, so, basically, i cant have more then 1 set of ()'s Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.