Reputation: 1035
I want to control movieclip "A" components from movieclip "B".
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);
how can I do this?
sorry for my English.
Upvotes: 1
Views: 155
Reputation: 2649
Making the assumption that both movieclips (mca
and mcb
) have been added to the stage
-- stage
is the parent of both -- it is as simple as:
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";
}
Test this code out a bit, and let me know if that doesn't work (and please post your code if it fails).
Upvotes: 3