1 Reply Latest reply on Dec 5, 2007 3:51 PM by jpsoul

    Accessing External App through SystemManager

    KennyIsMe
      Hi All

      Using the example at http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDo cs_Parts&file=00000543.html I was able to load one flex application into another application. Nice and easy using the SystemManager to access the methods and variables in the loaded application. That left me with:

      - main.mxml (my main application); and
      - local.mxml (the application I'm loading into main.mxml - just contains a simple TitleWindow with a label that can be manipulated by buttons clicked in main.mxml)

      I then changed this slightly so that I could make use of the PopUpManager. The reason I did this was so that I could load local.mxml (or rather the compiled SWF file, local.swf) into a TitleWindow CUSTOM COMPONENT and therefore allow users to move it aroundf the screen like a normal windows app. (It's at this point where you guys can start chipping in and telling me I'm doing it all wrong!) This then left me with:

      - main.mxml (containing PopUpManager to open localWindow.mxml)
      - localWindow.mxml (a TitleWindow component that uses SWFLoader to load local.mxml into itself)
      - local.mxml (the application I'm loading into localWindow.mxml - just a white canvas with a label I want to access from main.mxml)

      Since local.mxml is just a canvas, when I load it into localWindow.mxml (a TitleWindow custom component) it looks just the same as the Adobe example but with the added benefit that the window can be dragged around the screen.

      However ....

      My problem now is that I'm unsure how to access the methods and variables in local.mxml from the main.mxml application. I obviously still need to use SystemManager but I'm not sure how.

      Can someone please point me in the right direction?

      Cheers,
      Kenny.
        • 1. Re: Accessing External App through SystemManager
          jpsoul Level 1
          I have been having the same problem and this is what I came up with...and it's not pretty. I would like to know the right way to do this, but this worked: Object(SystemManager(loader.content).application).doSomething();

          I don't really understand this. I know eventually I type cast to Object so that I can call any method I want. Without that I get a "Call to possibly undefined method" error.

          If I just do Object(loader.content).doSomething(); I get a runtime error: " ReferenceError: Error #1069: Property doSomething not found on _FlexApp_mx_managers_SystemManager and there is no default value."

          This all seems very convoluted and I'm sure I'm missing something. Does anyone know the right way to handle this?