在特定时间调用 flex initComplete
下面是 Flex 中预加载器的完整函数的重写。
private function initComplete(e:Event):void
{
//dispatchEvent(new Event(Event.COMPLETE));
cp.status.text="Configuring... Please Wait";
}
我想做的是,当应用程序完成加载时,我想将预加载器文本更改为“配置”。 然后我想在我的代码中做一些设置。
一旦我完成了我想要的所有设置,如何让预加载器从代码中的其他位置分派其 Event.complete ?
我尝试了 Application.application.preloader 但它显示为空。
所以我想我的问题实际上是如何从应用程序中的任何位置访问预加载器。 更好的方法是将所有安装类作为我的预加载器类的成员吗?
Below is the overriden on complete function for a preloader in Flex.
private function initComplete(e:Event):void
{
//dispatchEvent(new Event(Event.COMPLETE));
cp.status.text="Configuring... Please Wait";
}
What I want to do is when the app has finsihed loading I want to change the preloaders text to "configuring".
Then I want to go and do a bunch of setup stuff in my code.
Once I've done all the setup I wanted how can I get the Preloader to dispatch its Event.complete from else where in my code?
I tried Application.application.preloader but it comes up null.
So I guess my question really is how to access a preloader from anywhere in my application.
Would a better approach be to have all setup classes as members of my preloader class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能有帮助的一件事是模型-视图-控制器模式。您的应用程序是否使用 Mate、Swiz 或 Cairngorm 等框架?
例如,如果您使用 Mate,您可以执行以下操作:
详细信息是伪草图,但其想法是使用 Flex 的绑定在发生更改时通知视图组件,并让共享对象维护状态。不确定这是否是您要找的......
One thing that might help is a Model-View-Controller pattern. Are you using a framework for your application like Mate, Swiz, or Cairngorm?
If you were using Mate, for example, you could do something like this:
The details are pseudo-sketched out but the idea is to use Flex's bindings to notify view components when changes have been made, and to have shared objects that maintain state. Not sure if that's what you're looking for...
组件 LifeCycle 按特定顺序执行特定操作,最后的元素是使组件可见。
在我看来,您想将可见设置推迟到 true 来执行其他操作。但是,我想如果您使用 LifeCycle 组件,这将不是问题。
您需要执行什么类型的应用程序初始化操作?
The component LifeCycle does specific stuff in a specific order, and the near final element is to make the component visible.
It sounds to me like you want to defer this setting of visible to true to do other stuff. But, I imaging if you were making use of the component LifeCycle this would be a non-issue.
What sort of app init stuff do you need to do?