1 Reply Latest reply on Oct 1, 2011 8:02 PM by BubbaRichard

    Loading a swf movie in flex and accessing it's classes

    BubbaRichard

      I'm a flash/flex newbie. Think this is the right forum, the Flash Builder forum seems to be for installation only.

       

      I've create a movie in Flash Builder ( a map ) that has two events. Now I've loaded it into a SWFLoader in a flex 4.5 project, it plays and acts correct. I imported a SWC of the same movie into the flex project so I could access the events. They show up but I cannot cast the content of the movie loader to the MapView class, which I need to do to do the addEventListener for the maps two events. I've tried adding the event listener to both the loader and directly to the content and to it's root. How can I attach the event listener to the flash builder class in flex?

       

      Thanks,

      Bubba

        • 1. Re: Loading a swf movie in flex and accessing it's classes
          BubbaRichard Level 1

          Found it after 8 1/2 hours of searching

           

             public function mapLoaded( e:Event ) : void

             {

              if( !mapBar.content.hasEventListener( MapHotSpotEvent.HOTSPOT_EXPANDED ) )

              {

               mapBar.content.addEventListener( MapHotSpotEvent.HOTSPOT_EXPANDED, mapExpanded );

               mapBar.content.addEventListener( MapHotSpotEvent.HOTSPOT_CLICKED, mapExpanded );    

              

               var flx:Object = e.target.getChildAt(0);

               var bar:* = flx.getChildAt(0);

               bar.content.addEventListener( MapHotSpotEvent.HOTSPOT_EXPANDED, mapExpanded );

               bar.content.addEventListener( MapHotSpotEvent.HOTSPOT_CLICKED, mapExpanded );

              }

             }