TextFormat & Hover
I have created a new textFormat for some dynamic text that is loaded into a textfield. Is there a way to change the style of the text when hovering over it?
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 04-13-2005, 08:32 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
TextFormat & Hover
I have created a new textFormat for some dynamic text that is loaded into a textfield. Is there a way to change the style of the text when hovering over it?
Play Sound On Hover/ Off On No Hover
I have music playing in my file and I have a section of the site which plays some short audio pieces, about 5 or 6. There maybe a simple solution but I have not had many flash lessons, but the problem with playing the audio clips is you can press it again and it plays again and press others, so it becomes a mess with multiple sounds playing. I tried stopallsounds on the button but that turns off my music. So i thought a workaround would be to have the sound play on hover of the button and go off when you are not on hover, but I cannot see how to get this to work. Unless there is another way, I guess ideally Id like it so you have to click the button.
TextFormat Example
[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
TextFormat Help
Ok, I am trying to bold a piece of selected text (like a text editor). The input text has a instance of textIns_txt, the bold button has an instance of boldButton and there is an enterFrameMovie outside the stage. Here is the code...
textIns_txt.onKillFocus = function(){
Selection.setFocus(textIns_txt);
Selection.setSelection(begin, end);
trace (begin);
trace (end);
}
enterFrameMovie.onEnterFrame = function(){
begin = Selection.getBeginIndex();
end = Selection.getEndIndex();
}
boldButton.onRelease = function(){
boldFormat = new TextFormat();
boldFormat.bold = true;
textIns_txt.setTextFormat(begin, end, boldFormat);
}
Why doesnt it work? It will trace the correct values for the beginIndex and endIndex, but doesnt bold it... Thanks for any help in advance.
TextFormat
HI all!
I have a string. I manage to put some caracters in bold by the use of textFormat object like this:
formatBold = new TextFormat();
formatBold.bold = true;
myString.setTextFormat(5, 7, formatBold);
How can I do to manage to know if one of my caractere in my string is bold?
if(myString.charAt(6).bold == true //that doesn't work){
do something...
}
thanks!!!!
Textformat
How can you apply a format (i.e. bold) to a selection of text in a text field set to input???
I think this is an important step to overcome if we are to solve the rich text editor problem...
Ian
TextFormat URL
I'm having a little trouble getting the TextFormat object to work with the URL and target property. I have two books that explain pretty much everything about the textFormat object except how to set up a URL and Target. And I've had no luck on Macromedia's site.
Anyone know how to use this?
THX
TextFormat ?
Does anyboady know if there is a way to set text in the input field to all Caps/Lowercase. Is there a way to do this trough TextFormat?
Thanks
New TextFormat()
Does anyone know if I can format a manually created text field?
I have a dynamic text field that accepts students names.
I am converting the first letter to a capital and adding a full stop at the end...
The text is red...
I want to make the color of the fullstop black..
I have tried...
// make textFormat object
format = new TextFormat();
format.color = oxoooooo;
// then apply to my string
// dynamic text field named input... containing variable inputString
input.setTextFormat( 8, format);
__. but no formatting happens
Any ideas?
New TextFormat(); Help
Just when i thought i had sorted one problem another shows it's erie head
Most of yesterday was spent trying to figure out code for change the format of text in an input field. got that SORTED
But now i have discovered that the format is not retained when i submit the form for proccessing, wether it be email form or admin area form sending to db.
I am familiar with using TextFormat(); and the code in the fla is not mine more a combanation of posts that i have read on this subject.
If you download the attach fla and run it set some text to diffrent format then press the view format you will see that the format of the text is not retained
Any help
Cheers
Paul
TextFormat()
Hi, i'm using TextFormat() to display dynamic text (from XML).
Assuming this line: GeneralQLFormat = new TextFormat();
and then:
GeneralQLFormat.html = true;
the dynamic text that comes the DB is in htm format, example: <b>text</b>
but it doesn't display the "text" in Bold, nor it shows the tags (<b>) what going on???????
thanks in advance,
Maya.
TextFormat()
HI!
I want the format of my text to be changed on a certain event. So I tried the TextFormat object... but I can't make it work properly. It just makes my text disappear
Here is my code :
formatBold = new TextFormat();
formatBold.bold = true;
formatBold.color = 0x000000;
//My textField is placed on the same level, and the instance name is "titreBouton"
titreBouton.setTextFormat(formatBold);
Anyone has an idea about this??
Thanks in advance!!
Julie
TextFormat
Hi,
I am creating an application that does calculations. The application will contain 6 variables. 4 of them will be knowns and to of them will be unknows. The application will use the 4 knowns to calculate the 2 unknows. I am wanting to change the font to bold if the font is the two unknown statements that way the user can see what variables they just calculated for.
For Example (I have tried this):
if (a==0 & b==0){
//I am wanting to change the font of variable after the calculations
var my_fmt:TextFormat = new TextFormat();
my_fmt.bold = true;
//var a instance name is a
var a = c*d*e*f
a.setTextformat(my_fmt);
var b = c-a
}
Does anyone have any suggestions? All help will be greatly appreciated.
Thanks,
Jon
Xml With TextFormat
I am creating a menu with sub menus using xml. But cant seem to apply my textFormat to my dynamically created textfield, the menu works fine except for this problem that my TextFormat is'nt applied. Here is a sample of my code. Any help would be much appreciated as i am pulling my hair out.
PHP Code:
GenerateMenu = function (container, name, x, y, depth, node_xml) {
// variable declarations
var curr_node;
var curr_item;
var curr_menu = container.createEmptyMovieClip(name, depth);
// text format
var menu_fmt:TextFormat = new TextFormat();
menu_fmt.font = "_sans";
menu_fmt.size = 18;
// for all items or XML nodes (items and menus)
// within this node_xml passed for this menu
for (var i = 0; i<node_xml.childNodes.length; i++) {
// movieclip for each menu item
curr_item = curr_menu.attachMovie("menuitem", "item"+(i+1)+"_mc", i);
curr_item.createTextField("name_txt", i, curr_menu["item"+((i-1)+1)+"_mc"].name_txt._width+curr_menu["item"+((i-1)+1)+"_mc"].name_txt._x, 0, 100, 16), curr_item.name_txt.setNewTextFormat(menu_fmt), curr_item.name_txt.selectable=false, curr_item.name_txt.text=curr_node.attributes.name;
curr_item.name_txt.setNewTextFormat(menu_fmt);
curr_item.name_txt.selectable = false;
curr_item._y = y+curr_item._height;
// item properties assigned from XML
curr_node = node_xml.childNodes[i];
curr_item.action = curr_node.attributes.action;
curr_item.variables = curr_node.attributes.variables;
curr_item.name_txt.text = curr_node.attributes.name;
curr_item.trackAsMenu = true;
New TextFormat
I'm trying to set the size of a textfield. Here's the code that's not cutting it:
this.createTextField("money",2,100,50,30,20);
money.textColor="0xFF0000" ;
money.selectable=false;
MyMoney=new TextFormat();
MyMoney.size=40;
MyMoney.font= "Verdana"
money.setTextFormat(MyMoney);
This code, which I got from actionscript bible and other places, is not working...any solutions Flashers? would appreciate an succor...
New TextFormat
I'm trying to set the size of a textfield. Here's the code that's not cutting it:
this.createTextField("money",2,100,50,30,20);
money.textColor="0xFF0000" ;
money.selectable=false;
MyMoney=new TextFormat();
MyMoney.size=40;
MyMoney.font= "Verdana"
money.setTextFormat(MyMoney);
This code, which I got from actionscript bible and other places, is not working...any solutions Flashers? would appreciate an succor...
Textformat
hi,
the static text in my site is all smooth, but dynamic text comes up not so. is this something i have to live with or is there something i can adjust, in textformat or something. my current textformat is as follows:
myformat = new TextFormat();
myformat.color = 0x000000;
myformat.font = "eurostile";
myformat.size = 10
myformat.bold = true
myformat.leading = 5
thanks
TextFormat To And From XML
Hi, I've written a texteditor with which the user can type in text and then select parts of it and add formatting. It adds a new customized TextFormat to every selection.
It works fine, and the next step is to translate the text into XML-format. This is where I'm a bit confused. What is the best format for this? To add a
PHP Code:
<TEXTFORMAT bold='true' italic='false' color='0xff0000' ...>
selected text
</TEXTFORMAT>
for every formatchange? Or would you prefer individual tags like <B></B> using CDATA? How would the translation to/from XML work in that case?
Please share your thoughts/experiences on this!
Textformat Obj Being Ignored
Can anybody see why the following text formatting obj is not being applied to my text fields?
This code is in frame 1 of my _root movie & is called from within a couple nested movie clips with the following script
// Array to store text
var aText:Array = new Array;
var nHeight:Number = 15;
// Add blinking cursor movieclip
var mcRef:MovieClip = this.attachMovie("mcCursor", "mcCursor", this.getNextHighestDepth(), {_x:6, _y:7});
aText.push("blah blah testing etc");
_root.teleType(this, 0, "0xCCFFFF");
I've tried embedding the Verdana font (and obv changing the font name to the linkage name) but this has no effect.
I've also tried including a dynamic text field on the root stage with embedded characters.
Neither makes any difference - a default font is used, with default colour & size.
Any ideas?
//*************************************************************************
// Teletype printing functions ********************************************
//*************************************************************************
//Text formatting object
var tfText:TextFormat = new TextFormat();
tfText.font = "Verdana";
tfText.size = 8;
tfText.align = "left";
//tfText.underline = false;
import flash.filters.GlowFilter;
var gfObj:GlowFilter = new GlowFilter(0x000000, .5, 40, 20);
function teleType(mcRef:MovieClip, nLine:Number, sColour:String):Void
{
var nY:Number = nLine * mcRef.nHeight + 8;
txtRef = mcRef.createTextField("txt"+nLine, mcRef.getNextHighestDepth(), 10, nY, 10, 10);
txtRef.setTextFormat(tfText);
txtRef.embedFonts = true;
//txtRef.filters = [gfObj];
txtRef.ind = 0;
txtRef.line = nLine;
txtRef.autoSize = "left";
//txtRef.textColor = sColour;
txtRef.selectable = false;
txtRef.intRef = setInterval(printText, 100, txtRef, mcRef, sColour);
}
function printText(tRef:Object, tgtRef:MovieClip, sColour:String):Void
{
var nLine:Number = tRef.line;
var nIdx:Number = tRef.ind + 1;
tRef.text = tgtRef.aText[nLine].substr(0, nIdx);
tgtRef.mcCursor._x = tRef._x + tRef._width;
tgtRef.mcCursor._y = tRef._y + 5;
if (nIdx !== tgtRef.aText[nLine].length)
{tRef.ind = nIdx;}
else
{
clearInterval(tRef.intRef);
if (++nLine !== tgtRef.aText.length)
{
teleType(tgtRef, nLine, sColour);
}
}
updateAfterEvent;
}
//*************************************************************************
TextFormat
okay this has me stumped - what have i missed? The textfield isnt formatting to the settings of the textFormat var...
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.display.GradientType;
import flash.geom.Matrix;
import flash.filters.GlowFilter;
public class menuBtn extends Sprite {
private var box:Sprite;
public var myText:TextField;
private var myFormat:TextFormat;
public function menuBtn() {
init();
}
private function init():void {
box = new Sprite();
var matrix = new Matrix();
var colours:Array =[0x000000, 0x000000];
var alphas:Array = [0.9, 0.1];
var ratios:Array = [0, 255];
matrix.createGradientBox(190, 20, Math.PI/2, 0, 0);
box.graphics.beginGradientFill(GradientType.LINEAR, colours, alphas, ratios, matrix);
box.graphics.drawRect(0, 0, 190, 20);
box.graphics.endFill();
addChild(box);
myFormat = new TextFormat;
myFormat.font = "Gautami";
myFormat.color = 0xFFFFFF;
myFormat.size = 200;
myText = new TextField();
addChild(myText);
myText.x = 20;
myText.y = 1;
myText.text = "BUTTON";
myText.autoSize = TextFieldAutoSize.LEFT;
myText.defaultTextFormat = myFormat;
}
}
}
TextFormat
hi,
I have issue with TextFormat;
when I set TextFormat for TextFeild .. dose not appear !!
look at my class :)
at the end line ...
THX..
Attach Code
package {
import flash.display.*;
import flash.geom.*;
import flash.text.*;
public class tooltip extends MovieClip {
function tooltip():void {
}
public function showTip(theText:String,backGColor:Number,borderColor:Number,fnt:String,fntColor:Number) {
if (! theText) {
trace("you must declare a parameter that has a tooltip dada type as created in tooltip class for you ");
} else {
if (! fnt) {
fnt="Arial";
}
if (! fntColor) {
fntColor=0x000000;
}
//-----------------------------------------Config----------------------
var txt_fmt:TextFormat=new TextFormat()
txt_fmt.font = fnt;
var mc:MovieClip=new MovieClip ;
addChild(mc);
var catchtx:TextField=new TextField ;
catchtx.text=theText;
var txWitdh:Number=catchtx.textWidth;
//-----------------------------------------Point(s)--------------------
var p1:Point=new Point(0,0);
var p2:Point=new Point(txWitdh+15,0);
var p3:Point=new Point(txWitdh+15,20);
var p4:Point=new Point(20,20);
var p5:Point=new Point(15,30);
var p6:Point=new Point(10,20);
var p7:Point=new Point(0,20);
//-----------------------------------------drawing---------------------
mc.graphics.lineStyle(2,borderColor,1);
mc.graphics.beginFill(backGColor,1);
mc.graphics.moveTo(p1.x,p1.y);
mc.graphics.lineTo(p2.x,p2.y);
mc.graphics.lineTo(p3.x,p3.y);
mc.graphics.lineTo(p4.x,p4.y);
mc.graphics.lineTo(p5.x,p5.y);
mc.graphics.lineTo(p6.x,p6.y);
mc.graphics.lineTo(p7.x,p7.y);
mc.graphics.lineTo(p1.x,p1.y);
mc.graphics.endFill();
//-----------------------------------------wrting tip------------------
var tipText:TextField=new TextField ;
tipText.text=theText;
tipText.defaultTextFormat = txt_fmt;
tipText.x+=5;
addChild(tipText);
trace(txt_fmt.font);
}
}
}
}
Set TextFormat
Does anybody see why this code doesn't work? It looks identical to other code I've found on Kirupa.
Code:
card.createTextField("terms_txt", 1, 10, 10, 375, 40);
f = new TextFormat();
f.size = 18;
card.terms_txt.setTextFormat(f);
New TextFormat
I'm trying to set the size of a textfield. Here's the code that's not cutting it:
this.createTextField("money",2,100,50,30,20);
money.textColor="0xFF0000" ;
money.selectable=false;
MyMoney=new TextFormat();
MyMoney.size=40;
MyMoney.font= "Verdana"
money.setTextFormat(MyMoney);
This code, which I got from actionscript bible and other places, is not working...any solutions Flashers? would appreciate an succor...
TextFormat
Is this acceptable in AS3?
static var format_regular:TextFormat = new TextFormat(size:Object = 11, color:Object = OxFFFFFF);
Set TextFormat
Does anybody see why this code doesn't work? It looks identical to other code I've found on Kirupa.
Code:
card.createTextField("terms_txt", 1, 10, 10, 375, 40);
f = new TextFormat();
f.size = 18;
card.terms_txt.setTextFormat(f);
How To Use TextFormat.url?
I cannot get TextFormat to assign my dynamic text a url, what am I doing wrong?
this.createTextField("links",1,10,10,250,30);
links.text="New Books @ the Library";
myformat = new TextFormat();
myformat.url = "http://www.weber.edu";
myformat.underline = true;
myformat.color = 0x0000CC;
bIndex=0;
eIndex=links.length;
links.setTextFormat(bIndex,eIndex,myformat);
New TextFormat
I'm trying to set the size of a textfield. Here's the code that's not cutting it:
this.createTextField("money",2,100,50,30,20);
money.textColor="0xFF0000" ;
money.selectable=false;
MyMoney=new TextFormat();
MyMoney.size=40;
MyMoney.font= "Verdana"
money.setTextFormat(MyMoney);
This code, which I got from actionscript bible and other places, is not working...any solutions Flashers? would appreciate an succor...
TextFormat
Is there a way to use TextFormat to underline <a> links in loaded external text AND target Flash Player 6 at the same time? Also, is there a way to use TextFormat.target to specify the target for every link in the external text file? I'd like to eliminate the redundancy of repeating the same thing over and over again.
New TextFormat
I'm trying to set the size of a textfield. Here's the code that's not cutting it:
this.createTextField("money",2,100,50,30,20);
money.textColor="0xFF0000" ;
money.selectable=false;
MyMoney=new TextFormat();
MyMoney.size=40;
MyMoney.font= "Verdana"
money.setTextFormat(MyMoney);
This code, which I got from actionscript bible and other places, is not working...any solutions Flashers? would appreciate an succor...
New TextFormat(); Help
Just when i thought i had sorted one problem another shows it's erie head
Most of yesterday was spent trying to figure out code for change the format of text in an input field. got that SORTED
But now i have discovered that the format is not retained when i submit the form for proccessing, wether it be email form or admin area form sending to db.
I am familiar with using TextFormat(); and the code in the fla is not mine more a combanation of posts that i have read on this subject.
If you download the attach fla and run it set some text to diffrent format then press the view format you will see that the format of the text is not retained
Any help
Cheers
Paul
textformat file
Bug In TextFormat.url? Please Help
I'm trying to build a WYSIWYG editor in MX, which has been made easy up to now by the new TextFormat objects.
However, the TextFormat.url property doesn't seem to work..... If I create a link in a HTML textfield it works fine, but when I try to remove the link (by setting the url to null as is suggested in the Actionscript Dictionary), the hyperlink doesn't get removed!
Code:
_root.linkOn = new TextFormat();
linkOn.url = "http://somewhere";
_root.linkOff = new TextFormat();
linkOff.url = null;
var cFormat = _root.inputText.getTextFormat(5,10);
if(cFormat.url == null)
{
_root.inputText.setTextFormat(5,10,_root.linkOn);
}
else
{
_root.inputText.setTextFormat(5,10,_root.linkOff);
}
Am I doing something wrong, or is this a bug?
Please help..... I was almost there and then this happened!
P.S I've also tried checking and setting the url property to "", but that doesn't work either.
Thanks in advance,
Mark B
http://www.eclectica.nu
TextFormat: The Very Basics
I'm just trying to figure out the textFormat assignment. My example is stupid but it's just to isolate what I'm looking for.
Say I want to write something like:
framboiseframboiseframboiseframboise
The simplest way to do it I thought would be:
normal = new TextFormat();
normal.bold = false;
italic = new TextFormat();
italic.bold = false;
myTextField.setTextFormat(normal);
myTextField.text = myTextField.text+"framboise";
myTextField.setTextFormat(bold);
myTextField.text = myTextField.text+"framboise";
myTextField.setTextFormat(normal);
myTextField.text = myTextField.text+"framboise";
myTextField.setTextFormat(bold);
myTextField.text = myTextField.text+"framboise";
But apparently not... How do I do that?
TextFormat And Hyperlinks
I I was expecting that the following code would have 2 hyperlinks linking to 2 different URLs.
jazzyStyle = new TextFormat();
jazzyStyle.color = 0xFF9977;
jazzyStyle.url = "jazz.html";
bluzyStyle = new TextFormat();
bluzyStyle.color = 0x881122;
jazzyStyle.url = "blues.html";
TF.html = 1;
TF.setNewTextFormat(jazzyStyle);
TF.replaceSel("Jazz
");
TF.setNewTextFormat(bluzyStyle);
TF.replaceSel("Blues");
But it's not the case. they both point to the second URL (Blues.html) although they have a different color. That is not cool I think.
TextFormat Trouble
Does anyone know how to set a negative value (ie. -4) for leading using the textFormat object. I cannot seem to go lower than 0 and the font I'm using has a rather large standard leading.
It is entirely possible to use negative values when manually formatting a text through the properties inspector and I'm somewhat confused since I believed that the properties available through AS had identical behaviors...
thx in advance
idi
TextFormat.lineHeight Or Something?
I can set the height of each letter individually in a text field using textFormat.size, but I need to be able to format the vertical position of the letter too. I don't see the option in the code hints, anyone have any suggestions as to how to do this?
Thanks,
-J
TextFormat Issues
Another short but very sweet question. Here's the code:
Code:
linkText = new TextFormat();
// Set the text to blue
linkText.color = 0x0000FF;
// Below is the line that mucks everything up.
// If you comment it you, everything works,
// except the text in the box just says _level0.txt
this.txt = "Hello";
this.txt.setTextFormat(linkText);
As you can see from the comments, the line:
Code:
this.txt = "Hello"
seems to ignore the advice of the TextFormat and decides to be black rather than blue. Edit the line out, and the text turns blue but just gives a reference to the text variable (_level0.txt).
I never knew bug hunting in 4 lines of code could be so much fun. Anyone got ideas about this?
Help With MX TextFormat Problem, Please
I create a dynamic input text box then apply a format with a TextFormat object, everything works fine, but when i test the movie and navigate throug the fields with the tab key, as soon as the object gets the focus, the format disappears, is it normal?
how do i keep the format???
Thanks in advance!!!
Juan
How Does TextFormat Work?
how does textFormat work? i've seen it mentioned absolutely everywhere in the reference file and it seems to do everything weird and wonderful with text strings, but how exactly do you apply it to a piece of text?
CreateTextField And New TextFormat();
Hello,
I am having trouble identifying the error(s) in my code. I have created a text box and myTextFormat function doesn't seem to operate correctly. I can embed the font, make the box non-selectable and set the variable, but I cannot change the font nor adjust it's size in actionscript. Can someone help?
Code:
this.createTextField ("time_tx",1,385,275,160,20);
time_tx.variable = "dateTime";
time_tx.embedFonts = true;
time_tx.selectable = false;
myTextFormat = new TextFormat();
myTextFormat.bold = true;
myTextFormat.font = "Arial";
myTextFormat.size = 14;
time_tx.setTextFormat(myTextFormat);
Is TextFormat() Like CSS In Html?
Hi,
Just need a quick yes or no. If I define several textFormat objects with say different fonts and colors can you apply these to different text within the same textfield...I'm guessing that if I put text in a text field with format01 and then add more text into the textfield and use format02 that the entire textfield will take on format02.
I don't have time to test this out, so wanted to ask you guys. What I'm looking for is the ability to use the textFormat object somewhat like a cascading style sheet with <span> tags.
thanx,
marcus
Comparing TextFormat
In this code...
fmt = new TextFormat();
fmt.bold = true;
txtObj.text = "Hello";
txtObj.setTextFormat (0, 5, fmt);
fmt1 = txtObj.getTextFormat (0, 3);
fmt2 = txtObj.getTextFormat (3, 5);
trace(fmt1==fmt2);
...why does the trace return false when the two formats are identical? How can I test for identical formating if this doesn't work?
How To Activate TextFormat.url
Hi guys,
I'm trying to use textFormat object to apply a hyperlink to a dynamic text field.
Here's the code:
this.linkText.text="bla"; //linkText is the textField name
linkTextFormat= new TextFormat();
linkTextFormat.url="http://www.yahoo.com";
linkTextFormat.underline=true;
this.linkText.setTextFormat(linkTextFormat);
The undeline appears and if I trace the linkTextFormat.url, it gives me the url, but I can't click on the text itself.
Do I need to do anything else to the text?
Thanks
Textformat Linespacing
Hi guys,
I have to set the linespacing of a text box.
My textformat:
textFormat = new TextFormat();
textFormat.color = "0xFFFFFF";
textFormat.underline = false;
textFormat.bullet= false;
textFormat.size= 8;
textFormat.font= "fff corporate";
What is the parameters for linespacing?
I didn't find it yet.
Thanx
Bye
______________
Noir
Cant Remove TextFormat.url
Hey, im making a simple html editor. i have managed to be able to set hyperlinks in my textbox using textformat.url="http://www.something.com".
but i cant remove them
using stuff like textformat.url=null, or textformat.url="",
the best i can ever get is <href=""
(dont forget im making an html editor, so its the html of the textbox im interested in.)
can anyone help at all? thanks alot.
TextFormat Setting
i have e.g. 50 dyn. txt fields on the stage (not with AS crated) an i need to set up the same TextFormat for this fields.
I created myTextFormat e.g. on 1. frame as usual:
Code:
myTextFormat = new TextFormat();
myTextFormat.font = "Arial"
I tied to set up it for my txt fields which have setting for embed fonts - it works with code above but so not:
Code:
myTextFormat = new TextFormat();
myTextFormat.font = "Verdana"
Why?
I need another special font - if i set it "manualy" on properties pannel it works but with TextFormat Object not.
So i must do it all by hand?
I dont kno any better solution (Fl MX)
;/
jan
TextFormat Problem
Hi friends
I have too questions
First:
I created an input text field in authoring tool (mytext).
myformat=new TextFormat()
myformat.font="Arial"
myformat.text="aaaaa"
myformat.background=true
myformat.backgroundColor=oxff0000
mytext.setTextFormat(myformat)
After running i test that code with trace statement 4 each statement . flash player can detected myformat.font but other properties was omited !(specially text properties!)
------
My other question is about With () that is concern too my previous question
I used these statements 4 above action
with (myformat){
text="aaaa"
font="Arial"
...
}
But again i tested that with trace()
And it just known font property!
Who can help me and answer whats my wrong?
thanx
TextFormat - What Am I Doing Wrong?
Hi - my TextFormat is not being applied to my dynamically created text box - any ideas why?
Code:
var nextDepth = this.getNextHighestDepth();
textboxholder.createTextField("pageTitle", nextDepth, 0, 4.3, 298, 28);
//set formatting of textfield
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xff0000;
my_fmt.font = "Verdana";
my_fmt.size = 9;
my_fmt.align = "right"
textboxholder.pageTitle.setTextFormat(my_fmt);
Looks like I am doing everything right but the formatting isn't being applied. Gotta be something simple. Any ideas?
thanks
frank
AutoSize X TextFormat
Hello guys,
Well, my problem is:
I´m trying to creat a dynamic text box using the autoSize property cause i´ll receive data from a txt file, but if i try to define the font of this text box it do not work.
like this:
musicas="musica1,musica2,musica3,musica4,musica5,m usica6,musica7,musica8";
// style caixa de texto
meu_estilo = new TextFormat();
meu_estilo.color = 0x666666;
meu_estilo.bullet = false;
meu_estilo.underline = false;
meu_estilo.font="verdana";
meu_estilo.size=10;
//cria movie clip vazio e textfiel para receber as variaveis
_root.createEmptyMovieClip("teste2",1);
_root.teste2.createTextField("meutexto",1,10,10,30 0,100);
_root.teste2.meutexto.multiline = true;
_root.teste2.meutexto.wordWrap = true;
_root.teste2.meutexto.html = true;
_root.teste2.meutexto.border=true;
_root.teste2.meutexto.borderColor=0x000000;
_root.teste2.meutexto.autoSize=true;
_root.teste2.meutexto.variable = "musicas";
// Cria o array para receber os nomes das musicas
musVar = new Array();
// Preenche o array
musVar=musicas.split(",");
// Insere os nomes das musicas no textbox do stage
for(i=0; i<musVar.length; i++) {
_root.teste2.musicas=musVar.join("<br>");
}
_root.teste2.meutexto.setTextFormat(meu_estilo);
if you disable the auto size the style work perfectly...how can i use both???
Sorry about my english and thank´s for any help...
TextFormat Not Working
I'm not seeing what's wrong with this TextFormat object -- can someone spot it? It's not picking up the styles at all.
code: createTextField("slide_txt", index, 0, 40, 50, 20);
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Verdana";
my_fmt.size = 10;
slide_txt.text = "Slide " + (index + 1);
slide_txt.setNewTextFormat(my_fmt);
|