Solved

Is it possible to vertically align text on Flash

Posted on 2008-10-06
4
2,252 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Web Modal Window 1 72
You Tube Videos not playing 9 106
Intranet building Software 8 72
Text Transformation using ActionScript 3 5 82
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 integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now