Reg : actionscript for device fonts

Help pleaso…

Just need to know if there is some actionscript code to turn on device fonts…

I know this can be done within the property panel but I need this to be done using code…

Heeeeelppppp

Shallroc *_^

Step 1) Import Font into Library (In the Library panel there is an icon in the far upper-right corner, click that then choose “New Font”)

Step 2) Right click on the imported font. Choose “Linkage” from the context menu. And then check the “Export for Actionscript”

Step 3) Where you are putting your actions, add [AS]textBoxInstanceName.embedFonts = true;[/AS]

Copy of the code…

[AS]onClipEvent (load) {
//The text to display in the Menu
name = “name”;
//Defines which button this is. You could use duplicated buttons, but I decided not to, for simplicity of updating. The file size was less than 1K difference.
button = 1;
//How fast to move the menu.
ratio = .3;
//Set local left and right variables.
left = _root.left;
right = _root.right;
}
onClipEvent (enterFrame) {
o_x_pos = _root.button1_x;
o_y_pos = _root.button1_y;
mag = _root.magnet;
//Move towards mouse when in the set area.
if (_root._ymouse>(o_y_pos-mag) & _root._ymouse<(o_y_pos+mag) & _root._xmouse>left & _root._xmouse<right) {
this._x = x_pos;
x_pos = x_pos-(n_x_posratio);
n_x_pos = x_pos-_root._xmouse;
this._y = y_pos;
y_pos = y_pos-(n_y_pos
ratio);
n_y_pos = y_pos-_root._ymouse;
//Move towards original position in the set area.
} else {
this._x = x_pos;
x_pos = x_pos-(n_x_posratio);
n_x_pos = x_pos-o_x_pos;
this._y = y_pos;
y_pos = y_pos-(n_y_pos
ratio);
n_y_pos = y_pos-o_y_pos;
}
}[/AS]

Please use the [AS][/AS] tags when posted actionscript, it makes it a lot easier to read.

And i’m not really sure why you posted your code, are you having problems with it?

Also, it seems to me like you are using a var name for your textbox instead of an instance name. To be able to embed the font for a textbox you need to target an instance name, so you will have to give it an instance name.

Which brings me to the question: If you aren’t dynamically creating your textbox (via createTextField()) why do you need this to be done via actionscript when you can do it through the properties panel?

Just going thru some code for a magnetic button menu but instead of having seperate buttons the original fla uses 1 button which is duplicated and the code itself puts in the text on the button but obviously the text gets atialiased…

If I change the text on one of the buttons it in turns changes the text on all the other buttons.

Probably start to look at creating seperate buttons instead of using 1 original button

I use one main button and duplicate it all the time. I never really had a problem with the text changing in all the other buttons (unless I manually typed it into the textbox instead of changing it via AS).

And yes, obviously the text will become anti-aliased since you are embedding the font outlines (makes it look like Static text)

Thanks for taking the time to help me out here, always get could responses from our forums…

Like you said as soon as I type in the text box it changes the type in all the other boxes…

Bit of a pain really because each text box needs different text on it…

Doing it in code works fine but the atialiasing makes it all look muddy…

:}

Awesome lostinbeta…

Turned off embed fonts (Basically don’t need it due to using system font Verdana)

Thanks one heck of alot, always helps to get someone elses perspective on things, especially when they know tons more…

Awsome…

Much respect…:thumb: :thumb:

Im confused… hehe. Is your problem solved?

Yeah everything sorted…

Thank you…

You got me thinking about the options always embed fonts which I turned off…

Which got round my problem

Thankssssssssssssss:}

Glad I could help :thumb:

hey thanks. this solves my problem as well. For some reason the fonts embeded by using the properties panel only work above a certain font size for me. loading them into the library fixes that just well.
erok