I have a loaded swf(CustomClass) and I want to listen a dispatch event from the swf, but it doesn’t seems to work.
The relation of the dynamic class are:
tablet(DocClass of the swf) ---> mainmenuC
I’m trying to pass a event to a function in tablet, and have the codes listen to the dispatchEvent from the function in tablet.
CustomClass.addEventListener("profile_home", currentPage)
private function currentPage(event:CustomEvent):void {
trace("profile home clicked")
}
tablet.as
package
{
import flash.display.*;
import flash.events.*;
public class tablet extends MovieClip
{
public var mC:mainmenuC;
private static var _event:Event;
private static var dummy:uint = 0;
public function tablet():void
{
mC= new mainmenuC();
targetMC.addChild(mC);
}
public function dispatchE(event:CustomEvent):void
{
dispatchEvent(event);
}
}
}
mainmenuC.as
tab = new tablet()
var ev:Event=new CustomEvent("profile_home")
tab.dispatchE(ev);
it doesn’t return any error, but why does it not pass the data?