Be a Supporter!

flex 4 changing image source

  • 669 Views
  • 0 Replies
New Topic Respond to this Topic
Tygerman
Tygerman
  • Member since: Aug. 16, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
flex 4 changing image source 2010-11-16 16:44:59 Reply

I'm creating a website with flex and here is what I want to have happen:

When I roll over a certain image the source should change to a new image I have on file. This works but I also want it changing back to the original image when I roll out, the code for all of this is:

//actionscript
protected function NavHome_rollOverHandler(event:MouseEvent ):void
{
NavHome.source = "NavHomeTextRollover.png";
}

protected function NavHome_rollOutHandler(event:MouseEvent)
:void
{
NavHome.source = "NavHomeText.png";
}

//mxml
<mx:Image x="222" y="240" source="NavHomeText.png" id="NavHome" rollOver="NavHome_rollOverHandler(event)
" rollOut="NavHome_rollOutHandler(event)"/
>

this causes the image to blink very rapidly until I take the mouse away.

The problem, I think, is that when it changes the source image into the Rollover version the image disappears for a moment and the program thinks I have rolled out and puts the original image back which is told to change when rolled over and it repeats that ad infinitum.

If that is in fact the problem I don't know how to fix it. I'm somewhat new at mxml coding but am very experienced with actionscript


BBS Signature