function defined in compositionReady


hi all,

 

coming as3, there clear evidence not understand scopes in javascript.

 

i wanted factorize code in function defined in document.compositionready :

 

function labelsections( emover)

{

  var elem, evt = emover ? emover : event;

  if (evt.srcelement)  elem = evt.srcelement;

  else if (evt.target) elem = evt.target;

  return elem.getattribute("id").substr(18,4); // full id : stage_sections__8_contact

};

 

the function called in different mouseover event handlers attached elements inside symbol sections. example _8_contact.mouseover :

 

// update  symbol sections

sym.stop( labelsections( e));

// update stage

sym.getparentsymbol().stop("contact");

 

how make function accessible inside symbol ? thanks.

 

gil

hi, gil-


if take @ full code mode in code panel, can see what's going on.  stage symbol itself, means lies parallel other symbols. symbol definitions not held within stage.  there couple of things can do:

 

  • define function in stage scope , access them way: sym.getparentsymbol().functionname()... in case want pass in sym object you're working on
  • define function outside stage symbol within edge composition closure.
  • define function in stage scope , attach variable stage, can retrieve variable , have access function.

 

hope helps clarify things bit.

 

-elaine



More discussions in Edge Animate CC


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account