addChild, removeChild problem
Hi,
I'm trying to get two separate swipe galleries to work.
I have one movie clip (home_menu) which contains two buttons (button_1 and button_2).
I want to open each gallery in another movie clip (container_mc) on the main timeline. This is located on the bottom layer because I need other objects to sit above the two galleries.
So when I click on button_1 I want it to load gallery1 and unload gallery2 and vice versa with button 2.
But I'm getting the following error message. I've Googled it and searched forums but I've obviously created another unique problem for myself which is becoming something I'm specialising in it seems:
"Call to a possibly undefined method addChild through a reference with static type flash.display:SimpleButton."
This is how I'm causing that error:
import flash.display.MovieClip;
import flash.display.Sprite;
var gallery1:MovieClip=new gallery_items1;
var gallery2:MovieClip=new gallery_items2;
home_menu.button_1.addEventListener(MouseEvent.CLICK, fl_addGallery1);
function fl_addGallery1(event:MouseEvent):void
{
container_mc.addChild(gallery1);
gallery1.x= 28;
gallery1.y= 45;
container_mc.removeChild(gallery2);
}
home_menu.button_2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_5);
function fl_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void
{
container_mc.addChild(gallery2);
gallery2.x= 28;
gallery2.y= 45;
container_mc.removeChild(gallery1);
}
Any advice truly appreciated.