# Reg : actionscript for device fonts

**URL:** https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206
**Category:** Uncategorized
**Created:** [October 29, 2003, 7:50pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206 "2003-10-29T19:50:34Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![shallroc](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@shallroc](https://forum.kirupa.com/u/shallroc)
#### Post date: [October 29, 2003, 7:50pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/1 "2003-10-29T19:50:34Z")

</div>

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 \*\_^

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 29, 2003, 7:57pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/2 "2003-10-29T19:57:34Z")

</div>

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]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 29, 2003, 8:08pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/3 "2003-10-29T20:08:20Z")

</div>

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\_pos_ratio);  
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\_pos_ratio);  
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]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 29, 2003, 8:17pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/4 "2003-10-29T20:17:45Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 29, 2003, 8:27pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/5 "2003-10-29T20:27:14Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 29, 2003, 8:53pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/6 "2003-10-29T20:53:40Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 29, 2003, 9:03pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/7 "2003-10-29T21:03:30Z")

</div>

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…

:}

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 29, 2003, 9:10pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/8 "2003-10-29T21:10:33Z")

</div>

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:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 29, 2003, 11:02pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/9 "2003-10-29T23:02:33Z")

</div>

Im confused… hehe. Is your problem solved?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 30, 2003, 9:23am UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/10 "2003-10-30T09:23:33Z")

</div>

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:}

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 30, 2003, 4:45pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/11 "2003-10-30T16:45:38Z")

</div>

Glad I could help :thumb:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 22, 2004, 10:31pm UTC](https://forum.kirupa.com/t/reg-actionscript-for-device-fonts/34206/12 "2004-09-22T22:31:46Z")

</div>

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
