-
Information Architect
[swf width="550" height="300" background="#FFFFFF"]http://www.zh-webdesign.ch/zoa/autosize_text3.swf[/swf].
Just an exammple of the textFormat object.
Code:
// Creating textfield text format
fieldTextFormat = new TextFormat();
fieldTextFormat.font = "Arial";
fieldTextFormat.bold = false;
fieldTextFormat.italic = false;
fieldTextFormat.align = "left";
// Creating the base textfield
createTextField("mytext", 1, 200, 100, 200, 150);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = true;
mytext.html = false;
mytext.type = "input";
mytext.selectable = true;
mytext.text = thetext;
mytext.autosize = "left";
mytext.borderColor = 0xaaaaaa;
mytext.text = "Test the format object!";
mytext.setTextFormat(fieldTextFormat);
// Set labelös of the button components
bold_button.setLabel("bold");
italic_button.setLabel("italic");
left_button.setLabel("LEFT");
center_button.setLabel("center");
right_button.setLabel("right");
// Set font provider
myfonts=TextField.getFontList();
fontList.setDataProvider(myfonts);
fontList.setSize(300);
fontList.setSelectedIndex(20);
// set font-size provider
fontSizes = new Array(6,8,10,12,14,16,18,20,24,28,32,40,48,56,64);
fontSize.setDataProvider(fontSizes);
fontList.setSelectedIndex(4);
// change font when new one selected
fontList.setChangeHandler("myHandler");
function myHandler(component){
fieldTextFormat.font = fontList.getSelectedItem().label;
mytext.setTextFormat(fieldTextFormat);
}
// change font-size when new one selected
fontSize.setChangeHandler("myHandler2");
function myHandler2(component){
fieldTextFormat.size = fontSize.getSelectedItem().label;
mytext.setTextFormat(fieldTextFormat);
}
// Functions for the buttons
function makeBold(){
if (fieldTextFormat.bold){
fieldTextFormat.bold = false;
bold_button.setLabel("bold");
} else {
fieldTextFormat.bold = true;
bold_button.setLabel("BOLD");
}
mytext.setTextFormat(fieldTextFormat);
}
function makeItalic(){
if (fieldTextFormat.italic){
fieldTextFormat.italic = false;
italic_button.setLabel("italic");
} else {
fieldTextFormat.italic = true;
italic_button.setLabel("ITALIC");
}
mytext.setTextFormat(fieldTextFormat);
}
function makeLeft(){
fieldTextFormat.align = "left";
left_button.setLabel("LEFT");
center_button.setLabel("center");
right_button.setLabel("right");
mytext.setTextFormat(fieldTextFormat);
}
function makeCenter(){
fieldTextFormat.align = "center";
left_button.setLabel("left");
center_button.setLabel("CENTER");
right_button.setLabel("right");
mytext.setTextFormat(fieldTextFormat);
}
function makeRight(){
fieldTextFormat.align = "right";
left_button.setLabel("left");
center_button.setLabel("center");
right_button.setLabel("RIGHT");
mytext.setTextFormat(fieldTextFormat);
}
Fredi
-
Wow! I'm totally impressed. Great stuff Subway.
-
HELP>>>ACTIONSCRIPT DICTIONARY
Subway
Nice work man. This is good stuff!
Antibody
-
Sounds good
Looks good, now I'd make it into a Tutorial.
-
Maybe with fl6 we can launch our own competitor to word.
-
HELP>>>ACTIONSCRIPT DICTIONARY
PishPosh-
Let us know when you get done making the tutorial.
-
Flashkit's Cheerbud
WOW!
its amazing how MX can do all this stuff i think it is worth my Dollars!!! ill see if i buy it you think that you can make a print button that will print the dynamic text feild or input text feild whatever it is?
-
Information Architect
Thx, it will come much more about this from me later. That was just the start of it.
Fredi
-
Senior Member
So you "WOULD" be able to print whatever you have in the TEXT box that will be changed?..That FONT?..That SIZE?....what about color??
By the way..VERY NICE>..You have IMPRESSED me twice in 2 days! GREAT WORK!!
-whispers-
-
gr8.
but one more question regarding this ...
can we do this ?
while we goes [sets focus] in to new field by mouse / keyboard ... then if the field data is not valid then it should give some error ?
let me know ...
-
one more question ....
i also not found how to change effects of frames in tweening ... like to make alpha 0.
i gets the effects is disabled every time ...
plz help
-
Information Architect
Originally posted by aashu.com
gr8.
but one more question regarding this ...
can we do this ?
while we goes [sets focus] in to new field by mouse / keyboard ... then if the field data is not valid then it should give some error ?
let me know ...
I don't know what you mean, but you can set a textFormat object for every textfield. You can also set an onChanged handler for a textfield, so if something changes, you can make whatever you want.
Much more on all this with the new version - later.
Fredi
-
okay ...tell me if you found for form validation thing in flash while Focus is Killed by Keyboard or mouse of textbox then can we run function etc?
-
Information Architect
Originally posted by aashu.com
okay ...tell me if you found for form validation thing in flash while Focus is Killed by Keyboard or mouse of textbox then can we run function etc?
Yup!
TextField.onKillFocus = function (newFocus) {
statements;
};
Description
Event handler; an event that is invoked when a text field loses keyboard focus. The onKillFocus method receives one parameter, newFocus, which is an object representing the new object receiving the focus. If no object receives the focus, newFocus contains the value null.
Fredi
-
okay ... tonight i hav to work on it!
-
Information Architect
Just found an undocumented feature with Textfields.
Will post an example of it later.
Fredi
-
Code:
MovieClip.prototype.makeText = function(xPos,yPos,myText,myFont,mySize,myColor){
this.createEmptyMovieClip("empty",j++);
this.empty.createTextField("text_txt",j++,xPos,yPos,0,0);
this.empty.text_txt.autoSize = true;
this.empty.text_txt.text = myText;
this.empty.text_txt.selectable = false;
this.empty.myTextFormat = new TextFormat();
this.empty.myTextFormat.font = myFont;
this.empty.myTextFormat.size = mySize;
this.empty.myTextFormat.color = myColor;
this.empty.text_txt.setTextFormat(this.empty.myTextFormat);
}
just a prototype with simple formatting
[Edited by agent vivid on 03-20-2002 at 03:52 AM]
-
gr8 code ....
i think now we can make site user can select fonts ... of his own ...
what do u think?
-
Information Architect
ALL HTML-FORMAT TAGS:
The following HTML tags are supported in text fields:
Code:
<*A>, <*B>, <*FONT COLOR>, <*FONT FACE>, <*FONT SIZE>, <*I>, <*P>, and <*U>.
(without the "*" of course)
But how can we set leading, indent ... ?
The way to do this is to use the "TEXTFORMAT" tag:
Code:
<*TEXTFORMAT LEFTMARGIN=\"1\" RIGHTMARGIN=\"1\" LEADING=\"2\"><*P ALIGN=\"CENTER\"><*FONT FACE=\"_sans\" SIZE=\"12\" COLOR=\"#000000\">Some text<*/FONT><*/P><*/TEXTFORMAT>
(without all the "*" of course)
Nice, isn't it?
Fredi
<TEXTFORMAT LEFTMARGIN=\"1\" RIGHTMARGIN=\"1\" LEADING=\"2\"><P ALIGN=\"CENTER\"><FONT FACE=\"Arial\" SIZE=\"72\" COLOR=\"#12aacc\"><B>SUBWAY FOREVER!!!!</B></FONT></P></TEXTFORMAT>^^^ real HTML text, not a swf ^^^^
-
Information Architect
I have recoded the hole puppy! It's not perfect (align not implemented), but you can write text, change the font, size, ... of the selected part of the text ...
Things to come are:
- align (of course)
- font and size selector jumps to the right selections when you click into the textfield
- some other bugs
[swf width="550" height="300" background="#FFFFFF"]http://www.zh-webdesign.ch/zoa/autosize.swf[/swf].
N'Joy!
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
|