Adobe Dreamweaver Forums



Last 10 THreads :         Re: Colour differences on the web (Last Post : Ann_Shelbourne@adobeforums.com - Replies : 0 - Views : 1 )           »          cs4 full screen mode isn't saved in workspaces, unlike cs3 (Last Post : Ann_Shelbourne@adobeforums.com - Replies : 1 - Views : 2 )           »          help me with adjustments layers in CS4 (Last Post : eddie caruso - Replies : 5 - Views : 6 )           »          delete all channels previously created by "save selection" (Last Post : John_A_Horner@adobeforums.com - Replies : 2 - Views : 3 )           »          Just a small 3D project I have completed (Last Post : Ziggi - Replies : 0 - Views : 1 )           »          Change custom Vector class to new Vector class in player10 (Last Post : VarioPegged - Replies : 3 - Views : 4 )           »          CS4 Motion Editor issues (Last Post : aaronlyon - Replies : 2 - Views : 9 )           »          Looping through results with "Next" button (Last Post : Fetch - Replies : 1 - Views : 2 )           »          Writing a Dreamweaver Extension, where to start? (Last Post : Randy Edmunds - Replies : 1 - Views : 2 )           »          Focus, Browsers & Spry Accordion (Last Post : Randy Edmunds - Replies : 6 - Views : 7 )           »         


User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-04-2008, 09:02 AM
Solerous
 
Posts: n/a
Diggs:
Default Avoiding jerky rollover behavior

I have an image and I'd like to add a rollover effect to it so that a user can
click on it as is common in many HTML pages. However the redraw is extremely
jerky. It looks as if it were deleting the component (which pulls all the
elements underneath it up on the window) and then adding it back with the new
image (which pushed all the elements back down again). This is done very
quickly and looks very unprofessional. How do I do this in a way that avoids
this kind of jerkiness?




private function turnOnHighlight(event:MouseEvent):void {
imgLogo.source = "images/mSelectLogo.gif";
}
private function turnOffHighlight(event:MouseEvent):void {
imgLogo.source = "images/mLogo.gif";
}

<mx:Image id="imgLogo" source="images/mLogo.gif"
mouseOver="turnOnHighlight(event)"
mouseOut="turnOffHighlight(event)"/>



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-04-2008, 09:02 AM
-Hob
 
Posts: n/a
Diggs:
Default Re: Avoiding jerky rollover behavior

The problem is that when you change the source property on an Image object, it
makes another HTTP call to get the new image. It's not smart enough to cache
the bitmap data. You can fix the problem by using Eli Greenfield's SuperImage
instead of Image.


http://www.quietlyscheming.com/blog/...ubt-on-flex-as
-the-best-option-orhow-i-made-my-flex-images-stop-dancing/

Reply With Quote
  #3 (permalink)  
Old 11-04-2008, 09:02 AM
bholli
 
Posts: n/a
Diggs:
Default Re: Avoiding jerky rollover behavior

Solerous,

There are 2 ways that you can accomplish this.

1. If you are using a transparent gif as your logo, you could take advantage
of the built-in glow effect. Notice the code below:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" >
<mx:Glow id="highlightOn" duration="200" color="0xFFFFFF"
alphaFrom="1.0" alphaTo="0.5" blurXFrom="0.0" blurXTo="50.0"
blurYFrom="0.0" blurYTo="50.0" />
<mx:Glow id="highlightOff" duration="200" color="0xFFFFFF"
alphaFrom="0.5" alphaTo="1.0" blurXFrom="50.0" blurXTo="0.0"
blurYFrom="50.0" blurYTo="0.0" />
<mx:Image source="@Embed(source='images/logo.png')"
rollOverEffect="{highlightOn}" rollOutEffect="{highlightOff}" x="505" y="24"/>
</mx:Application>

or,

2. rather than changing the source of 1 image, try using 2 images that
crossfade each other. Notice the code below:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="initApp();">
<mx:Script>
<![CDATA[
public function initApp():void
{
this.logo.addEventListener(MouseEvent.ROLL_OVER, logo_rollOver);
this.logo.addEventListener(MouseEvent.ROLL_OUT, logo_rollOut);
}

public function logo_rollOver(event:MouseEvent):void
{
this.logo_highlighted.visible = true;
}

public function logo_rollOut(event:MouseEvent):void
{
this.logo_highlighted.visible = false;
}
]]>
</mx:Script>
<mx:Fade id="fadeIn" duration="200" alphaFrom="0.0" alphaTo="1.0" />
<mx:Fade id="fadeOut" duration="200" alphaFrom="1.0" alphaTo="0.0" />
<mx:Image id="logo_highlighted"
source="@Embed(source='images/logo-highlighted.png')" visible="false"
showEffect="{fadeIn}" hideEffect="{fadeOut}" x="505" y="222"/>
<mx:Image id="logo" source="@Embed(source='images/logo.png')"
rollOverEffect="{fadeOut}" rollOutEffect="{fadeIn}"
rollOver="logo_rollOver(event);" rollOut="logo_rollOut(event);" x="505"
y="222"/>
</mx:Application>

Both examples result in smooth transitions. Let me know how they work...!

--bholli

Reply With Quote


  #4 (permalink)  
Old 11-04-2008, 09:02 AM
Solerous
 
Posts: n/a
Diggs:
Default Re: Avoiding jerky rollover behavior

Thanks guys, that worked great. I ended up using solution #2 from #bholli.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 12:32 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk