use mouseOver and mouseOut instead

----- Original Message ----
From: Yochikoh Haruomi <[EMAIL PROTECTED]>
To: [email protected]
Sent: Saturday, January 26, 2008 1:04:20 PM
Subject: [flexcoders] how to swap backgroundImage when rollover it?

Hi list,

I have a vBox container with a backgroundImage
(bg1.jpg). When rollover the backgroundImage ,I want
to display another backgroundImage (bg2.jpg) at the
same position ( swap).

The below code doesn't work properly . When I
rollout, the background2 (sometimes) shows and when I
rollover back it, background1 doesn't show .

What is the right way to do this? I'm newbie.
Thanks!
yoko

<?xml version="1.0" encoding="utf- 8"?>
<mx:Application
xmlns:mx="http://www.adobe. com/2006/ mxml"
layout="absolute" >
<mx:Script>
<![CDATA[
[Bindable]
private var bgSrc:String= "assets/bg1. jpg";

private function onItemRollOver( ):void{
bgSrc="assets/ bg2.jpg";
}
private function onItemRollOut( ):void{
bgSrc="assets/ bg1.jpg";
} 

]]>
</mx:Script>



<mx:VBox id="myVbox" x="0" y="0" width="100"
height="100" paddingTop=" 20" horizontalAlign= "center"
rollOver="onItemRol lOver();"
rollOut="onItemRoll Out();" backgroundImage= "{bgSrc}" >
<mx:Image id="myThumb" source="assets/ thumbnail. jpg"
/>
<mx:Text id="myText" text="product1" /> 
</mx:VBox>


</mx:Application>

____________ _________ _________ _________ _________ _________ _
Looking for last minute shopping deals? 
Find them fast with Yahoo! Search. http://tools. search.yahoo. com/newsearch/ 
category. php?category= shopping





      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Reply via email to