Jump to content
GreenSock

scottiescotsman

yoyo in a window

Recommended Posts

function yoyo():void{
	TweenMax.killTweensOf(yoyo_MC);
	yoyo_MC.x = 0;
	yoyo_MC.sndTicker.text = ""+snd.id3.artist;
	yoyo_MC.sndTicker.autoSize = TextFieldAutoSize.LEFT;
	var xWidth = int(yoyo_MC.width)-193;
	TweenMax.to(yoyo_MC, 3, {x:-xWidth, y:155, ease:Sine.easeInOut, repeat:-1, yoyo:true});
}

Hi guys :)

 

I have a mp3 tag text scroller  left to right with tweenmax.to ....

..but I cant seem to get it to start at with the left side of text finishing at left point of window x=0,

and the right side finishing in the end of the right window x=193. so the text is yo-yoing inside the window.

I tried loads of ways but to no avail ... heres what I have that does work but not as I would like :)

 

 

Thanks in advance

Steven

Link to comment
Share on other sites

I would have to see a demo to know what is really happening.

Feel free to zip your fla and post it here.

Just include enough code to illustrate the problem. Don't need mp3s loading or id3 tags being parsed. Just a simple example with text hard-coded into a textfield.

 

Try pasting this into a blank FLA with access to the greensock files to see dynamic text tweening edge to edge of a container.

 

import com.greensock.*;
import com.greensock.easing.*;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;


// get width of container... use whatever display object you want
var fullWidth:int = stage.stageWidth;
trace("container widht = " + fullWidth);

var myText:TextField = new TextField;
myText.text="id3 tag";
myText.autoSize = TextFieldAutoSize.LEFT;
addChild(myText);
trace("text width = " + myText.width);

var distance:Number = fullWidth - myText.width;

TweenMax.to(myText, 1, {x:distance, repeat:-1, yoyo:true});
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.
×