gotoAndPlay problem when loading movieclip with AS3

I have two movieclip (story_screen and title_screen)  instances I am trying to load and play.  the "title_screen" is added to the stage second so it is visible first.  THe "title_screen" has a start_mybutton object that when you click it it calls the event handler and calls the frame labeled "start_alpha" which fades the alpha.  There is a "stop();" command in the last frame that should stop the movie clip once it reaches this frame, and then the "title_screen should be removed from the screen.  However, what is happening is that the "title_screen" displays, but does not fade on button click.  "title_screen" is removed and the "story_screen" displays but the  "title_screen" displays again.  Below is the code in my .fla file, can anyone provide any assistance?

var story_screen:MovieClip = new storyscreen();
var title_screen:MovieClip = new titlescreen();
addChild(story_screen);
addChild(title_screen);
title_screen.start_mybutton.addEventListener(MouseEvent.MOUSE_DOWN,startHandler);
function startHandler(event:MouseEvent):void {
      trace("In startHandler ");
      title_screen.gotoAndPlay("start_alpha");
      removeChild(title_screen);
}
tflockAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

blue-genieCommented:
how can the title_screen gotoAnd do anything if you're removing it?

what you should maybe consider doing, if i understand correctly is use a Tween Class to change the alpha , and then use the onComplete to remove the clip.

ie. start fading out, when you're done go away.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tflockAuthor Commented:
Hi blue-genie,
Thanks for the direction.  I am now using the Tweenlite class to change the alpha and onComplete, I call a method to remove the movieclip.  This method seems to work for removing the title_screen movieclip initially, but if I click the ready button on the story_screen the title_screen movieclip reappears.  If I click the start button on this clip I receive the error below.  I would think that once I've removed the movieclip it would not be on the stage.  I am trying to remove the top two movie clips to get to a third clip underneath them.  Please note my updated code is below as well.  Any assistance you can provide would be appreciated.

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
      at flash.display::DisplayObjectContainer/removeChild()
      at Protoype_fla::MainTimeline/removeMovie()
      at Protoype_fla::MainTimeline/startHandler()

import com.greensock.TweenLite;

var story_screen:MovieClip = new storyscreen();
var title_screen:MovieClip = new Titlescreen();

addChild(story_screen);
addChild(title_screen);

title_screen.start_btn.addEventListener(MouseEvent.MOUSE_DOWN,startHandler);
story_screen.ready_btn.addEventListener(MouseEvent.MOUSE_DOWN,readyHandler);

function startHandler(event:MouseEvent):void {
      TweenLite.to(title_screen, 0.5, {alpha:0, onComplete:removeMovie(title_screen)});
      title_screen.start_btn.removeEventListener(MouseEvent.MOUSE_DOWN,startHandler);
}
function readyHandler(event:MouseEvent):void {
      TweenLite.to(story_screen, 0.5, {alpha:0, onComplete:removeMovie(story_screen)});
      story_screen.ready_btn.removeEventListener(MouseEvent.MOUSE_DOWN,readyHandler);
}
function removeMovie(movieObject:MovieClip):void{
      if (movieObject!=null)
      {
            removeChild(movieObject);
            trace("REMOVE movie executed");
      }
}

0
blue-genieCommented:
Can you upload your file?
it's a tad bit difficult to make out whats happening without seeing it.

is this code snippet above just in a frame?
are you jumping around in frames. I cant' imagine that the title will reappear unless you're doing a gotoAndStop(1) to reisntantiate this frame.

blu.
0
tflockAuthor Commented:
I was able to get it working with direction for blue-genie and another post.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.