Jump to content
Search Community

Why won't my text to scroll at a constant rate?[SOLVED]

attaboy test
Moderator Tag

Recommended Posts

It starts out too fast and ends up too slow. You can see it here http://www.jimslounge.com/textScroll2.swf

here's the code:

 

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
import flash.events.*;
import flash.net.*;
import flash.text.*;
import flash.display.*;

var myFont:Font2 = new Font2();
var extLoader:URLLoader = new URLLoader();
var req:URLRequest = new URLRequest("bio.txt");
var tf:TextField = new TextField();
var msk:Sprite = new Sprite();
var myFormat:TextFormat = new TextFormat();
var timeline:TimelineMax;

tf.x =50;
tf.y =80;
tf.width = 300;
tf.height = 1300;
tf.multiline=true;
tf.wordWrap=true;
tf.condenseWhite=true;

addChild(tf);

	msk.graphics.beginFill(0x000000);
	msk.graphics.drawRect(0, 0, 300, 150);
	msk.x = 50;
	msk.y = 80;
	msk.graphics.endFill();



extLoader.addEventListener(Event.COMPLETE, textReady);

myFormat.font = myFont.fontName;
myFormat.size = 14;
myFormat.leading = 2.5;

tf.defaultTextFormat=myFormat;
tf.embedFonts=true;
tf.alpha=1;

extLoader.load(req);

function textReady(e:Event):void {
tf.cacheAsBitmap=true;
msk.cacheAsBitmap=true;
	tf.mask=msk;
tf.htmlText=e.target.data;
addChild(msk);
}
TweenLite.to(tf, 50, {y:-1400});

Link to comment
Share on other sites

By default, all tweens use a Quad.easeOut ease because it is the most "natural" (real life objects typically slow down towards the end of their motion). But you can easily change this by using a different ease. If you want to have a linear motion (no easing), just use the Linear.easeNone ease like:

 

TweenLite.to(tf, 50, {y:-1400, ease:Linear.easeNone});

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...