Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

Binding events to nested symbols from an Array

$
0
0

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


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>