Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7168313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:45:20+00:00 2026-05-28T14:45:20+00:00

I am working in on a Flex / Air application (using PureMVC) written virtually

  • 0

I am working in on a Flex / Air application (using PureMVC) written virtually entirely in ActionScript 3 (i.e. we use very little of Flex). View components are added to a Canvas object in the main application window and these Views then load other movie clips, images files, etc.

When I remove a View from the stage, I do so using application.canvas.removeChild(...). This fires an event in my PureMVC mediator for that View, which removes any event listeners that were set up and everything appears to be dandy.

However, the movie clips are still playing in the background. They are not causing any trouble on screen … but they are simply there, playing somewhere in memory (e.g. I can see trace statements from them) and I want them gone. I suspect the View that was removed from the Canvas is still there too, but I can’t prove it.

Setting the View to null doesn’t do anything. I’m surprised that AS3 doesn’t include any method to simply and effectively destroy a Display Object and all of its children.

Is the only way to do this to tediously unload all of the movie clips, etc. and then hope that Flash will clean them up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:45:20+00:00Added an answer on May 28, 2026 at 2:45 pm

    AS3 is a garbage-collected language, so there is no explicit command to remove objects from memory. However, the AS3 VM does do reference counting, so if you remove a display object from the stage and remove all references to that object, the object will get destroyed immediately or very soon after, so you will no longer see trace statements from it, etc.

    If you have removed all the apparent references to the object but it doesn’t get collected, the problem is probably circular references. For example parent and child objects reference each other, so the above handling will not know to remove them unless you unchild everything. In these cases the objects will not get removed from memory until a garbage collection (i.e. mark-sweep) occurs. (GCs are relatively slow so the player internals optimize when they occur based on how much memory is available and other factors.)

    Incidentally, all of the above is true of all objects, regardless of whether they are display objects or Flex Views or NetStreams or whatever. For further information, here’s a good overview of the AS3 GC – it’s old but still correct.

    But what you should understand about all this as a programmer is that in nearly all cases, you shouldn’t need to worry about this. Remove all your references to objects (and stop() them if they’re playing), and let the (heavily optimized) internal GC decide when they actually disappear. If memory gets scarce then the GC will act, and if it doesn’t then any additional memory management would simply be premature optimization.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an AIR application using Flex. In it I use a file
I am working on a full screen kiosk application in Flex 4/Air 2 using
I'm working on a pretty big application for Flex/Air. We are using GraniteDS and
I am working with Flash Builder 4.5 using Adobe Air, Flex and Actionscript 3,
I'm working on a simple flex / AIR application with just a mx.TextInput control
I'm warming up w/ AS3 robotlegs framework. I'm working on a FLEX 4/AIR Application
I'm working with flex, but actionscript ideas are just as good. The flex <s:Application>
Currently I am working on flex application where I am using multicore variant of
Currently working on a flex AIR project based on PureMVC framework. There was a
I am working with the Pingdom API in a Flex 4 AIR Application, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.