Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping centered while scaling

Status
Not open for further replies.

mpalmer12345

Programmer
Feb 16, 2004
59
US
I'm trying to scale up some letters in a text, but I also want to keep them exactly centered in the middle of the screen. Is there a better way to do this than simply to adjust the y-coordinate in some crude fashion as the scale grows larger such as I am doing below? It seems that every letter might have to be individually adjusted based on its specific size etc.

(excerpt of relevant code)
(mc.y is the y-location of the lower-left part of the text on the screen)

function createAllText(textList) {
for(var i=0;i<textList.length;i++) {

// create movie clip
mc = createText(i,textList);

// set location
mc._x = 100;
mc._y = 100;

// set scale to 0
mc._xscale = 0;
mc._yscale = 0;

// set scale var to negative amount
mc.scale = 0-i*250;
}
}

function init() {
// create array of text
var words = "LovePeaceDestinyLlamasFate Rocks";
var textList = words.split("");

// create AT movie clips
createAllText(textList);
}

function moveText() {
// loop through words
for(var i=0;i<numWords;i++) {

// increase the scale
mc = this["text"+i];
mc.scale += 10;

mc._xscale = mc.scale;
mc._yscale = mc.scale;
mc._y += 1;
}
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top