I am trying to use
the PhotoViewer sample to help me create a fade effect. In the below
code, I have a component that successfully fades in when the component
(cardfileToImage) is created. I would like the first image to fade out
while a new image fades in when the user selects a new image. Just
like the PhotoViewer sample. PhotoViewer is fading an actualy image, but I
need to fade a whole component because it is an image pair. How can I get
the app to fade the images in and out when the user selects a new image
pair? The component fades properly when it is first created, but I'm not
sure what to use to tell it to fade when the user select a new image. The
new image does appear, but does not fade in.
Here is the code I
have for the fading:
<?xml
version="1.0" encoding="utf-8"?>
<mx:Canvas
xmlns:mx="http://www.macromedia.com/2003/mxml"
xmlns="*">
<mx:Script>
<![CDATA[
var activeControl;
public var src:String;
/*
public function loadCard() {
if (activeControl==card1) {
// card2.imageName = imageName;
} else {
card1.imageName = imageName;
}
}*/
function set imageName(src) {
if (activeControl==card1) {
card2.imageName = src;
} else {
card1.imageName = src;
}
}
<![CDATA[
var activeControl;
public var src:String;
/*
public function loadCard() {
if (activeControl==card1) {
// card2.imageName = imageName;
} else {
card1.imageName = imageName;
}
}*/
function set imageName(src) {
if (activeControl==card1) {
card2.imageName = src;
} else {
card1.imageName = src;
}
}
function
mix(showObj, hideObj)
{
activeControl=showObj;
var e1 = new mx.effects.Fade(hideObj);
e1.duration=800;
e1.alphaTo = 0;
activeControl=showObj;
var e1 = new mx.effects.Fade(hideObj);
e1.duration=800;
e1.alphaTo = 0;
var e2 = new
mx.effects.Fade(showObj);
e2.duration=800;
e2.alphaTo = 100;
e2.duration=800;
e2.alphaTo = 100;
var mixEffect = new
mx.effects.Parallel();
mixEffect.addChild(e1);
mixEffect.addChild(e2);
mixEffect.playEffect();
}
]]>
</mx:Script>
mixEffect.addChild(e1);
mixEffect.addChild(e2);
mixEffect.playEffect();
}
]]>
</mx:Script>
<cardfileToImage
id="card1" sizeType="" creationComplete="mix(card1,
card2)"/>
<cardfileToImage id="card2" sizeType="" creationComplete="mix(card2, card1)"/>
<cardfileToImage id="card2" sizeType="" creationComplete="mix(card2, card1)"/>
</mx:Canvas>
Thank you so
much,
Kim
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
---- LSpots keywords ?> ---- HM ADS ?>
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.