Я создаю сценарий действия для имитации трех состояний кнопок и соответственно загружаю фрагменты роликов.
Я получаю эту ошибку
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at Untitled_fla::MainTimeline/sack_btnMouseOut()
При попытке сделать это
//get the objects
var addSackStill:sack_still = new sack_still();
var addSackHover:sack_hover = new sack_hover();
var addSackClick:sack_click = new sack_click();
//add the still object to the stage
addChild(addSackStill);
var SACK_X = 570.55;
var SACK_Y = 603.95;
addSackStill.x = SACK_X;
addSackStill.y = SACK_Y;
addSackHover.x = SACK_X;
addSackHover.y = SACK_Y;
addSackClick.x = SACK_X;
addSackClick.y = SACK_Y;
//create the event listeners
addSackStill.addEventListener(MouseEvent.MOUSE_OVER, sack_btnMouseOver);
addSackHover.addEventListener(MouseEvent.MOUSE_OUT, sack_btnMouseOut);
addSackHover.addEventListener(MouseEvent.CLICK, sack_btnClick);
//here are the functions for mouse over, mouse off, and click
function sack_btnMouseOver(event:MouseEvent):void {
trace("mouse over");
removeChild(addSackStill); //remove the movie clip
addChild(addSackHover); //add sackclick to the stage
}
function sack_btnMouseOut(event:MouseEvent):void {
trace("mouse out");
removeChild(addSackHover); //remove the movie clip
addChild(addSackStill); //add sackclick to the stage
}
function sack_btnClick(event:MouseEvent):void {
trace("Click");
removeChild(addSackHover); //remove the movie clip
addChild(addSackStill); //add sackclick to the stage
}
Я что-то не так делаю?