Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In the last movie you learned how to put a visual element on the stage. In this movie you'll learn how to take a visual element off of the stage using something called removeChild. If you're following along, I am in Remove _Child.fla and that's in the Chapter 1 folder within the Exercise Files. Let's take a look at how this file is setup. We have the Button layer and the actions layer and you can probably guess what's on the Button layer. That's the button. Let's see what's in the actions layer. Select the first keyframe of the actions layer and open up the Actions panel by pressing Option+F9 on the Mac or F9 on the PC. Lines 1 and 2 are that code that you wrote in the last movie and then we have an event listener added to remove button and then a skeleton of the removeBoard function is going to run when you click on the remove button.
So the board's already is on the stage. All we need to do is take it off when you click this button and you can probably guess how that would work. If you use addChild to add the board as a child, we would use removeChild to remove the board as a child. That's exactly how it works. So just type inside of that function, removeChild with capital C, open parenthesis, board, closed parenthesis. That's really all there is to it. So let's just test the movie by pressing Command+Return on the Mac or Ctrl+Enter on the PC and you can see that the board is on the stage, and when we click the Remove button, we use removeChild to take the board off the stage. It's fairly simple, huh? Well there is a look at how to use removeChild.
In the next few movies, we'll take a look at how to reference children in different ways.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 102042 Viewers
61 Video lessons · 88764 Viewers
71 Video lessons · 72577 Viewers
56 Video lessons · 104221 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.