Search Flex Components Free

Custom Search

December 17, 2007

Creating a simple rotating text banner in flash

I needed to create a simple banner for a client where text would fade in and slide in from the left. So here’s a simple way to rotate text in a textfield. Now it’s easy to update text later down the road and you don’t have to manually tween every text box. I’ve added a nice fade in and slide transition to make it more pretty.

On your timeline window be sure to create a movieclip called “mc_instancename“. In the movieclip “mc_instancename” create a textbox called “txt_instancename”. Adjust the x and y coordinates and alpha amounts yourself in the tween class. Please note that this does not loop. But you can easily adjust the code to have it loop.

function tweenText() {


new mx.transitions.Tween(mc_instancename, “_alpha”, mx.transitions.easing.Regular.easeOut, 0, 100, 2, true);
new mx.transitions.Tween(mc_instancename, “_x”, mx.transitions.easing.Regular.easeOut, 533, 276, 1, true);

}

var intervalId:Number;
var count:Number = 0;
var maxCount:Number = 6;
var duration:Number = 5000;

var rotatingtext:Array = new Array();
rotatingtext[0] = “Place text here”;
rotatingtext[1] = “Place text here“;
rotatingtext[2] = “Place text here“;
rotatingtext[3] = “Place text here”;
rotatingtext[4] = “Place text here“;
rotatingtext[5] = “Place text here“;
rotatingtext[6] = “Place text here“;

function rotateText(param:String) {


tweenText();
mc_instancename.txt_instancename.htmlText = param;
clearInterval(intervalId);

if (count

Related Flex Tutorials