Copy link to clipboard
Copied
Hello,
I have been going crazy trying to make my little flash site to work. I have used the removeChild script to remove movieclips on the stage when you click a button. When I test it the first button clicked loads the appropriate movieclip and unloads any movie that was playing (in this case it is the home content) but then none of the other buttons work after including the first button that previously worked. Its like the removechild removes it completely. My script is below and any help woul;d be so very much appreciated:
b1.addEventListener(MouseEvent.CLICK, playhomebutton);
function playhomebutton(e: MouseEvent): void {
homecontent.play();
}
b1.addEventListener(MouseEvent.CLICK, removeGallery1);
function removeGallery1(event:MouseEvent):void{
if (gallery.parent)
gallery.parent.removeChild(gallery);
}
b1.addEventListener(MouseEvent.CLICK, removevideo1);
function removevideo1(event:MouseEvent):void{
if (video.parent)
video.parent.removeChild(video);
}
b1.addEventListener(MouseEvent.CLICK, removematerials1);
function removematerials1(event:MouseEvent):void{
if (materialsmovie.parent)
materialsmovie.parent.removeChild(materialsmovie);
}
b2.addEventListener(MouseEvent.CLICK, playgallerybutton);
function playgallerybutton(e: MouseEvent): void {
gallery.play();
}
b2.addEventListener(MouseEvent.CLICK, removeHome);
function removeHome(event:MouseEvent):void{
if (homecontent.parent)
homecontent.parent.removeChild(homecontent);
}
b2.addEventListener(MouseEvent.CLICK, removevideo2);
function removevideo2(event:MouseEvent):void{
if (video.parent)
video.parent.removeChild(video);
}
b2.addEventListener(MouseEvent.CLICK, removematerials2);
function removematerials2(event:MouseEvent):void{
if (materialsmovie.parent)
materialsmovie.parent.removeChild(materialsmovie);
}
b3.addEventListener(MouseEvent.CLICK, playvideobutton);
function playvideobutton(e: MouseEvent): void {
video.play();
}
b3.addEventListener(MouseEvent.CLICK, removeHome3);
function removeHome3(event:MouseEvent):void{
if (homecontent.parent)
homecontent.parent.removeChild(homecontent);
}
b3.addEventListener(MouseEvent.CLICK, removeGallery3);
function removeGallery3(event:MouseEvent):void{
if (gallery.parent)
gallery.parent.removeChild(gallery);
}
b3.addEventListener(MouseEvent.CLICK, removematerials3);
function removematerials3(event:MouseEvent):void{
if (materialsmovie.parent)
materialsmovie.parent.removeChild(materialsmovie);
}
b5.addEventListener(MouseEvent.CLICK, playmaterialbutton);
function playmaterialbutton(e: MouseEvent): void {
materialsmovie.play();
}
b5.addEventListener(MouseEvent.CLICK, removeHome5);
function removeHome5(event:MouseEvent):void{
if (homecontent.parent)
homecontent.parent.removeChild(homecontent);
}
b5.addEventListener(MouseEvent.CLICK, removeGallery5);
function removeGallery5(event:MouseEvent):void{
if (gallery.parent)
gallery.parent.removeChild(gallery);
}
b5.addEventListener(MouseEvent.CLICK, removevideo5);
function removevideo5(event:MouseEvent):void{
if (video.parent)
video.parent.removeChild(video);
}
here's what you should have: http://www.kglad.com/Files/forums/test5.fla
compare it to what you do have.
Copy link to clipboard
Copied
If you enter into the movieclips 'b1, b2, b3, b4, b5' the time line has the two labels over/out as in the screenshot. Was that not how I was suppose to do it? (the actions are just stop();)
Copy link to clipboard
Copied
that ss looks correct, but i'm not sure you should have 5 buttons. that's new.
and what are those error messages referencing about scenes over and scenes out?
Copy link to clipboard
Copied
Sorry, meant to mention that. I added the fifth button which has the contact information.
I have no idea what the error message is referring to about scenes over and scenes out. Could it be that I need to add a dot syntax because the labels can't be found in the scene but are actually found inside the movieclip?
like (b2.'out') ?
Copy link to clipboard
Copied
no, i already referenced the movieclip button timelines.
when do you see that error message? after clicking one of your buttons?
Copy link to clipboard
Copied
yes, each click generates a new error.
Copy link to clipboard
Copied
here's what you should have: http://www.kglad.com/Files/forums/test5.fla
compare it to what you do have.
Copy link to clipboard
Copied
This is fantastic! I'll work on it hopefully tomorrow.
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
Works! Thanks again for all of your help.
Copy link to clipboard
Copied
you're welcome, again.
did you figure out what was wrong in your file? if so, what was that?
Copy link to clipboard
Copied
No, I didn't figure it out. I just started again and pulled over everything into your file. I have no idea. Just glad it works! Happy Holidays.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more