1 Reply Latest reply on Sep 24, 2009 4:56 AM by Muzak

    Listen for events from an embedded Swf


      Hi there,


      I have spend so long searching for an answer on the web but can not find any that works, please help!

      I'm not even sure if this is possible but if anyone can guide me in the right direction I would most appreciate it!


      Basically what I would like to do is to load a swf in to my flex application - contrary to my post title it doesnt even have to be embedded - when the loaded swf finishes playing it's animation I want for it to dispatch an event and for flex to listen for that event and trigger a function when the event is captured.


      The animation is made in Flash CS3. I have not used any classes, rather on the last frame I set up an action to dispatch an event like this:


      dispatchEvent(new Event("finishedPlaying"));


      In my Flex Application I load my swf using swfLoader and I add an event listener to it like so:


      mySwfLoader.addEventListener("finishedPlaying", test);


      and my function is like this:


      private function test():void


           trace("it worked!");



      This is not working at all and I'm sure I am missing something but I cant seem to find any straightforward answer on the internet!

      Is it at all possible for a swf made in flash to communicate with flex??

      Since they are both written in AS3, I figured it would be easy but alas!


      If anyone can help me I would most appreciate it, thank you in advance!!


      By the way I have also tried:


      mySwfLoader.content.addEventListener("finishedPlaying", test);


      but no luck....