• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Track listener ids in JSFL between external script executions from AS3

Explorer ,
Aug 11, 2019 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.

Views

496

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
community guidelines

correct answers 1 Correct answer

Engaged , Aug 11, 2019 Aug 11, 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 +"')" );

Votes

Translate

Translate
Engaged ,
Aug 11, 2019 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

Votes

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
community guidelines
Explorer ,
Aug 12, 2019 Aug 12, 2019

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines