-
AS3 Tween Class stalls
using the tween class below - I am having trouble with it stalling before the reveal content runs. So my content sits there at like 5% opacity and does not finish loading. How do I fix this? Am I using a bad tween class?
Much Thanks,
-M
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
function display(endX,frame):void {
var mover:Tween = new Tween(line_mc, "x", Regular.easeOut, line_mc.x, endX, .5, true);
content_mc.gotoAndStop(frame);
var revealContent:Tween = new Tween(content_mc, "alpha", Regular.easeOut, 0,1,4,true);
}
-
Sorry this doesn't really help your problem but i use tweenlite (http://blog.greensock.com/tweenliteas3/) which is a stripped down version of tweening and runs faster than as3 built in tween (so I have heard) ... if you used that I could help lol ... good luck finding answer
-
What is endX? Show us an example of how you are using the function.
-
The Adobe Tween class is horrible - since you're using a local variable, it gets cleaned up after that function is run - but the Tween class is screwy and sometimes gets garbage collected along with the variable, abruptly killing your tween in the process.
I highly recommend getting away from fl.transitions.Tween and grabbing any of the other third-party engines (TweenLite is great, Tweener is solid, gTween, Go, &c).
-
Example
SStalder - here is a complete example of how I am using the function....
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
function display(endX,frame):void {
var mover:Tween = new Tween(line_mc, "x", Regular.easeOut, line_mc.x, endX, .5, true);
content_mc.gotoAndStop(frame);
var revealContent:Tween = new Tween(content_mc, "alpha", Regular.easeOut, 0,1,4,true);
}
display(btn_hom.x, "home");
btn_hom.addEventListener(MouseEvent.CLICK, home);
function home(event:MouseEvent):void {
display(btn_hom.x,"home");
}
btn_abo.addEventListener(MouseEvent.CLICK, about);
function about(event:MouseEvent):void {
display(btn_abo.x,"about");
}
btn_ser.addEventListener(MouseEvent.CLICK, services);
function services(event:MouseEvent):void {
display(btn_ser.x,"services");
}
btn_tea.addEventListener(MouseEvent.CLICK, team);
function team(event:MouseEvent):void {
display(btn_tea.x,"team");
}
btn_car.addEventListener(MouseEvent.CLICK, careers);
function careers(event:MouseEvent):void {
display(btn_car.x,"careers");
}
btn_con.addEventListener(MouseEvent.CLICK, contact);
function contact(event:MouseEvent):void {
display(btn_con.x,"contact");
}
-
I would suggest going with TweenLite as neznein9 mentioned above. It's much more stable than the native Tween class.
-
I will look at that - Thanks to all!
-M
-
Tween Lite Help
So I've got the Tween lite but I don't really understand how to translate my old tween to tween lite. For instance this is what I had:
function display(endX,frame):void {
var mover:Tween = new Tween(line_mc, "x", Regular.easeOut, line_mc.x, endX, .5, true);
content_mc.gotoAndStop(frame);
var revealContent:Tween = new Tween(content_mc, "alpha", Regular.easeOut, 0,1,4,true);
}
How do I rewrite the mover tween and revealContent tween in tween lite?
-M
-
This should do it:
PHP Code:
function display(endX,frame):void { TweenLite.to(line_mc, 0.5, { x: endX, ease: Regular.easeOut }); content_mc.gotoAndStop(frame); TweenLite.to(content_mc, 4, { alpha: 1, ease: Regular.easeOut }); }
-
OMG - Thank You. This is huge for me
-
blank white page
hmmm - when I preview my move now I just get a blank white page.
-
nevermind
it's working fine now - I just closed and re-opened the file.
Thanks again!
best,
-M
-
One thing though the alpha tween is not working.
This one:
TweenLite.to(content_mc, 4, { alpha: 1, ease: Linear.easeOut });
-
Is the alpha of content_mc not 0 before that tween starts? You could set the alpha before the tween runs I suppose.
-
Try using autoAlpha: - it's the same param but it accounts for visibility when you go in and out of alpha=0
-
I think his issue is the actual alpha already being at 1 when the tween is starting. So he would need to put in some logic to set the alpha to 0 somewhere first (before the tween). Correct me if I am wrong bluedawg65.
So it could be something like this:
PHP Code:
function display(endX,frame):void { TweenLite.to(line_mc, 0.5, { x: endX, ease: Regular.easeOut }); content_mc.gotoAndStop(frame); content_mc.alpha = 0;// Set to 0 then start the tween below TweenLite.to(content_mc, 4, { alpha: 1, ease: Regular.easeOut }); }
-
oh yes, I will try this...
-
Yes, With the alpha set to 0 beforee the tween starts - then it work s correctly.
Thank You!
-
Isn't Tweenlite so much nicer
-
Now that I am beginning to see how it works... and just the fact that it does work is awesome! I couldn't deliver the other to the client as it kept stalling.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|