actionscript 3 - Evaluate where a function call originated from -


okay have function called changehandler - called several eventlisteners in other functions. want write several if statements evaluate source of function call , change dataprovider of combobox depending on originating function. example: 1 of many functions called displaycarbs() , has eventlistener so:

function displaycarbs(event:mouseevent):void { mycombobox.addeventlistener(event.change, changehandler); } 

(i've removed of unnecessary code function above)

the if statement inside changehandler this:

if (****referring function = displaycarbs****) {     mycombobox2.dataprovider = new dataprovider(carbitems);     } 

i've searched high , low can achieve this, don't have enough grasp of as3 or vocabulary describe describe mean answer google.

the simplest way can think of... couldn't create text string updates name of function before going changehandler in turn changehandler can check string content , act accordingly..

public var referring_function:string;  function displaycarbs(event:mouseevent):void  {   referring_function = "displaycarbs";   mycombobox.addeventlistener(event.change, changehandler); }  function displaycarbs(event:event):void  {   if (referring_function == "displaycarbs")    { mycombobox2.dataprovider = new dataprovider(carbitems); }   if (referring_function == "displayothers")    { mycombobox2.dataprovider = new dataprovider(otheritems); }   // etc etc } 

i cant remember right if need == or = when checking if statement against strings.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -