1 Reply Latest reply on Mar 22, 2013 7:41 AM by mrsfillyjonk

    The sym parameter in click etc events...

    mrsfillyjonk

      Dear all,

       

      I'm using Edge Animate 1.0 and teaching it to Masters students as part of a module on multimedia development. All works well and Edge is turning out to be an excellent teaching tool. However I'm sure that I'm misunderstanding something fundamental in the way that actions are called. As far as I can tell, if you create a symbol and put it on the stage, then attach a click (or similar) listener to it, the 'sym' parameter for the function called on click, isn't a reference to the symbol that was clicked, its a reference to the stage. After some experimenting and looking at the code in the full code window, the general rule seems to be that 'sym' is the parent symbol of the symbol that an event occurs on (unless the event occurs on the stage, in which case its the stage). However for a trigger 'sym' references the symbol that the trigger is called from.

       

      This is different to all other event driven systems I've used where an event function is (somehow) parameterised by the thing that generates the event, not the parent of it.

       

      I haven't marked this discussion as a question, because I know how to get around this by specifically naming the instance and then using getSymbol to reference it, but I think this is an uneccessarily messy way of doing things (and its very brittle; if you rename your instances, then their event listeners will break). My question/point is; is my understanding of 'sym' correct? And if so, what's the justification for it? From looking at the generated code it seems perfectly straightforward to parameterise the event function with the symbol, not its parent.

       

       

      Best

      Richard B