Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Using the removeChild method

From: ActionScript 3.0 in Flash CS3 Professional Beyond the Basics

Video: Using the removeChild method

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.

Using the removeChild method

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.

Show transcript

This video is part of

Expand all | Collapse all
  1. 7m 53s
    1. Welcome
      2m 24s
    2. How to use the exercise files
      1m 11s
    3. Reviewing ActionScript 3.0 basics
      4m 18s
  2. 35m 12s
    1. Understanding the Display List
      1m 59s
    2. Using Display Objects other than MovieClip
      3m 19s
    3. Using the addChild method
      2m 27s
    4. Using the removeChild method
      1m 25s
    5. Referencing a Display Object by index number
      4m 53s
    6. Referencing a Display Object by name
      4m 1s
    7. Controlling Display Objects in different timelines
      3m 23s
    8. Controlling Display Objects in different movies
      3m 43s
    9. Using addChild to change parents
      4m 20s
    10. Understanding Stage vs. stage
      5m 42s
  3. 30m 3s
    1. Why use ActionScript to animate?
      1m 25s
    2. Understanding the Tween class
      4m 3s
    3. Using different easing methods
      4m 5s
    4. Understanding Tween Class methods
      3m 44s
    5. Responding to tween events
      2m 33s
    6. Using tweens to move a dynamic map
      6m 1s
    7. Making the map respond to tween events
      8m 12s
  4. 31m 2s
    1. Introduction to XML data
      2m 17s
    2. Understanding E4X syntax
      2m 5s
    3. Creating raw XML data
      4m 9s
    4. Loading external XML data
      2m 32s
    5. Using the XMLList class
      4m 6s
    6. Using XML data to load external images
      3m 21s
    7. Using XML data to create an image gallery
      5m 6s
    8. Displaying text from an XML file in your gallery
      5m 5s
    9. Adding tweens to your gallery
      2m 21s
  5. 39m 18s
    1. Reviewing packages and classes
      1m 7s
    2. Creating a template for class files
      3m 38s
    3. Defining a reusable class path
      1m 29s
    4. Creating a DisablingButton class from a template
      5m 34s
    5. Connecting classes to movie clips
      3m 15s
    6. Communicating between classes
      10m 20s
    7. Creating a ScaleButton class
      8m 29s
    8. Reusing a ScaleButton class
      5m 26s
  6. 26m 10s
    1. Preparing to build an advanced image gallery
      4m 13s
    2. Dividing the thumbnail into segments
      2m 2s
    3. Adding interactivity to thumbnails
      4m 36s
    4. Loading full-sized pictures
      3m 58s
    5. Creating an Image Gallery class
      11m 21s
  7. 29m 9s
    1. Understanding particle systems
      58s
    2. Creating particles
      2m 51s
    3. Animating particles
      1m 20s
    4. Randomizing particles
      3m 42s
    5. Setting a particle range
      3m 22s
    6. Defining a dynamic range
      1m 54s
    7. Controlling particle alpha and scale
      2m 23s
    8. Varying particle speed
      6m 55s
    9. Removing children to optimize performance
      2m 51s
    10. Using different particles
      2m 53s
  8. 22m 34s
    1. Understanding transitions
      1m 41s
    2. Understanding the Object class
      2m 58s
    3. Placing transition information in an object
      2m 21s
    4. Creating transition animations
      2m 13s
    5. Creating different types of transitions
      3m 28s
    6. Using undocumented transition events
      4m 4s
    7. Using transitions in an image gallery
      5m 49s
  9. 26m 11s
    1. Reviewing Flash video basics
      2m 32s
    2. Creating a resizable interface
      3m 53s
    3. Understanding cue points
      1m 58s
    4. Using XML for closed captioning
      2m 34s
    5. Connecting closed captioning to cue points
      3m 55s
    6. Creating an advanced navigation interface
      3m 4s
    7. Creating an AdvancedVideo class
      8m 15s
  10. 24s
    1. Closing remarks
      24s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed ActionScript 3.0 in Flash CS3 Professional Beyond the Basics.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.