why eventMap can auto remove

chenchang1209's Avatar


27 Jan, 2010 12:47 PM

i'm upload my program code, an easy program code. i can't understand than the eventMap can auto remove.my code some time can run . some time can't run.i'm use flashdevelop 3.0.6 and robotlegs 1.0.2.

  1. Support Staff 1 Posted by Shaun Smith on 27 Jan, 2010 01:09 PM

    Shaun Smith's Avatar

    You MUST hold on to the context object that you create in main:

    // In your Main class definition
    protected var context:MainContext;
    // and then later:
    context = new MainContext(this);

    If there is nothing holding on to the context object, then it will be released by the Garbage Collector when the Flash Player needs more memory - that is probably why things are not working as expected.

  2. 2 Posted by chenchang1209 on 27 Jan, 2010 01:36 PM

    chenchang1209's Avatar

    Oh my god .thanks for your help. I remember it. in My Main , first protected var context:MainContext and than context = new MainContext(this) that hold on to the context object thank you.thank you.

  3. Support Staff 3 Posted by Shaun Smith on 27 Jan, 2010 01:40 PM

    Shaun Smith's Avatar

    No problem, I hope that helps :)

  4. Stray closed this discussion on 13 Feb, 2011 07:07 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac