5 Replies Latest reply on Mar 21, 2010 5:29 PM by Flex harUI

    Where (or when) is the bound data on application load?

    Acclimation

      Hi,

      I am loading an embeded swf file into a Flex 3 application and I would like to pass some data that is bound to my flex app to the embeded 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 applicatio 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()"
          >


         [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: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 embeded flash application?

      Regards,

      Ben.