0 Replies Latest reply on Oct 16, 2007 12:21 PM by victorsp

    Problem with change of backgroundImage

    victorsp
      Hi,
      i'm new in Flex and i'm having a problem changing the backgroundImage property of a component.
      I create a component (Canvas) that changes it's backgroundImage on mouseOver and mouseOut events.
      The problem is that if i make a fast move with the mouse through the component, the backgroundImage doesn't disapear. It shows the image of the mouseOver event, but the image doesn't disapear when the mouseOut event set the other backgroundImage. We can see that the backgroundImage of the mouseOut event has been showed behind the mouseOver image, but the backgroundImage of the mouseOver event, hasn't been hidden.
      It doesn't happen only with the mouseOver image, it happens with the mouseOut image too. It also happens with the both image at the same time if i keep moving the mouse over and out the component.
      I did a lot of tests and noticed that it happens only with the backgroundImage property. If i change any other property of the component, it works fine in any mouse speed.
      I really don't know what to do.
      The code is very simple:
      -------------------------------------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas
      backgroundImage="imagens/background_etiqueta.png"
      width="300"
      height="140"
      mouseOver="{mouseOverHandler(event)}"
      mouseOut="{mouseOutHandler(event)}"
      >

      <mx:Script>
      <![CDATA[
      private function mouseOverHandler(event:MouseEvent):void
      {
      this.setStyle("backgroundImage", "imagens/background_etiqueta_selecionada.png");
      }

      private function mouseOutHandler(event:MouseEvent):void
      {
      this.setStyle("backgroundImage", "imagens/background_etiqueta.png");
      }
      ]]>
      </mx:Script>

      </mx:Canvas>
      ----------------------------------------

      Does anyone knows anything about a Flex bug, browser bug or anything else ?
      OR
      Does anyone knows what am i doing wrong ?