如何在不刷新 html 页面或重新加载 SWF 文件的情况下重置/重新加载 Flex 应用程序?
我有一个带有主页按钮的 Flex 应用程序。单击此按钮时我需要重置应用程序。我无法使用 navigatorToURL 或ExternalInterface.call("window.location.reload");因为重新加载 swf 文件是不可接受的。还有其他方法可以实现这一目标吗?非常感谢任何有关此问题的帮助。
I have a flex application that has a home button. I need to reset the application when this button is clicked. I can't use navigateToURL or ExternalInterface.call("window.location.reload"); as its not acceptable to reload the swf file. Is the any other way to achieve this? Any help regarding this is much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
无法从应用程序本身重新加载 Flex 应用程序。
您可以调用将重新加载页面的 JavaScript 函数。
看看这个:http://livedocs.adobe .com/flex/3/html/help.html?content=passingarguments_4.html
there's no way to reload a flex application from the application itself.
You could call a javascript function that will reload the page.
Have a look at this: http://livedocs.adobe.com/flex/3/html/help.html?content=passingarguments_4.html
Flex中有状态的概念。
您需要做的是,保留两种状态,一种是初始阶段(即 swf 加载时的状态),另一种是用户正在与之交互的状态。
假设你有两种状态:
stat1,stat2
每当主页上有点击时,您应该执行以下操作:
1.将用户带到stat2。
2.克隆stat2并将引用复制到stat1以供下次使用。
3.下次点击主页时执行相反的操作。
问候
尼拉吉
There is this concept of states in Flex.
What you would need to do is, keep two states, one at the initial stage(which is the state when the swf loads), and the other with which the user is interacting.
So lets say you have two states:
stat1,stat2
And whenever there is a click on home page, you should do the following:
1.take user to stat2.
2.Clone stat2 and copy the reference to stat1 for usage next time.
3.do the reverse the next time there is a click on home page.
Regards
Neeraj
您可以将大部分 Flex 应用程序作为模块。在初始化或其他操作时加载模块。要引用,请卸载/重新加载模块。这基本上是指该应用程序
You could have the bulk of your flex app as a Module. Load the module on initialize or whatever. To refersh, unload/reload the module. That would basically refersh the app
您必须使用 JavaScript 函数来重新加载 swf 文件,并在 url 中添加参数,否则它将从缓存中重新加载 swf。 (http://abc.com/myswffile.swf?reload=12345)。 12345 - 这是一个随机数。
You would have to use a javascript function that will reload the swf file with addition parameter in the url or else it will reload the swf from cache. (http://abc.com/myswffile.swf?reload=12345). 12345 - this would a random number.
我认为,您的情况需要状态管理,我是一名 Flex 开发人员,所以我每天都会在每次点击时重置屏幕(屏幕上的空间总是更少),
您是否想隐藏一些屏幕组件,当您单击屏幕上的某个按钮(在swf中),然后您可以使它们visible = false并且还包括InLayout = false,这也会将它们从内存中删除,
这里我有两种状态,登录和注册,所以当您单击注册按钮,然后你的 rpass 文件就会显示出来,反之亦然,所以你可以制作这样的屏幕。flex3
中的状态模型很简单,如果你在 flex4 中,那么它就更漂亮了,
希望这对
Ankur有帮助
i think , your situation is asking for state management, see i am a flex developer, so i m resetting the screen on every click n everyday(space on the screen is always less),
Do you want to hide some of screen component's, when you click some buttonn on the screen (in swf), then you can make them visible=false and also includeInLayout=false, this will remove them from the memory as well,
Here i have two states, login and register, so when you click on register button, then your rpass filed gets displayed and vice versa, so you could make screen like this..
State model in flex3 is easy and if you are in flex4, then it's even more beautiful there,
hope this helps
Ankur