Not sure even how to describe this problem...

I have a room layout app with three states: 

Draw Walls -- lets the user modify walls but not objects in the room
Add Units -- lets the user add objects to the room, but not the walls
Review -- view only, no interactivity

Each state has a view class, and each one wraps the same Room view
class. The Room displays the walls and objects, and the other views
add different functionality and controls to the room.

The views are added and removed by the framework. I have a Main.mxml
file that defines the three states as <mx:States>.

It used to be all one view, but ever since I split it out into the
different states, it's been fubar. I think my views aren't being
removed correctly--when I switch from one view to another, the first
view's updateDisplayList is still firing after I switch to the second.
I created a method for my view classes called onRemove() that
unregisters all the event listeners when the component's Event.REMOVED
fires, but the even with this, the views are not being removed or
garbage collected completely.

How do I ensure that a component is completely removed when I switch
to a new state?

Thanks as always for your help,

OK
DAH

Reply via email to