Skip to main content
Inspiring
August 12, 2019
Answered

Track listener ids in JSFL between external script executions from AS3

  • August 12, 2019
  • 1 reply
  • 728 views

An eventListener has been created in a .jsfl script. Is it possible to call removeEventListener from AS3 to remove that listener? As far as I can determine, it's impossible to keep track of (and therefore remove) any listener IDs between MMExecute calls from AS3.

This topic has been closed for replies.
Correct answer Vladin M. Mitov

Hi,

Maybe I don't understand the issue, but what if you use MMExecute() to remove the listener? For example (not tested):

// in jsfl

var eventID;

eventID = fl.addEventListener( "documentClosed", myFunction );

function getListenerID(){

return eventID;

}

function removeListenerByID( id ){

fl.removeEventListener( "documentClosed", parseInt( id ) );

}

//in as3

var id:String = MMExecute( "getListenerID()" );

MMExecute( "removeListenerByID('"+ id +"')" );

1 reply

Vladin M. Mitov
Vladin M. MitovCorrect answer
Inspiring
August 12, 2019

Hi,

Maybe I don't understand the issue, but what if you use MMExecute() to remove the listener? For example (not tested):

// in jsfl

var eventID;

eventID = fl.addEventListener( "documentClosed", myFunction );

function getListenerID(){

return eventID;

}

function removeListenerByID( id ){

fl.removeEventListener( "documentClosed", parseInt( id ) );

}

//in as3

var id:String = MMExecute( "getListenerID()" );

MMExecute( "removeListenerByID('"+ id +"')" );

- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation
Inspiring
August 12, 2019

Fantastic, yes that works across our test cases. Many thanks Vladin for taking the time to answer.