0 Replies Latest reply on Jul 8, 2013 7:20 AM by builder623

    Binding events to nested symbols from an Array

    builder623 Level 1

      Hello all,

       

           I have a pretty solid foundation in flash and actionscript and am trying to recreate some of my projects in EA.

      I want to bind mouseover, mouseout, and click events to eight nested symbols using a for loop. I am not sure if I have the syntax correct.

      I was experimenting with the following code in compostionReady

       

      var clipArray = new Array("A","B","C","D2","E","F","G","H");

       

      function init() {

                for (var i=0;i<clipArray.length;i++) {

                var tempClip = clipArray[i];

                sym.getSymbol("Model2").$(tempClip).mouseover(function(){

                       sym.getSymbol("Model2").getSymbol(tempClip).stop("start")

                });

                sym.getSymbol("Model2").$(tempClip).mouseout(function(){

                        sym.getSymbol("Model2").getSymbol(tempClip).stop(0)

                });

          }

      }

      init();

       

      The code seems to run but every symbols' rollover only affects the last element of the array. So if I rollover A-G, symbol H with stop at "start". If I change the order in the array, it is always the last symbol affected.

       

      Thanks for any help you can give

       

      Craig