|
-
[RESOLVED] letter spacing in dynamic textfield
Hi,
I am trying to apply letter spacing to a dynamic textfield
I set it in the properties panel.
I know that this does not work for newly added text.
I searched the web and nothing I found works.
when I try setNewTextFormat I get the error
Warning Migration issue The method setNewTextFormat is no longer supported. Use the TextField.defaultTextFormat property instead
how do I use that defaultTextFormat, I tried this
PHP Code:
import typewriter;
var fmt:TextFormat = outputTextBox.getTextFormat()
var newTypewriter:typewriter = new typewriter;
var firstMessage:String = "Do you speak multicultural?";
newTypewriter.writeIt(firstMessage, outputTextBox, 30);
outputTextBox.setTextFormat(fmt);
outputTextBox.defaultTextFormat(fmt);
//error was
//1195: Attempted access of inaccessible method defaultTextFormat through a reference with static type flash.text:TextField.
the typewriter refers to this class that I am using to add text to the textfield
http://entrance4.net/labs/?p=55
Just in case this also affects how I apply formatting
hope someone can help
seems to be a lot of confusion about this
Mark
-
I think you need to...
import flash.text.TextFormat;
If you cant get it working i can show you a way to make a dynamic text field with as3 and change all of its Format properties at the same time. It requires a little more code but you wont need to have the textfield in your libary.
-
Thanks for the reply,
I worked it out finally.
I actually found a good example of doing it dynamically (as you suggested) and modified that.
text field is instance name outputTextBox
heres my code, in case someone else needs it sometime
PHP Code:
import flash.text.TextFormat;
function TextFormatExample() {
configureLabel();
setLabel();
//this refers to typewriter class mentioned in original post
newTypewriter.writeIt(firstMessage, outputTextBox, 30);
}
function setLabel():void {
firstMessage = "Do you speak multicultural?";
}
function configureLabel():void {
var format:TextFormat = new TextFormat();
format.letterSpacing = 20;
outputTextBox.defaultTextFormat = format;
}
TextFormatExample();
this is a bit specific to my situation, so here is the link to the Adobe help example that got me on the right track
http://help.adobe.com/en_US/AS3LCR/F...xamplesSummary
Mark
-
Good job, you basicly used the example i had in mind and seem to have found it the same way. Through the adobe help. Im going to have to go have a look at the typewriter class though, my example didnt use it. I assume it doesnt something that relates it to a type writer.
I guess this is now...
RESOLVED!
-
Yes typewriter just puts the characters on stage 1 by one as if typing.
I put the help link up because the first few times I went looking I did not find the example. It was not in the first obvious places when hitting F1.
The help can be a bit of a maze sometimes.
Once found it was the prefect example.
mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|