2 Replies Latest reply on Jan 13, 2010 12:33 PM by ZenForHire

    How do you use Event to pass data to sub application?

    ZenForHire Level 1

      Hi All,

       

      I'm unable to cast the event to the exact class that was sent.
      Event class really doesn't have a place to store custom data object for sub app to extract.

      We have no control over legacy SWFs that main app will load. Similar to portlets?

      MainApp.mxml fragments

       

      <!-- automatic load if in mxml -->
      <mx:SWFLoader id="testApp"
              loadForCompatibility="true"
              trustContent="true"
              width="100%" height="100%"
              source="TestAppWithPlayback.swf"
              complete="swfComplete();"/>

       

      var dynamicEvent: DynamicEvent = new DynamicEvent( LoadCaptureEvent.LOAD_CAPTURE_TYPE );
      dynamicEvent.capture = new CaptureModel();
      testApp.swfBridge.dispatchEvent( dynamicEvent );

       


      TestAppWithPlayback.mxml fragments

       

              public function applicationComplete() : void
              {
                 trace( "applicationComplete" );
                
                 var manager:ISystemManager = this.systemManager;
                    systemManager.loaderInfo.sharedEvents.addEventListener(
                      LoadCaptureEvent.LOAD_CAPTURE_TYPE,
                      captureEventHandler );
              }
             
              public function captureEventHandler( event: Event ) : void
              {
                  trace( "captureEventHandler" );

             }
      }

       

      What I've done to try to solve it:
      Test case where Events are successfully reaching the sub application.
      Flex Builder debugger shows the correct class of event was in handler
      I understand that the sent Event listeners are not strongly typed.
      I've read the Marshall Plan.
      I looked at Alex's powerpoint presentation.
      I've tried the SWFBridgeEvent with same casting problem.

       

       

      Cheers,

      Kevin