views:

229

answers:

1

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?

A: 

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

dispatchEvent(re);

from something that extends EventDispatcher

SP
I extended the flash class from MovieClip and used dispatchEvent(re) to trigger the event; but looks like it's not dispatching the event.
Satish