Highlighted

Track listener ids in JSFL between external script executions from AS3

Explorer ,
Aug 11, 2019

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 +"')" );

TOPICS
Discussions

Views

314

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Track listener ids in JSFL between external script executions from AS3

Explorer ,
Aug 11, 2019

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 +"')" );

TOPICS
Discussions

Views

315

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 11, 2019 0
Participant ,
Aug 11, 2019

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 +"')" );

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 11, 2019 3
Explorer ,
Aug 12, 2019

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 12, 2019 0