Actionscript - 使 TextArea 组件公开且可访问
我想将 TextArea 组件公开,以便可以从其他框架访问它。
例如,我希望能够说,如果按下此按钮,则将 TextArea 文本更改为“1”并转到框架。
我不知道该怎么做,我尝试过:
frameHome.textArea.text = "1";
更改文本,但它不起作用,所以我认为我有点偏离目标。任何建议将不胜感激!
I want to make a TextArea component public so it can be accessed from other frames.
For example, I want to be able to say that if this button is pressed change the TextArea text to "1" and go to the frame.
I have no idea how to do this, i've tried :
frameHome.textArea.text = "1";
to change the text but it doesn't work so i'm presumming that i'm a little off mark. Any suggestions would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果按钮位于当前未将 TextArea 添加到舞台的框架中,则将无法访问此 TextArea。您可以将 TextArea 添加到与按钮相同的框架上。将可见设置为 false,并在按钮按下事件侦听器中将文本和可见设置为 true。然后转到所需的帧。
If the button is in a frame where the TextArea is not currently added to the Stage, there will be no way to access this TextArea. You can add the TextArea on the same frame as the button. Set visible to false and in the button pressed event listener set the text and visible to true. then go to the desired frame.