you have a few choices
play("myTarget",true) which basically runs the transition in reverse when finished,
or you can set an effectend handler and simply reset the objects values by extracting the moveby values from it.
I haven't actually played with the transitions that much but the target properties are not updated until after the transition completes maybe oneffectupdate maybe a place to prevent target properties updating then refeshing the display(not to sure about this idea).
Not sure if this is the extent of your problem, but note that you have 'yBy' in the first effect and 'yTo' in the 0-duration effect. These aren't opposites (unless your starting position was actually y=-1000)
Sorry that was just a typo.
1 person found this helpful
Okay, then another problem in the code is that you're not restoring the alpha value. Fade will animate alpha to 0 (as specified) ... and will leave it there. If you don't restore alpha to 1 somewhere (such as by adding another SetAction after the one you have to set alpha to 1) then it will stay transparent.
Not sure if this is part of your problem, but I fixed a bug with zero-duration animations a couple of weeks ago (post Beta2), so you might grab the latest build if you still can't get it to work with the alpha fix above. I made your code work for me with the 2 adjustments I suggested.
Thanks. I found the problem...not sure why it works now - maybe I just inadvertently fixed a typo but here is what I had
<s:Sequence id="fadeOutItem" effectEnd="doNext()">
<s:SetAction property="visible" value="true" />
<s:SetAction property="alpha" value="1" />
<s:Move3D id="fadeOutMove" zBy="5000" />
<s:Fade alphaTo="0" />
<s:SetAction property="visible" value="false" />
<s:Move3D id="fadeOutRestore" zBy="-5000" duration="0" />
And the actionscript to invoke it as:
this.fadeOutMove.xBy = Math.random()*3500;
this.fadeOutMove.yBy = Math.random()*1200;
this.fadeOutRestore.xBy = -this.fadeOutMove.xBy;
this.fadeOutRestore.yBy = -this.fadeOutMove.yBy;
I changed it to store the move values in a local variable and everything seems to work:
var xBy:Number = Math.random()*3500;
var yBy:Number = Math.random()*1200;
this.fadeOutMove.xBy = xBy;
this.fadeOutMove.yBy = yBy;
this.fadeOutRestore.xBy = -xBy;
this.fadeOutRestore.yBy = -yBy;
Well, for one thing you're Sequence code below has an additional SetAction call at the beginning that sets an opaque alpha value before it plays - this is similar to the fix I suggested (except it makes it visible right before starting instead of after it finishes).
Anyway, good you got it working.