Groups | Blog | Home
all groups > flash actionscript > september 2006 >

flash actionscript : Aligning dynamic text


Leao16
9/7/2006 6:43:38 PM
Hi,

I've got a dynamic text box that retrieves text using Action script from an
external PHP file. It works well except when I set the dynamic text in Flash to
be centrally aligned it still aligns the text to the left when I play the
movie. I'm guessing it's to do with the script I'm using to retrieve the PHP
file but as I didn't write it myself I don't know what bit needs to be altered.

Any help would be greatly appreciated,

Leo (using Flash 8)
kglad
9/7/2006 7:07:08 PM
is the textfield created with actionscript or in the authoring environment?

if it's created in the authoring environment, you can use the properties panel
to assign text alignment.

if it's created with actionscript, show your relevent script.
Leao16
9/7/2006 7:15:36 PM
Hi, the textfield has been created using actionscript.

The code I used is attached. I attached it to the original post but for some
reason it didn't appear on the thread.

Many thanks, Leo

path = "http://www.myurl.org/whatdowedo.php";
lv = new LoadVars();
lv.onLoad = function(){
str = unescape(this);
str = str.split("=&onLoad=[type Function]").join("");
str = str.split("\r\n").join("<br>");
whatdowedo.html = true;
whatdowedo.htmlText = str;
};
lv.load(path);
kglad
9/8/2006 4:19:49 AM
Leao16
9/8/2006 9:16:45 PM
Sorry, I misunderstood your question ? the code was created in the authoring
environment but despite assigned center alignment in the properties panel it
didn't come out that way in the movie. Anyway I resolved the problem with the
following piece of code...

Cheers ? Leo


path = "http://www.myurl.org/whatdowedo.php";
lv = new LoadVars();
lv.onLoad = function(){
str = unescape(this);
str = str.split("=&onLoad=[type Function]").join("");
str = str.split("\r\n").join("<br>");
whatdowedo_text.html = true;
whatdowedo_text.htmlText = str;

// Create a TextFormat object
aligncenter = new TextFormat();
// Center the new TextFormat object
aligncenter.align = "center";
// Apply the format to scottfield
titlemember2_text.setTextFormat(aligncenter);

};
lv.load(path);
AddThis Social Bookmark Button