Results 1 to 3 of 3
Hybrid View
-
March 1st, 2010, 01:42 PM #121Registered User
postsSimple loop/colorTransform question
Hi All,
Simple question here. This function works fine up until it hits the else statement. As soon as I uncomment the line to set the mc's to blue after the else it errors out. The gray works fine as long as the else is commented out. What gives?
Code:function colorStates():void { for (var i:Number = 0; i<myArray.length; i++) { if (myArray[i][2] == "NA") { trace("Gray States"); a.color = (0x999999); this[myArray[i][1]].transform.colorTransform = a; } else { trace("Blue States"); a.color = (0x0062bb); //this[myArray[i][1]].transform.colorTransform = a; } } }
-
March 1st, 2010, 04:22 PM #221Registered User
postsOk, I figured out my first problem. All that works now. Now I've come across another issue. When I try to trace the state on Mouse Over, it comes back as undefined. Can someone please help?
Code:function colorStates():void { var a:ColorTransform = new ColorTransform(); for (var i:Number = 0; i<myArray.length; i++) { this[myArray[i][1]].addEventListener(MouseEvent.MOUSE_OVER, manageMouseOver); this[myArray[i][1]].addEventListener(MouseEvent.MOUSE_OUT, manageMouseOut); this[myArray[i][1]].num = i; if (myArray[i][2] == "NA") { a.color = (0x999999); this[myArray[i][1]].transform.colorTransform = a; } else { a.color = (0x0062bb); this[myArray[i][1]].transform.colorTransform = a; } function manageMouseOver(e:MouseEvent):void { trace("Over"); trace(this[myArray[i][1]]._name); } function manageMouseOut(e:MouseEvent):void { trace("Out"); } } }
-
March 1st, 2010, 05:04 PM #321Registered User
postsFigured that out.
On the MouseEvent I traced...
trace(e.target.name);
Now how would I trace myArray[i][2] on the Mouse Over?
Thanks

Reply With Quote

Bookmarks