Results 1 to 3 of 3

Thread: Simple loop/colorTransform question

Hybrid View

  1. #1

    Simple 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;
      }
     }
    }

  2. #2
    Ok, 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");
      }
     }
    }

  3. #3
    Figured that out.

    On the MouseEvent I traced...

    trace(e.target.name);

    Now how would I trace myArray[i][2] on the Mouse Over?

    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012