如何使flex中的两个变量始终相同?
private var nsPlay : NetStream = main.media.nsPlay;
当 nsPlay
更改时,main.media.nsPlay 应相应更改;反之亦然。
如何实现这一目标?
private var nsPlay : NetStream = main.media.nsPlay;
When nsPlay
changes,main.media.nsPlay
should change accordingly;vice versa.
How to achieve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过制作 nsPlay 和 main.media.nsPlay 公共变量?这可能仍然行不通,但值得一试。我对变量赋值的理解表明它应该像你所做的那样工作。
或者,如果它们引用内存中的同一个对象,为什么不将它们作为 main.media 和 this 都引用的单独类中的单个公共变量(或 getter/setter)保存?
Have you tried making nsPlay and main.media.nsPlay public variables? This may still not work, but it's worth a try. My understanding of variable assignment suggests that it should work as you've done it.
Alternatively if they are referring to the same object in memory, why not hold them as a single public variable (or getter/setter) in a seperate class, which both main.media and this one refer to?
您可以对这两个变量进行可绑定,并分配一个等于另一个。然后,如果其中任何一个发生变化,另一个也会相应地发生变化。
You can sent bindable on both the variables and assign one equals the other. Then if any one changes, the other changes, accordingly.