0
votes

I've a Flex application which loads a Flash swf via SWF loader; the Flash swf is in AS3. the flash swf has code to dispatchEvent a Text Event

Flash Code:

var re:TextEvent = new TextEvent(TextEvent.TEXT_INPUT,true,true);


Flex Code:

<mx:SWFLoader source="menu.swf" id="mnu" complete="menuLoaded(event)" />
 private var mySwfMve:MovieClip;
 function menuLoaded(event:Event): void {
    mySwfMve = mnu.content as MovieClip;
    addEventListener(Event.ENTER_FRAME,enterFrameHandler);
    mySwfMve.addEventListener(TextEvent.TEXT_INPUT,textInputEventHandler);
 }

private function enterFrameHandler(eft:Event):void {
trace(eft.toString()); /* This works fine , I can see enter frame events in Flex builder debug trace */
}

private function textInputEventHandler(tme:TextEvent):void {
   trace(tme.toString());/* NOT WORKING, I've a dispatchEvent in Flash Swf
}

I don't see any TextEvents being dispatched from Flash. They are not seen in the debug trace.. I can capture enter frame events however.

Any ideas?

1
What happens if you add the event listener directly to the SWFLoader instead of to the content? Also note that you are not adding the ENTER_FRAME event listener to the SWFLoader, so that is not an indicator that the events are being dispatched/caught correctly from the MovieClip.Karthik

1 Answers

0
votes

Just creating the event doesn't dispatch it. You need to

dispatchEvent(re);

from something that extends EventDispatcher