简体   繁体   English

fx:AS3和MXML的脚本是什么?

[英]fx:script for AS3 and MXML for?

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. 我发现可以灵活地使用fx:script使所有AS3相互了解,但我有一些MXML模块,main.mxml中的一些actionscript希望访问特定模块(例如module1.mxml)中的ID。 How do I get it to work? 我如何使它工作?

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. 假设您有一个module1.mxml是main.mxml中已定义的组件,则可以为其指定ID并引用其中的公共变量和函数。 The following shorthand code demonstrates this. 下面的简写代码演示了这一点。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM