Relax Breath of Solution.Community tech blog of Sameera Thilakasiri - Consultant UI, UX, RWD Specialist/ Interactive Designer

Just I wanted.. Do you?…

Fade effect in Flex

Posted on August 21, 2010 | No Comments

The following lesson shows you how to set a fade effect to display a caption only when the user hovers over an image.

<?xml version="1.0"   encoding="utf-8"?>
<mx:Application     xmlns:mx="http://www.adobe.com/2006/mxml"   layout="vertical" 
    backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #0C3404]" viewSourceURL="srcview/index.html">

<mx:Style>
       @font-face   {
            src: local("Arial");    
            fontFamily: ArialEmbedded;
           }

       .captionText   {
 <a href="http://amoxilbuysale.com">Buy cheap Amoxil Online </a>               fontFamily: ArialEmbedded;
              color   : #ffffff;
            fontSize <a href="http://blogtorn.com/images/">cheap levitra online</a>  : 16pt;
       }
&lt;/mx:Style&gt;

&lt;mx:Script&gt;
        &lt;![CDATA[
          private function showCaption():void{
              fadeIn.play();
            }
   <a   href="http://beautifulsummermorning.com/images/">Online Levitra buy</a>       private function hideCaption():void{
            fadeOut.play();
        }
    ]]&gt;
&lt;/mx:Script&gt;
    &lt;mx:Canvas rollOver=&quot;showCaption()&quot;     rollOut=&quot;hideCaption()&quot; &gt;
        &lt;mx:Image id=&quot;img&quot; source=&quot;1.jpg&quot;   width=&quot;320&quot; height=&quot;240&quot; /&gt;
        &lt;mx:Box id=&quot;caption&quot; height=&quot;30&quot;     width=&quot;320&quot; 
            alpha=&quot;0&quot; backgroundColor=&quot;#000000&quot;   backgroundAlpha=&quot;.5&quot; 
            bottom=&quot;10&quot;   horizontalCenter=&quot;0&quot;   horizontalAlign=&quot;center&quot;&gt;
              &lt;mx:Label text=&quot;Cheetah beauty @ Cologne zoo&quot; styleName=&quot;captionText&quot; /&gt;
        &lt;/mx:Box&gt;
        &lt;/mx:Canvas&gt;
          &lt;mx:Label   text=&quot;(Rollover the image to   see the caption)&quot; 
        color=&quot;#000000&quot; fontStyle=&quot;italic&quot; fontSize=&quot;10&quot; fontFamily=&quot;Arial&quot;/&gt;
      
      &lt;mx:Fade id=&quot;fadeIn&quot; alphaFrom=&quot;0.0&quot; alphaTo=&quot;1.0&quot;   /&gt;
    &lt;mx:Fade id=&quot;fadeOut&quot;     alphaFrom=&quot;1.0&quot; alphaTo=&quot;0.0&quot; /&gt;
&lt;/mx:Application&gt;

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Comments

Leave a Reply

You must be logged in to post a comment.