@dustin - Do you know if there is a way to get around the grayish color in
the middle of the transition? It looks like it fades from white to the
grayish color then to black. And the same from black to white.

Here is my code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
styleName="plain">

   <mx:Sequence id="fadeToBlack">
       <mx:AnimateProperty target="{this}" property="alpha" fromValue="1"
toValue="0"
                   effectEnd="setStyle('backgroundColor','0')" />
       <mx:AnimateProperty target="{this}" property="alpha" fromValue="0"
toValue="1" />
   </mx:Sequence>

   <mx:Sequence id="fadeToWhite">
       <mx:AnimateProperty target="{this}" property="alpha" fromValue="1"
toValue="0"
                   effectEnd="setStyle('backgroundColor','white')" />
       <mx:AnimateProperty target="{this}" property="alpha" fromValue="0"
toValue="1" />
   </mx:Sequence>

   <mx:Button label="Fade To White" click="fadeToWhite.play();" />
   <mx:Button label="Fade To Black" click="fadeToBlack.play();"  x="58"
y="86"/>
</mx:Application>

On 12/6/06, Deepa Subramaniam <[EMAIL PROTECTED]> wrote:

 What about overriding the onTweenUpdate event handlers didn't work?

I'll try to whip together an example that works in the next day or two.



-deepa


 ------------------------------

*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *dorkie dork from dorktown
*Sent:* Tuesday, December 05, 2006 11:23 PM
*To:* flexcoders@yahoogroups.com
*Subject:* Re: [flexcoders] Fade from one color to another



@dustin - that worked for simple colors that are close by but not for pure
white to pure black #FFFFFF, #000000

@deepa - i could not get that to work after one hour.

i decided to try to dissolve from one state to another. one state has a
white background. the other state has a black background. the code i wrote
makes sense to me but the effects are triggering at the wrong time.
shouldn't this work? if there is more the fromState and toState are
misleading.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" styleName="plain">
    <mx:states>
        <mx:State name="blackState">
            <mx:SetProperty target="{button1}" name="label" value="Fade to
White"/>
            <mx:SetStyle name="backgroundColor" value="0x000000"/>
            <mx:SetEventHandler target="{button1}" name="click"
handler="{currentState=''}"/>
        </mx:State>
    </mx:states>

    <!-- Fade to black -->
    <!-- When user clicks a button the screen should fade to black-->
    <!-- After application /state fades to black switch states -->
    <!-- After switching states fade up from black -->
    <mx:transitions>
        <mx:Transition fromState="" toState="blackState">
            <mx:Parallel>
                <mx:Dissolve duration="4000" alphaTo="1" color="#000000"
target="{this}"/>
            </mx:Parallel>
        </mx:Transition>
        <mx:Transition fromState="blackState" toState="">
            <mx:Parallel>
                <mx:Dissolve duration="4000" alphaTo="1" color="#FFFFFF"
target="{this}"/>
            </mx:Parallel>
        </mx:Transition>
    </mx:transitions>
    <mx:Button x="120" y="139" horizontalCenter="0" verticalCenter="0"
label="Fade to Black" id="button1" click="{currentState='blackState'}"/>
</mx:Application>

 On 12/4/06, *Deepa Subramaniam* < [EMAIL PROTECTED]> wrote:

Ah – that is because AnimateProperty is just cycling through all the RGB
values between your fromValue color and your endValue color. What you may
want to do is add an event handler for the tweenUpdate event on the
AnimateProperty effect instance and check to see what the value passed in
the TweenEvent object is. That value is what the backgroundColor is at that
moment in the lifetime of the effect. You can then add in your own logic
that sets the backgroundColor depending on where the effect is in its
lifetime (ie: simulate a progression from dark gray to light gray). I'm not
100% sure how that will work out but I'd be interested in finding out what
doesn't work about it.



Incidentally, you should check out Alex Uhlmann's Animation Package where
I think he has an effect that does exactly what you want. That will probably
be easier J

http://www.alex-uhlmann.de/flash/animationpackage/



-deepa




 ------------------------------

*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *dorkie dork from dorktown
*Sent:* Monday, December 04, 2006 2:31 PM
*To:* flexcoders@yahoogroups.com
*Subject:* Re: [flexcoders] Fade from one color to another



i see. that mostly works. except now it cycles through every color giving
a flicker effect like i am on acid. try this to see:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml";
layout="absolute"
styleName="plain"
    creationCompleteEffect="{fadeColor}">
    <mx:AnimateProperty id="fadeColor" isStyle="true"
property="backgroundColor"
        fromValue="0xFFFFFF" toValue="0x000000" target="{
Application.application}"
        duration="2000"/>
</mx:Application>

If i change the fromValue and the toValue to a two digit number like so it
is a very smooth transition but it does not fade from white.  It only fades
from blue. Try this:

    <mx:AnimateProperty id="fadeColor" isStyle="true"
property="backgroundColor"
        fromValue="0xFF" toValue="0x00" target="{Application.application}"

        duration="2000"/>

I am thinking of just transitioning to a blank black state but that feels
like a hack.

dorkie best practices dork from dorktown

On 12/4/06, *Deepa Subramaniam *<[EMAIL PROTECTED]> wrote:

Set the the isStyle property to true in your AnimateProperty tag.



-deepa


 ------------------------------

*From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
Behalf Of *dorkie dork from dorktown
*Sent:* Monday, December 04, 2006 5:25 AM
*To:* flexcoders@yahoogroups.com
*Subject:* [flexcoders] Fade from one color to another



I need to fade my application background color from 0xC47D31 to 0x67DEF9
and I have no idea where to start. I've seen AS2 actionscript around that I
can try to convert but what I'm looking for is a already built MXML
component Effect, similar to mx:Fade or Dissolve.

I tried this and received errors:
    creationCompleteEffect="{fadeColor}">
    <mx:AnimateProperty id="fadeColor" property="backgroundColor"
toValue="#000000" target="{Application.application}" duration="5000"/>

ReferenceError: Error #1069: Property backgroundColor not found on
TestApplication and there is no default value.
    at mx.effects.effectClasses::AnimatePropertyInstance/::getCurrentValue
()

dorkie mood changing dork from dorktown




Reply via email to