5 Replies Latest reply on May 6, 2010 12:54 PM by todoSolo

    Weird blinking on rollover? Totally stumped.

    todoSolo

      Hi folks,

       

      I've got a mysterious problem popping up.

       

      -- I've got 20 instances of the same button.

      -- On rollover, it pulls up a little info box calling text and photo.

      -- The buttons are all in an array; I used a for loop to add listeners to everything.

      -- In other words, all of the buttons are programmed identically.

       

      For TWO of the buttons, the rollover freaks out and blinks over and over. I ran a trace statement on it, and it seems to be reading the rollover again and again and again, tracing over and over again as long as I'm there, making the box to blink. In my troubleshooting, I tried to load the SAME photo so that everything would remain identical. Still, the blinking.

       

      What gives? Any ideas? I've been wrestling with this for many hours with no ideas left.

       

      Thanks!

      -Emily

       

      Here's the relevant code:

       

       

      for(var i:uint = 0; i < buttons.length; i++)

      {

      buttons[i].addEventListener(MouseEvent.MOUSE_OVER, displayOn);

      buttons[i].addEventListener(MouseEvent.MOUSE_OUT, displayOff);

      }

       

      function displayOn(event:MouseEvent):void

      {

      event.target.removeEventListener(MouseEvent.MOUSE_OVER, displayOn);

      box_mc.details_txt.text = (names[buttons.indexOf(event.target)]);

      thumbLoader.load(new URLRequest("photo.jpg"));

      }

       

      function displayOff(event:MouseEvent):void

      {

      event.target.addEventListener(MouseEvent.MOUSE_OVER, displayOn);

      stage.removeChild(box_mc);

      }

       

      var thumbLoader:Loader = new Loader;

      thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadThumb);

       

      function loadThumb(event:Event):void

      {

      box_mc.thumb_mc.addChild(thumbLoader);

      }