tags:

views:

186

answers:

1

enter code hereBeen really frustrating just trying to load a swf from a swfloader in Flex and then accessing it's content. I'm sure once I figure out how to do it once then it'll be fine, but I've gone thorugh a bunch of tutorials and somethings not right. Here's my flex code:

and the as code:

public function initHeaderSwf():void { trace("INITIATIED"); //trace(headerSwf.content['weekNo'].text = "TWRTWERWEWE"); headerSwf.addEventListener(Event.COMPLETE, onHeaderLoaded);

        }


        private function onHeaderLoaded(evt:Event):void
        {

            trace("LOAD YOU JERK! = " + headerSwf.content['weekNo'].text);

        }

Here's the problem:

The swf loads, there is no problem there. I see it in my compiled swf. but the complete event doesn't fire. CreationComplete will fire, and then I try, after that, to make a event listener for loading the actual swf, that doesn't fire. I've tried it a variety of different ways with no luck.

All I am trying to do is change a text field in the loaded swf. I imagine this might be a problem with the sequence of things loading or something like that, but not sure.

A: 

When are you adding the event listener? Is it possible you are adding the listener after the event has already fired?

Wesley Petrowski
Well I tried adding the event listener directly from the swfloader like this<SWFLoader complete="onLoadComplete(event)" />But that doesn't fire the event either.
pfunc
apparently it is because I am using Embed. So it is already included in the swf and doesn't need to be loaded. ugh, can't believe that just took 4 hours to figure out.
pfunc