Okay, that makes sense. Sort of...

I already have an event listener setup for the SWFLoader objects. I try
to check if the loaded app is finished initializing and proceed,
otherwise I try again in a second. Here's a snippet:

--------------
<mx:SWFLoader source="source_to_app.swf"
complete="loaderComplete(event);" trustContent="true"/>

<mx:Script>
   <![CDATA[
     private function loaderComplete(e:Event):void
     {
       if (e.currentTarget.content.application) //is the app initialized?
       {
          //trigger the generation of the chart...
       }
       else //if not, try again in 1 second
       {
         setTimeout(loaderComplete, 1000, e);
       }
     }
   ]]>
</mx:Script>
--------------

Is this the right way to do such a thing? It seems to work for me.
Before implementing this, I was attempting to access
e.currentTarget.content.application["varname"] before the variables
existed, and that for sure caused runtime errors.

One thing along these lines that may be the problem...the loaded app
switches "states" before working on building the chart. The new state
adds the chart object to the display. So does the chart object not exist
before we switch states? Is it possible I'm attempting to access objects
in the new state before the state is fully built?

When the code:

currentState = 'chart';

is executed, is the state fully built before the next line of code is
executed? Or could something like this cause a problem:

currentState = 'chart';
itemInChartState.visible = false //as an example

Is it possible itemInChartState doesn't exist yet?

Thanks for the help.
Tyler


--- In [email protected], "Angus Johnson" <[EMAIL PROTECTED]>
wrote:
>
> That error indicates that your are referencing something that doesn't
exist
> yet.
>
> You need to set listeners of the swfloader(s) to ensure that they are
loaded
> and complete. See the doc's which has an example of setting them.
>
> Wait for the complete event then fire your charting.
>
> Post back if you need more help.
>
> Angus

Reply via email to