Copy link to clipboard
Copied
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.
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 +"')" );
Copy link to clipboard
Copied
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 +"')" );
Copy link to clipboard
Copied
Fantastic, yes that works across our test cases. Many thanks Vladin for taking the time to answer.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now