我想从movieclip“B”中控制movieclip“A”组件。
movieclip A:
function click1(event:MouseEvent):void
{
// I want to change text of button which is inside movieclip "B" in here.
}
btn1.addEventListener(MouseEvent.CLICK , click1);
movieclip B:
function click2(event:MouseEvent):void
{
//and here I want to change text of button which is inside movieclip "A".
}
btn2.addEventListener(MouseEvent.CLICK , click2);
我该怎么做?
抱歉我的英语。答案 0 :(得分:3)
假设两个动画片段(mca
和mcb
)已添加到stage
- stage
是两者的父级 - 这很简单为:
function click1(event:MouseEvent):void
{
// I want to change text of button which is inside movieclip "B" in here.
stage.mca.someButtonObject.label = "some new button text";
}
function click2(event:MouseEvent):void
{
//and here I want to change text of button which is inside movieclip "A".
stage.mcb.someTextboxObject.text = "some new text";
}
稍微测试一下这段代码,如果这不起作用,请告诉我(如果失败,请发贴你的代码)。