Hello
I have some troubles firing and removing events in the right chronicle order. The code below gives the following output:
save poster into db, and dispatch event
calling service, dispatch event removed = false
calling service, dispatch event removed = false
calling service, dispatch event removed = true
save poster into db, and dispatch event
save poster into db, and dispatch event
of course this should be more something like:
save poster into db, and dispatch event
calling service, dispatch event removed = true
save poster into db, and dispatch event
calling service, dispatch event removed = true
save poster into db, and dispatch event
calling service, dispatch event removed = true
Can someone help me with this? I'm running out of ideas on how to tackle this.
thx!
for(var i:int = 0;i< 3;i++){
createPoster();
}
function createPoster(){
Main.db.savePoster();
Main.db.addEventListener(Config.evt_SAVEPOSTER_READY, callService);
}
function callService(){
Main.db.removeEventListener(Config.evt_SAVEPOSTER_READY, callService);
}