Weakreference + Robotlegs

| Comments

yesterday i was wondering why i just couldn’t get the eventMap.mapListener to work as expected.

in my mediator class i have the next code:

override public function onRegister():void  {
    eventMap.mapListener(view, CustomEvent.CLICK, onClick);
}

the onClick handler never happens… (using Flash CS4) but if i change that line to this:

view.addEventListener(CustomEvent.CLICK, onClick)

it works!

it also works with:

eventMap.mapListener(view, CustomEvent.CLICK, onClick ,CustomEvent,false,0,false);

after two hours of digging in, downgrading Robotlegs version, downgrading Flash IDE version, changing from PC to MAC, i just realized that i needed to ask to google san. (yeah!! after two hours i just realized that!, can you believe it??)

made the next search: ”Weakreference + Robotlegs

google’s response: 0.37 segs google’s first result

my fix was, changing this:

public class Main extends MovieClip {
    public function Main() {

        var context:MainContext = new MainContext(this,false);
        context.startup();

    }   
}

for this:

public class Main extends MovieClip {
    private var context:MainContext;

    public function Main() {

        context = new MainContext(this,false);
        context.startup();

    }   
}

the GC was only doing his duty! man, if i would have asked to google before, it would have saved two hours of my lifetime!.

Comments