2 Replies Latest reply on Mar 7, 2012 12:16 PM by Handycam

    Creating an app that can load other apps?

    Handycam Level 1

      I have a SWf application built in flex 4. One part of the application relies on accessing a public variable ("step1") set at the application root, and is accessed with

      var app:Object = FlexGlobals.topLevelApplication;
      trace
      ("step one is "+app.step1);

      This, while not optimal, has worked fine. Now, hoever, I need to load this entire application into another application, and I can't figure out how to access my step1 variable any longer.

      I have been loading the swf into the new parent application like so:

      public var myLoader:Loader = new Loader();   
      public var pizzaContainer:UIComponent = new UIComponent();

      private var myUrl:URLRequest = new URLRequest("chickensoup.swf");

      protected function application1_creationCompleteHandler(event:FlexEvent):void {
         myLoader
      .load(myUrl);                                  
         pizzaContainer
      .addChild(myLoader);               
         addElement
      (pizzaContainer);
      }

      And I have tried using FlexGlobals.topLevelApplication.pizzaContainer to no avail. What would be the method of acessing a public variable at the root of the loaded application?