Solved

Is it possible to vertically align text on Flash

Posted on 2008-10-06
4
2,256 Views
Last Modified: 2013-11-12
Assuming I have a HTML enabled dynamic text field can I add text to it and align it central (or middle) vertically?

Thanks,

Mark
0
Comment
Question by:crooksy88
  • 2
4 Comments
 
LVL 5

Expert Comment

by:cokefour
ID: 22649331
I've had a look and doesn't seem to be a way unles anyone else knows a way round this. Flash is a bit strict with dynamic text boxes.
Have you tried coding it in the html and seeing if you can fool Flash into displaying it as such?
0
 
LVL 18

Accepted Solution

by:
Antonio Estrada earned 500 total points
ID: 22651853
Not by itself.

I wrote a little function called "verticalAlign". Should work ok.

Check out the <code>.

Or download the *.fla (Flash CS3) from http://vulturous.110mb.com/eefiles/verticalAlign.fla

-V
// --- THIS CODE IS FOR ACTIONSCRIPT 2 --- \\
 
myTextField.text = "This is my text with vertical alignment (sort of anyway).";
myTextField2.text = "This is some other text.";
myTextField3.text = "And this is a very big text!";
 
verticalAlign(myTextField);
verticalAlign(myTextField2);
verticalAlign(myTextField3);
 
function verticalAlign(txtField:TextField):Void {
	if((txtField._height - txtField.textHeight)/2>(txtField._height/4)) {
		txtField.text = newline + txtField.text;
	}
	if((txtField._height - txtField.textHeight)/2>(txtField._height/4)) {
		verticalAlign(txtField);
	}
}

Open in new window

0
 
LVL 13

Author Closing Comment

by:crooksy88
ID: 31503366
That'll do the trick! Thanks
0
 
LVL 18

Expert Comment

by:Antonio Estrada
ID: 22660708
Glad to help!

-V
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question