02-06-2003, 07:53 AM
|
#1
|
|
Addicted To FLASH
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
|
Making a Font list like MS, Dynamicly
I have an idea of making a text Editor for a long time now, but 'till I do it, here is a piece of code that I was inspired with, of making a font list that changes the font on the run within the text field. he main Idea was from MM site, but I've changed all the scripts upside down, will add it later in the Library
ActionScript Code:
//Code and all Credits belongs to Farafiro, created Feb. 06/2003
//First, grab a combo box to the stage, then delete it, or grab it only to the library
//attaching the ComboBox to the root
_root.attachMovie("FComboBoxSymbol", "fontList", -1000, {_x:50, _y:50});
//To make the ComboBox Editable, to accept writting the first letter
fontList.setDataProvider(TextField.getFontList());
//sorting the fonts
fontList.sortItemsBy("label", "asc");
//Creating a text field that showes the current font
_root.createTextField("fontLable",50,75+fontList._width,50,75,fontList._height)
with(fontLable){
border = true
autoSize = true
}
//Creating the main text field
_root.createTextField("myField", 100, 50, 100, 350, 400);
with (myField) {
type = "input"
text = "Add any text and chose any font ......"
border = true;
borderColor = 0x336699;
}
//Making our text formating
tf = new TextFormat();
//The script that controlls the font's Changing
_root.onEnterFrame = function() {
fontList.onKillFocus = function() {
selecting = false;
};
fontList.onSetFocus = function() {
selecting = true;
};
if (selecting) {
_root.fontLable.text = fontList.getValue();
tf.font = fontList.getValue();
myField.setTextFormat(tf);
} else {
fontList.setValue(_root.fontLable.text);
}
myField.setNewTextFormat(tf);
};
You can use this as you want, but u can gimmie some credit too
__________________
â€* GOD Is Near â€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
|
|
|
02-06-2003, 08:06 AM
|
#2
|
|
Registered User
Join Date: Feb 2003
Posts: 4
|
Great idea and code!
Add the
ActionScript Code:
multiline = true;
wordWrap = true;
parames to the main textfield and you can write a letter
Thank you.
Last edited by l-i-n-k; 02-06-2003 at 08:10 AM.
|
|
|
02-06-2003, 08:10 AM
|
#3
|
|
Addicted To FLASH
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
|
done, thx
__________________
â€* GOD Is Near â€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
|
|
|
02-07-2003, 10:31 AM
|
#4
|
|
Thing
Join Date: Jun 2001
Location: UK
Posts: 2,418
|
bug: just thought I'd let you know.
Doesn't seem to work with many fonts (even if I place a textbox onstage and embed the font outlines for that font). Fonts like Arial and Arial Black work but many others don't.
|
|
|
02-09-2003, 04:33 AM
|
#5
|
|
Addicted To FLASH
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
|
I will check it out, but it worked here with all the fonts in my system
__________________
â€* GOD Is Near â€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
|
|
|
02-09-2003, 04:37 AM
|
#6
|
|
Addicted To FLASH
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
|
I tried it again over the web and it went very well, even with the odd fonts like Coptic and Greek
http://www.geocities.com/a_fayek/fun...y_fontList.swf
__________________
â€* GOD Is Near â€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
|
|
|
02-09-2003, 12:18 PM
|
#7
|
|
Thing
Join Date: Jun 2001
Location: UK
Posts: 2,418
|
I'm getting a 404 on that link Faffy.
Oh, maybe it's just me then. It didn't work locally for me at all. It said it was displaying certain fonts, but they wern't the corrent ones. Maybe some other people can test it and see if its a platform related or flash plugin version problem.
|
|
|
02-09-2003, 12:49 PM
|
#8
|
|
Oops I did it again
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579
|
that works a treat for me
mac osx ie5.2
very nice indeed!
|
|
|
02-09-2003, 12:52 PM
|
#9
|
|
Addicted To FLASH
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
|
Quote:
Originally posted by Billy T
very nice indeed!
|
thx mate
__________________
â€* GOD Is Near â€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
|
|
|
02-09-2003, 01:06 PM
|
#10
|
|
no sleep til bedtime
Join Date: May 2001
Location: Brighton
Posts: 1,322
|
looks good to me:
winxp
opera 7.1 & ie 6.0
player is 6.0.22
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 01:22 PM.
///
|
|