Flash AS2:在手风琴中访问标题影片剪辑
我想使用手风琴组件使用 flash cs3 创建一个列表(用户单击一行,该行展开)。标题的图标是一个影片剪辑“My_icon”:
var oAccordion_1:Object = oAccordion.createChild("Datasheet", "Icon", {icon:"My_icon"});
影片剪辑“My_icon”包含一个实例名称为“lblHead”的动态文本字段。 不,我想像这样更改文本字段的文本:
oAccordion_1.icon.lblHead.text = "mytext";
但是trace(oAccordion_1.icon.lblHead)给出未定义。然而trace(oAccordion_1.icon)给了我“My_icon”。
知道如何访问标头 mc 内的 lblHead 吗?
谢谢。
顺便提一句。我知道手风琴本身有一个标签,但我想要的不仅仅是标题中的标签。
I want to create a list with flash cs3 using the accordion component (the user clicks on a row, and the row expands). The icon of the header is a movieclip "My_icon":
var oAccordion_1:Object = oAccordion.createChild("Datasheet", "Icon", {icon:"My_icon"});
Movieclip "My_icon" contains a dynamic textfield with the instance name "lblHead".
No I want to change the text of the textfield like this:
oAccordion_1.icon.lblHead.text = "mytext";
But trace(oAccordion_1.icon.lblHead) gives undefined. However trace(oAccordion_1.icon) gives me "My_icon".
Any idea how I can access lblHead inside the header mc?
Thanks.
Btw. I know the accordion has a label itself, but I want to have more than just a label inside my header.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,没有一种干净、简单的方法来动态调整图标内部。手风琴标题只是一个 Button 实例,而 Button 图标逻辑很复杂并且与皮肤支持交织在一起。具体来说,按钮为不同的按钮状态创建了许多图标副本。
但这里有一个技巧:让图标自行改变。在 My_icon MC 的第 1 帧上,输入以下代码:
然后将该参数添加到您的 createChild 调用中:
希望这会有所帮助!
Unfortunately, there's not a clean and easy way to dynamically tweak the icon innards. An accordion header is just a Button instance, and the Button icon logic is complex and intertwined with the skinning support. Specifically, the Button creates many copies of the icon for the different button states.
But here's a trick: Have the icon change itself. On frame 1 of the My_icon MC, put this code:
Then add that parameter to your createChild call:
Hope this helps!