tags:

views:

11

answers:

0

Hi,

I am loading an embedded swf file into a Flex 3 application and I would like to pass some data that is bound to my flex app to the embedded flash.

The problem is that I can't seem to get a reference to the bound data at any point in the Flex load time right up until the applicationComplete event (which I believe is the last event) the bound variable is null. I have even tried the callLater(). However, if I show the variable from a button on the application it has all the data - proving that the binding is ok. This application is running in a SAP server (WebDynpro ABAP FlashIslands).

Here is the relevant code:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
horizontalAlign="left" width="100%" height="100%"
initialize="onInitialize()"
applicationComplete="onApplicationComplete()"
>

<mx:Script>
        <![CDATA[
   [Embed(source="chart.swf", mimeType="application/octet-stream")]
   [Bindable]
   public static var chartSwf:Class



// 'positions' bound to external data source (in SAP)
   [Bindable]
   public var positions:ArrayCollection;


   private function onInitialize():void{
      Alert.show("at init - positions: "+positions);  //Shows positions is null
   }


   private function onApplicationComplete():void{
      Alert.show("at application complete - positions: "+positions); //Shows positions is null
   }

   private function test():void{
      Alert.show("positions: "+positions); //positions has data from the binding when called from button below
   }

]]>
     </mx:Script>



<mx:Button label="Test" click="test()" right="142" top="10"/>

Does anyone know how I can get access to the data at load time so that I can initialize my embedded flash application?

Regards,

Ben.