访问 SWC 中的子元素

发布于 2024-08-21 09:31:01 字数 280 浏览 5 评论 0原文

有谁知道是否可以访问 SWC 中的子元素?我创建了一些 MC,并且在其中一些 MC 内部有一些动态文本字段。我将内容导出到 SWC 并将其加载到我的 Flex 项目中。加载它或访问父元素没有问题,它们显示得很好。但我想访问 MC 中嵌套的文本字段并修改文本。当我调试应用程序时,我可以将文本字段视为子元素。它被输入为文本字段,实例名称与 Flash IDE 中的输入相同,但我无法访问它。当 Flex 编译时,它会抛出一个错误,指出它无法识别该方法。我尝试在时间轴上插入动作脚本,链接外部类,但无法访问任何内容。有谁知道有什么方法可以做到这一点?

Does anyone know if its possible to access children elements in a SWC? I have created some MC's and inside of some of these MC's I have some dynamic textFields. I export the content to a SWC and load it into my Flex project. No problem loading it or accessing the parent elements, they display fine. But I want to access the textfields nestes in the MC's and modify the text. When I debug the app, I can see the textfields as child elements. It's typed as a TextField and the Instance Name is the same as input in the Flash IDE but I cannot access it. When Flex compiles it throws an error saying it doesn't recognize the method. I've tried to insert actionscript on the timeline, linked external classes and nothing can be accessed. Does anyone know of a way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

简美 2024-08-28 09:31:01

很难说,因为你没有显示失败的代码,但我怀疑你正在做:

import myswc.*;

myswc.Symbol1.myTextField.text = "Foo"

而不是

var clip:MovieClip = new myswc.Symbol1();
clip.myTextField.text = "Foo"

It's hard to say since you're not showing your code that fails, but I suspect you're doing:

import myswc.*;

myswc.Symbol1.myTextField.text = "Foo"

instead of

var clip:MovieClip = new myswc.Symbol1();
clip.myTextField.text = "Foo"
深爱成瘾 2024-08-28 09:31:01

我刚刚也遇到了这个问题,我很好奇为什么你建议他不使用实例名称,因为 myTextField 显然是他正在使用的 TextField 的实例名称......

I just bumped into this as well, and am curious as to why you're suggesting he's NOT using the instance name since myTextField is obviously an instance name for the TextField he's using....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文