The supplied DisplayObject must be a child of the caller.

Does anyone recall what Zevan said about this error in class? I don’t and it’s driving me crazy… I know it is referring to slider_mc.removeChild(food); but I don’t know how to fix it.

“The supplied DisplayObject must be a child of the caller.”

var food:MovieClip = new(theFood);
var wine:MovieClip = new(theWine);
var chefs:MovieClip = new(theChefs);
var fun:MovieClip = new(theFun);

addEventListener(Event.ENTER_FRAME, onLoop);

function onLoop(evt:Event):void {
var clipPos:Number = (Math.round(clip.x));
clip.x-=.5;
if(clipPos == 460) {
slider_mc.addChild(food);
TweenLite.to(slider_mc, 2, {x:300, ease:Bounce.easeOut});
clip.food_mc.play();

} else if (clipPos == 350) {
slider_mc.removeChild(food);
slider_mc.addChild(wine);
clip.wine_mc.play();
TweenLite.to(slider_mc, 2, {x:650, ease:Bounce.easeOut});

}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s