0
votes

I find the flexibility in using fx:script to get all AS3 see each other easily but I have a few MXML module, some actionscript from main.mxml want to access the ID in specific module such as module1.mxml. How do I get it to work?

1
Maybe a duplicate question, take a look at this answer stackoverflow.com/questions/2289314/… - papachan
I have no idea what you're asking. Can you make this more coherent? - J_A_X
I'm with @J_A_X on this one. You should consider rewording your question to a bit more clear. Do you want to access a variable that exists inside a separately compiled MX Module? - JeffryHouser
ok papachan, I guess this was the only way to get it work. Thanks. - vast1

1 Answers

0
votes

Assuming you have a module1.mxml is a defined component in main.mxml, you can give it an ID and reference public variables and functions inside of it. The following shorthand code demonstrates this.

<mx:Application creationComplete="creationCompleteHandler()">
  <fx:Script>
     function creationCompleteHandler() : void
     {
        m1.initializeModule();
     }

  </fx:Script>
  <module1 id="m1" />
</mx:Application>