apache-flex - Flex 中是否有 init() 方法,如 Servlet init() 只执行一次

标签 apache-flex flex3 flex4 flexbuilder

Flex 具有任何 init()、destroy() 方法。就像 Servlet init() 方法将在应用程序初始化时运行,并且如果刷新页面也不会再次调用它。

最佳答案

我建议不要使用初始化事件,而使用creationComplete。所有 UIComponent 在完成自身及其子组件的构建后都会调度该事件。该事件在组件初始化、有机会测量自身、执行布局并添加到舞台后执行一次。

<mx:Application ... creationComplete="init()"/>
   <mx:Script>
       private function init() : void {
           ...  // put your initialization routine here
       }
   </mx:Script>
</mx:Application>

关于apache-flex - Flex 中是否有 init() 方法,如 Servlet init() 只执行一次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6818125/

相关文章:

css - 在 Flex 4.5 中,如何在自定义 CSS namespace 中对样式使用 getStyleDeclaration?

actionscript-3 - 我怎样才能在 View 堆栈之间很好地动画

macos - as3 scanHardware()函数使我的应用程序崩溃

apache-flex - 将屏幕截图图像保存到 Flex 4 中的文件

java - 我们可以将文本区域中的数据保存到文本文件中吗?

php - 这个 URLRequest 或 Loader 有什么问题?

ios - Flex iOS 应用程序在没有互联网连接的情况下无法启动,然后显示不需要的弹出窗口

apache-flex - 弹性加载策略文件 crossdomain.xml

css - 禁用组合框时更改填充颜色

size - 弹性 4 : Is it possible to have a BorderContainer automatically size to the contents within it?