Using fonts from server

  • DrGonzo
  • Beginner
  • Beginner
  • DrGonzo
  • Posts: 36

Post 3+ Months Ago

Hi People,
I'm trying to make an application, where the user chooses a font name from a combo box and it changes their input text to the chosen font. I can make it work using formatText, but if the user doesn't have the font on their computer, it will substitute. Does anyone know a way of loading the fonts from the server instead of the user's computer?

This is the method i'm using at the moment:

//sets listener for lineOne text font
objComboListener = new Object();
objComboListener.change = function(eventObj){

//sets the swith function for lineOne font
var nIndex = Number(fontBox.selectedIndex);
switch (nIndex){
case 0: break;
case 1: lineOne_fmt = new TextFormat();
lineOne_fmt.font = "annifont";
lineOne_txt.setNewTextFormat(lineOne_fmt);break;
case 2: lineOne_fmt = new TextFormat();
lineOne_fmt.font = "arial";
lineOne_txt.setNewTextFormat(lineOne_fmt);break;
case 3: lineOne_fmt = new TextFormat();
lineOne_fmt.font = "air conditioner";
lineOne_txt.setNewTextFormat(lineOne_fmt);break;
}
}
//applies changes
fontBox.addEventListener("change", objComboListener);

while i'm here.... i'm also going to want the individual labels of the combo box to appear in their relevant font - I haven't tried this myself yet, so don't stress about it, but if anyone knows off the top of their heads......

Thanks,

DrGonzo
[/code]
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23460
  • Loc: Woodbridge VA

Post 3+ Months Ago

http://www.flash-mx.com/news/archives/000136.cfm
  • DrGonzo
  • Beginner
  • Beginner
  • DrGonzo
  • Posts: 36

Post 3+ Months Ago

Cool, Thanks!
I've got it working just fine now, but it's screwed up my bold & italic buttons!
This is particularly odd, when I'm using a very similar method to set the text colour - and that works fine?

I have this on frame one:

bold_btn.toggle = true;
var bold:Boolean = false

An this on the button:

on (press){
if (bold == true){
lineTwo_fmt = new TextFormat();
lineTwo_fmt.bold = false;
lineTwo_txt.setNewTextFormat(lineTwo_fmt);
bold = false;
}else{
lineTwo_fmt = new TextFormat();
lineTwo_fmt.bold = true;
lineTwo_txt.setNewTextFormat(lineTwo_fmt);
bold = true;
}
}

Any ideas?

Thanks,

DrGonzo

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 1 guest
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.