PDA

View Full Version : Help with Tweener ENTER_FRAME



lumi
August 25th, 2008, 11:59 AM
Guys I need your help badly. I just want a movieclip to fade in when the flash file is ran. but this isnt working. Please view my code


import caurina.transitions.Tweener;



lillian.alpha = 0;
lillian.addEventListener(Event.ENTER_FRAME, function() {Tweener.addTween(lillian, {x:10, time:0.5})});

sangackt
August 25th, 2008, 03:00 PM
I'm not sure how to help you on you because it looks like you made your own class.

What you're looking to do is pretty easy.
You just need to create a Tween object and have it modify the alpha of your moviecli

Just replace myObject with your object. "x" becomes "alpha". Choose your easing function. Start alpha and end alpha values. Length of tween.

When you do myTween.start() it should work. Just put myTween.start() in your enter_frame function.
var myTween:Tween = new Tween(myObject, "x", Elastic.easeOut, 0, 300, 3, true);

snickelfritz
August 25th, 2008, 03:06 PM
I know how do this in TweenMax/AS3, if you're interested.

lumi
August 25th, 2008, 05:04 PM
yes i am interested please help

snickelfritz
August 25th, 2008, 10:21 PM
yes i am interested please help

Download and install TweenMax:
Adobe FlashCS3>Configuration>ActionScript 3.0>Classes>gs directory goes here.

On frame1, place a movieclip on the stage.
Give it an instance name of "myClip".
Paste the following script in the actions layer on frame1.

stop();
import gs.TweenMax;
import gs.easing.*;

//Change the time (4) and delay(1) properties to tweak the duration and timing of the fade-in.
function loadSite():void
{
TweenMax.from(myClip, 4, {delay:1, alpha:0});
}

loadSite();

lumi
August 25th, 2008, 11:10 PM
Thanks a lot for the support. I already figured this out but I would like to create a sharp fade in/out like the one in http://www.letoya.net/ thanks for the anticipated response.




Download and install TweenMax:
Adobe FlashCS3>Configuration>ActionScript 3.0>Classes>gs directory goes here.

On frame1, place a movieclip on the stage.
Give it an instance name of "myClip".
Paste the following script in the actions layer on frame1.
ActionScript Code:

stop();
import gs.TweenMax;
import gs.easing.*;

//Change the time (4) and delay(1) properties to tweak the duration and timing of the fade-in.
function loadSite():void
{
    TweenMax.from(myClip, 4, {delay:1, alpha:0});
}

loadSite();

999
August 26th, 2008, 01:07 AM
Guys I need your help badly. I just want a movieclip to fade in when the flash file is ran. but this isnt working. Please view my code


import caurina.transitions.Tweener;



lillian.alpha = 0;
lillian.addEventListener(Event.ENTER_FRAME, function() {Tweener.addTween(lillian, {x:10, time:0.5})});

I've only used it once but I'm pretty sure you dont run it in an event listener (especially an ENTER_FRAME) like you have above. Not to mention your trying to tween the x value and not the alpha.
It should be implemented like most every other tween engine:



import caurina.transitions.Tweener;

lillian.alpha = 0;
Tweener.addTween(lillian, {alpha:1, time:0.5});
I don't know if that addTween syntax is correct though? You'd have to check the documentation.

snickelfritz
August 26th, 2008, 02:35 AM
stop();
import gs.TweenMax;
import gs.easing.*;

TweenMax.to(myClip, 0, {alpha:0, onComplete:loadSite, overwrite:false});

function loadSite():void
{
TweenMax.sequence(myClip,[{time:.2, alpha:1},{time:.2, alpha:0}]);
}

Anil_kumar
August 26th, 2008, 03:20 AM
// It works

import fl.transitions.Tween;
import fl.transitions.easing.*;

var UrObject:MovieClip = new MovieClip();
UrObject.graphics.beginFill(0x6633CC,1);
UrObject.graphics.drawRect(0,0,100,100);
UrObject.graphics.endFill();

addChild(UrObject);

var UrTween:Tween = new Tween(UrObject, "alpha", Regular.easeIn, 0, 1, 3, true);


// anilkumarnd@gmail.com