Unable To Assign TextFormat To Text Field
Hi,
I used this same method before and it worked:
Declare a TextFormat , create a dynamic text field and then assign the text format to it.
For some reason this is not working on one of the MC’s on my movie, instead of fancy text I get something that looks like default text format (small times new roman fonts). please tell me what I am doing wrong:
Code:
FormatHint = new TextFormat();
FormatHint.color = 0x0000CC;
FormatHint.bullet = false;
FormatHint.font = "courier";
FormatHint.selectable = false;
FormatHint.size = 12;
FormatHint.align = "left";
FormatHint.bold ="true";
_root.MC.createTextField ("hintTextField", 1, -525,-16.5, 520, 120.5)
_root.MC.hintTextField.setTextFormat(FormatHint);
_root.MC.hintTextField.multiline = "true"
_root.MC.text = “Hello”
thnaks,
LeoBeer
FlashKit > Flash Help > Flash ActionScript
Posted on: 11-06-2002, 10:54 PM
View Complete Forum Thread with Replies
Sponsored Links:
Unable To Name The Text Field For A MovieClip Button
I had run a loop that create 5 buttons using the movieclip. But I have a problem. With each button being created, I assigned the text to the text field. All 5 buttons have the same text name instead of different text name for each buttons.
--example--
button 1 - submenu 5
button 2 - submenu 5
button 3 - submenu 5
button 4 - submenu 5
button 5 - submenu 5
--example--
where I want it to be ...
--example--
button 1 - item 1
button 2 - submenu 1
button 3 - item 4
button 4 - item 5
button 5 - submenu 5
--snip--
The code is below...
Code:
var curr_item;
var curr_menu = container.createEmptyMovieClip(name, depth);
for (var i=0; i<node_xml.childNodes.length; i++) {
curr_item = curr_menu.attachMovie("default_button","item"+i+"_mc", i);
curr_item.button_name.text = curr_node.attributes.name;
}
Is there something I should have done differently??? I'm using hte movieclip named "default_button".
Thanks,
FletchSOD
View Replies !
View Related
Assign A Variable To A Dynamic Text Field
I want to assign a variable "speed" to a dynamic text field with the instance "spdDisplay" and round it to two decimal places.
I'm pretty new to flash but, this seems like it should be easy. If someone could help me out I would be extremely grateful.
Here is the code I have - it does not work
Code:
var speed:Number = angle/2.1;
trace(speed.toFixed(2));
spdDisplay.text = (speed);
View Replies !
View Related
Assign OnRelease Event To A Word Within A Dynamic Text Field
Greetings all.
Is this even possible?
What I have is a dynamic textfield which contains text from an array item.
Is it possible to do the following:
Textfield contains: This is my text man.
Now for the interesting part, is there a way to trigger a function by pressing the word 'man' in the text field.
I know this is an odd request, just looking for ideas.
Thanks in advance.....
View Replies !
View Related
Unable To Set Focus To Login Text Field AUTOMATICALLY On Page Load
Hi,
I'm trying to have my flash (AS 2) login page have the username field start blinking right away after the page is loaded but so far, no success.
I've added the following Javascript to the HTML wrapper:
But it still doesnt work. Can anyone help?
See whats happening by clicking here.
Attach Code
<script language="javascript">
<!--
function flashFocus(){
clientArea.focus();
}
//-->
</script>
<body bgcolor="#ffffff" onLoad="window.document.flashFocus();">
View Replies !
View Related
Assign Var To Txt Field
how can assign a variable to a dinamic text field with actionscript?
I want to change the content of the text field on release of my buttons. I have a lot of buttons and i load the variables from an external txtfile.
Thank you.
Noir
View Replies !
View Related
TextFormat Different Sizes Throughout Entire Field
i have a text field that im displaying content that i pull from a db in. the db content is formatted using html tags because it also is used for html pages.
this code popuplates the text field with headers and then body text for that header.
ActionScript Code:
myTextFormat = new TextFormat();
myTextFormat.size = "11";
for (i=0; i<arraySize; i++) {
mc_textContainer.infoText.htmlText += site_para_heading[i];
mc_textContainer.infoText.htmlText += site_text[i];
mc_textContainer.infoText.htmlText += "<br /><br />";
}
mc_textContainer.infoText.setTextFormat(myTextFormat);
the reason its like this is because it is pulling from multiple records in the db and making up one text field in flash. an example is faq. the site_para_header is the question, the site_text is the answer.
what i want is for the headers to be a differnt size than the body. the problem is, i have to appliy the myTextFormat to the field because the font size that is set in the db fields is "1" which is extremely small when you bring it in flash (i think because flash uses sizes relative to CSS).
i tried this:
ActionScript Code:
mc_textContainer.infoText.htmlText += "<font size='12'>" + text[i] + "</font>";
but that formatting gets lost because of the formatting that is in the fields in the db.
any suggestions or am i out of luck on this one?
thanks in advance
View Replies !
View Related
TextFormat Not Working After Adding Field To MovieClip
Hello,
I was just figuring how to use TextFields with TextFormat.
I ran into the following problem. I just copied some code somewhere from Adobe.com just to figure out how it all works. OK, so far so good.
Now what I wanted to do was to dynamically create a TextField and add that to a MovieClip, however, nothing shows up.
I have attached my code, if you comment out the MovieClip part and remove the slashes on line 17 it works fine.
Please help me out! Thanks.
Attach Code
// Create a new instance of the Font1 symbol from the document's library.
var myFont:Font = new Font1();
/* Create a new TextFormat object, and set the font property to the myFont
object's fontName property. */
var myFormat:TextFormat = new TextFormat();
myFormat.font = myFont.fontName;
myFormat.size = 24;
/* Create a new TextField object, assign the text format using the
defaultTextFormat property, and set the embedFonts property to true. */
var myTextField:TextField = new TextField();
myTextField.autoSize = TextFieldAutoSize.LEFT;
myTextField.defaultTextFormat = myFormat;
myTextField.embedFonts = true;
myTextField.text = "The quick brown fox jumped over the lazy dog.";
//addChild(myTextField);
// Create a MovieClip
var movieClip:MovieClip = new MovieClip();
movieClip.x = 0;
movieClip.y = 0;
movieClip.width = 200;
movieClip.height = 50;
movieClip.addChild(myTextField);
addChild(movieClip);
View Replies !
View Related
TextFormat Not Working After Adding Field To MovieClip
Hello,
I was just figuring how to use TextFields with TextFormat.
I ran into the following problem. I just copied some code somewhere from Adobe.com just to figure out how it all works. OK, so far so good.
Now what I wanted to do was to dynamically create a TextField and add that to a MovieClip, however, nothing shows up.
I have attached my code, if you comment out the MovieClip part and remove the slashes on line 17 it works fine.
Please help me out! Thanks.
Attach Code
// Create a new instance of the Font1 symbol from the document's library.
var myFont:Font = new Font1();
/* Create a new TextFormat object, and set the font property to the myFont
object's fontName property. */
var myFormat:TextFormat = new TextFormat();
myFormat.font = myFont.fontName;
myFormat.size = 24;
/* Create a new TextField object, assign the text format using the
defaultTextFormat property, and set the embedFonts property to true. */
var myTextField:TextField = new TextField();
myTextField.autoSize = TextFieldAutoSize.LEFT;
myTextField.defaultTextFormat = myFormat;
myTextField.embedFonts = true;
myTextField.text = "The quick brown fox jumped over the lazy dog.";
//addChild(myTextField);
// Create a MovieClip
var movieClip:MovieClip = new MovieClip();
movieClip.x = 0;
movieClip.y = 0;
movieClip.width = 200;
movieClip.height = 50;
movieClip.addChild(myTextField);
addChild(movieClip);
View Replies !
View Related
TextFormat Not Working After Adding Field To MovieClip
Hello,
I was just figuring how to use TextFields with TextFormat.
I ran into the following problem. I just copied some code somewhere from Adobe.com just to figure out how it all works. OK, so far so good.
Now what I wanted to do was to dynamically create a TextField and add that to a MovieClip, however, nothing shows up.
I have attached my code, if you comment out the MovieClip part and remove the slashes on line 17 it works fine.
Please help me out! Thanks.
Attach Code
// Create a new instance of the Font1 symbol from the document's library.
var myFont:Font = new Font1();
/* Create a new TextFormat object, and set the font property to the myFont
object's fontName property. */
var myFormat:TextFormat = new TextFormat();
myFormat.font = myFont.fontName;
myFormat.size = 24;
/* Create a new TextField object, assign the text format using the
defaultTextFormat property, and set the embedFonts property to true. */
var myTextField:TextField = new TextField();
myTextField.autoSize = TextFieldAutoSize.LEFT;
myTextField.defaultTextFormat = myFormat;
myTextField.embedFonts = true;
myTextField.text = "The quick brown fox jumped over the lazy dog.";
//addChild(myTextField);
// Create a MovieClip
var movieClip:MovieClip = new MovieClip();
movieClip.x = 0;
movieClip.y = 0;
movieClip.width = 200;
movieClip.height = 50;
movieClip.addChild(myTextField);
addChild(movieClip);
View Replies !
View Related
Trying To Pass Text From Form Text Field To A Flash Dynamic Text Field
Hi, I was hoping someone might enlighten me as to how/if I can do this...
Currently I'm using javascript which works fine to pass text from textfield A to textfield B:
Code:
window.onload=function()
{
document.forms.form1.shirtText.value=document.forms.form1.KitGroupID_16_TextOption_38.value
}
Is there a way to pass the textfield A text to a dynamic text input (flash) as I'd like to use the font embedding flash offers. I can make it work when loading a value from a txt file but I'm not sure how to access the value identified above as KitGroupID_16_TextOption_38 and make it appear in a dynamic input box. Eventually I might want to have 3 font choices for the user but I'd like to just see if I can get this working properly first.
Your help/advice would be greatly appreciated,
-Scott
View Replies !
View Related
TextFormat Not Formating My Text... Why?
This is not styling my text. What am I doing wrong?
Thank you!!!
this.textScroll.createTextField("my_txt", this.getNextHighestDepth(), 0, 0, 255, 200);
textScroll.my_txt.multiline = true;
textScroll.my_txt.html = true;
textScroll.my_txt.embedFonts = false;
textScroll.my_txt.wordWrap = true;
textScroll.my_txt.autoSize = "left";
textScroll.my_txt.condenseWhite = true;
var tFormat_tf:TextFormat = new TextFormat();
tFormat_tf.bold = true;
tFormat_tf.italic = true;
textScroll.my_txt.setTextFormat(tFormat_tf);
var loadText_lv:LoadVars = new LoadVars();
var textDocPath:String = "../txt/curriculum_vitae.txt";
loadText_lv.load(textDocPath);
loadText_lv.onLoad = function(success) {
if (success) {
// trace(success);
textScroll.my_txt.htmlText = this.myText;
} else {
textScroll.my_txt.text = "Error connecting to server.";
}
};
View Replies !
View Related
TextFormat And Tweened Text
has anybody been able to apply a TextFormat object with a change of font to a TextField in a MovieClip that is going to tween? I've been trying without success. What happens is that the symbol disapears if you apply alpha tweens or tweens that "flip" or rotate. However I have noticed some interesting points; Color changes to the TextField and things like bold etc work fine.Its font that causes problems. Also with tweens Scaling works ok as does simple movement. However certain tweens which unfortunately I have to use create problems. My goal for this is to develop a customisable "Text Tweening" Component so any help appreciated because at the moment the user is stuck with the fonts I specify.
View Replies !
View Related
TextFormat Not Formating My Text... Why?
This is not styling my text. What am I doing wrong?
Thank you!!!
this.textScroll.createTextField("my_txt", this.getNextHighestDepth(), 0, 0, 255, 200);
textScroll.my_txt.multiline = true;
textScroll.my_txt.html = true;
textScroll.my_txt.embedFonts = false;
textScroll.my_txt.wordWrap = true;
textScroll.my_txt.autoSize = "left";
textScroll.my_txt.condenseWhite = true;
var tFormat_tf:TextFormat = new TextFormat();
tFormat_tf.bold = true;
tFormat_tf.italic = true;
textScroll.my_txt.setTextFormat(tFormat_tf);
var loadText_lv:LoadVars = new LoadVars();
var textDocPath:String = "../txt/curriculum_vitae.txt";
loadText_lv.load(textDocPath);
loadText_lv.onLoad = function(success) {
if (success) {
// trace(success);
textScroll.my_txt.htmlText = this.myText;
} else {
textScroll.my_txt.text = "Error connecting to server.";
}
};
View Replies !
View Related
TextFormat And Tweened Text
has anybody been able to apply a TextFormat object with a change of font to a TextField in a MovieClip that is going to tween? I've been trying without success. What happens is that the symbol disapears if you apply alpha tweens or tweens that "flip" or rotate. However I have noticed some interesting points; Color changes to the TextField and things like bold etc work fine.Its font that causes problems. Also with tweens Scaling works ok as does simple movement. However certain tweens which unfortunately I have to use create problems. My goal for this is to develop a customisable "Text Tweening" Component so any help appreciated because at the moment the user is stuck with the fonts I specify.
View Replies !
View Related
How Do I Assign A URL To Text?
I have to make some changes to some Flash files that have the wrong URLs linked. I have a box such as:
The first three lines of text can each be selected using the Arrow Tool, which gives me a blue bordered box around the text, and in the Properties appears a box whereby I can target the URL where I would like the click to lead.
The last two lines do not allow me to select them at all. I can click anywhere on the text, and nothing gets selected. How can I draw a box around these two lines of text and be able to target a URL to each line?
View Replies !
View Related
Assign Url To Text
I am attempting to edit a purchased Flash Template. The text "buy now" is located within a movie clip. When I select the text and assign a url in the propeties inspectory, nothing happens. When I try to assign a link using action script the entire movie clip becomes a link and redirects to the URL upon rollover.
I simply want the words "BUY NOW" within the movie clip to link to an external URL does anyone have an answer for this problem?
Thanks in advance!!!!
View Replies !
View Related
Problems With TextFormat With Dynamic Text --help
Hello- this seems like it should be so simple. Can someone please tell me what I'm doing wrong. I've got a dynamic text box which calls out to an external text file for it's contents. The text comes in just fine except that it is left justified. I've written some code using TextFormat to try and force it to be centered within the text box but with no luck. I don't understand what's wrong with my code. Any help is appreciated... here's the file - it's zipped because there are 2 files.
thanks
tony
View Replies !
View Related
MC W/ Dynamic Text Using TextFormat AS Not Working
Hello,
I was hoping someone could lend a thought on this problem:
I have 3 MCs which have dynamic text property. The 2 instances are completed properly. The site includes a shared library which has one font in it:Georgia. The web page which includes the MCs has the font linked. The font has been set up in the shared library, i.e., "Linkage Property". All 3 options in this property are selected and the url is "sharedlib.swf. (just in case anyone is wondering about the font setup).
The problem is this. I am using the following code to establish submenu activity. When the page is published and opened into the "master" web page, the MCs do not work. The initial text is present, however there is no activity on rollover, rollout, etc.
I have spent several hours reviewing syntax and help sites with no luck.
I would really appreciate anyone's thoughts. Peace.
//Create TextFormat object that defines the states of the sub-menu options
var optionDisable:TextFormat = new textFormat("Georgia", 15, null, true, true);
var optionEnable:TextFormat = new textFormat("Georgia", 13, null, false, false);
// Disable the sub-menu option that corresponds to the currently loaded section
this.AboutUs_MC.myText.setTextFormat(optionDisable );
this.AboutUs_MC.enabled = false;
// -----------<About_Us option>----------------- \
this.AboutUs_MC.onRollOver = function() {
this.myText.setTextFormat(optionDisable);
}
this.AboutUs_MC.onRollOut = function() {
this.myText.setTextFormat(optionEnable);
}
// -----------</About_Us option>----------------- \
// -----------<RMP Staff option>----------------- \
this.RMPStaffMC.onRollOver = function() {
this.myText.setTextFormat(optionDisable);
}
this.RMPStaffMC.onRollOut = function() {
this.myText.setTextFormat(optionEnable);
}
this.RMPStaffMC.onRelease = function() {
this.myText.setTextFormat(optionDisable);
this.enabled = false;
}
// -----------</RMP Staff option>----------------- \
// -----------<Projects option>----------------- \
this.ProjectsMC.onRollOver = function() {
this.myText.setTextFormat(optionDisable);
}
this.ProjectsMC.onRollOut = function() {
this.myText.setTextFormat(optionEnable);
}
this.ProjectsMC.onRelease = function() {
this.myText.setTextFormat(optionDisable);
this.enabled = false;
// -----------</Projects option>----------------- \
View Replies !
View Related
My TextFormat Disappears When I Change The Text
I'm making a textfield that shows some messages from my game. Like a console I guess.
However it seems to lose the textFormat I've set for it whenever I change the .text property of the textfield, which is everytime I give it a new message.
The "Loading..." shows in the nice pink verdana it's set to but after that when I change .text it becomes the default size 8 or 9 white font.
I found a way to solve it kinda which is setting the textFormat again after every time I change the text but that seems pretty stupid. Why does it lose the textformat?
Code:
format.color = 0xff00ff;
format.font = "Verdana";
format.bold = true;
format.size = 9;
tfM.textColor = 0xFFFFFF;
tfM.x = 15;
tfM.y = 353;
tfM.selectable = false;
tfM.text = "Loading...";
tfM.width = 300;
addChild(tfM);
tfM.setTextFormat(format);
View Replies !
View Related
Text Issues: HTML Vs. TextFormat
I have a dynamic textfield with dimensions that cannot be changed. Sometimes, the only way to squeeze in all the copy is to change the font size. Ii know how to do this via textFormat, but not via HTML.
Certain words need to be underlined. I know how to do this via HTML, but not textFormat. I see that there is a 'textFormat.underline' command, but all attempts with it have failed.
If it matters, the text source is an XML document.
Any help would be deeply appreciated.
Thanks in advance,
Paul
View Replies !
View Related
External Text File And TextFormat
I'm trying to load data from an external text file into a text area and then have it formated according to my specification using textFormat. How do I go about doing so? currently text that is already in the text box gets formatted...not the text that gets imported.
View Replies !
View Related
Maximum Text Size For TextFormat
Afternoon everyone,
I am working on an application in which text is created dynamically. I seem to be experiencing a maximum size of 130 when using textFormat. I cannot seem to find any references to this limit. Is there a way to get around it?
So far my only resolution is to create a smaller text field within a movieClip and then scale the movieClip. This moves the text of the pixel location that I need it however.
Any help with this would be very much appreciated.
Cheers,
Michael
View Replies !
View Related
TextField + TextFormat => Text Does Not Show Even Though Is There
i am trying to make a function to deal easily with text formatting. there seems to be a problem as the text in the textfield is not visible. all the parameters and attributes are set properly when i trace, i can even copy the text from the textfield, but i cannot see it.
Code:
/**
* Description
* @author Mat Janson Blanchet
* @version 0.1
*/
package {
// imports
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFormat;
// class definition
public class Main extends MovieClip {
// variables
// constructor
public function Main () {
var textfield:TextField = new TextField ();
var text:String = "<p>some paragraph 01</p><p>some paragraph 02</p><p>some paragraph 03</p>";
format (text, textfield, { width:160, height:80, selectable:true, multiline:true, border:true }, false, { font:"_arial", size:16, color:0x000000 } );
addChild (textfield);
}
// events
// functions
public function format (
text :String, // text to display
textfield :TextField, // textfield to target
textfieldParams :Object, // textfield parameters
textfieldIsHTML :Boolean, // whether or not the textfield should display in html
formatParams :Object // format parameters
) :void {
trace ("textfield parameters: ");
// loop through the parameters name and associate the proper value to the textfield
for (var txtfldParamName:String in textfieldParams) {
textfield[txtfldParamName] = textfieldParams[txtfldParamName];
trace (textfield + "[" + txtfldParamName + "] = " + textfieldParams + "[" + txtfldParamName + "]");
trace ("textfield[txtfldParamName]: " + textfield[txtfldParamName]);
trace ("textfieldParams[txtfldParamName]: " + textfieldParams[txtfldParamName]);
}
trace ("textfield: " + textfield)
trace ("");
trace ("format parameters: ");
// loop through the parameters name and associate the proper value to the textfield
var format:TextFormat = new TextFormat ();
for (var fmtParamName:String in formatParams) {
format[fmtParamName] = formatParams[fmtParamName];
trace (format + "[" + fmtParamName + "] = " + formatParams + "[" + fmtParamName + "]");
trace ("format[fmtParamName]: " + format[fmtParamName]);
trace ("formatParams[fmtParamName]: " + formatParams[fmtParamName]);
}
trace ("format: " + format);
trace ("");
trace ("textfieldIsHTML: " + textfieldIsHTML);
trace ("text: " + text);
// input text into textfield
if (!textfieldIsHTML) {
textfield.text = text;
trace ("textfield.text: " + textfield.text);
} else {
textfield.htmlText = text;
trace ("textfield.htmlText: " + textfield.htmlText);
}
textfield.embedFonts = true;
trace ("textfield.embedFonts: " + textfield.embedFonts);
textfield.setTextFormat (format);
}
}
}
does anyone know what i forgot or did not do right? i also enclosed the fla and the as if it helps anyone
View Replies !
View Related
Formatting Dynamic Text Using TextFormat
Hi everyone, I've managed to get my data loaded, and as you can see, some bold text courtesy of limited html tags.
I recently came across the "textFormat" object and it's properties, specifically, I want to be able to use the "textFormat.tabStops" property to set custom tab spacing for the dynamic text so that I can create nice clean coloumns of text. Can this be done using this object and property set? If so, what am I doing wrong that it doesn't work?
http://www.sdcooper.com/show_dates.htm
Code:
// Data Loader
loadVarsText = new loadVars();
// Load Data from this file
loadVarsText.load("shows.txt?RND="+random(999));
// Confirm the data is loaded
loadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
// Data is loaded
// set the Text Field to display as HTML
scroller.html = true;
scroller.multiline = true;
// use TextFormat to set Custom Tab Stops
newsFormat = new textFormat();
newsFormat.tabStops = 6;
scroller.setTextFormat(newsFormat);
scroller.getTextFormat(this.textfield);
// set the Text Field to variable contents
scroller.htmlText = this.textfield;
} else {
trace("not loaded");
}
};
Thanks,
Michael Wisniach
3rd Cherry Designs
www.3rdcherry.com
View Replies !
View Related
Another Dynamic Text Problem- TextFormat
OK Sorry about this guys but here goes,
I have created a clock that gets updated every second using the setInterval command.
Now this clock is part of a Bios simulator so my students must be able to change its value.
On most Bios systems when the part of the clock is selected, the type goes a different colour as does its background.
I can simulate the background changing but the textformat gets over-rided by my clock update even though there is no textformatting data in the update.
I know the code is poor but this is the clock update code
ActionScript Code:
addSec = function () {
MyClock.Sec += 1;
if (MyClock.Sec == 60) {
MyClock.Sec = 0;
MyClock.Min += 1;
}
if (MyClock.Min == 60) {
MyClock.Min = 0;
MyClock.Hour += 1;
if (MyClock.Hour == 24) {
MyClock.Hour = 0;
MyClock.Day += 1;
if (MyClock.Day>MyClock.MDays) {
MyClock.Day = 1;
MyClock.Month += 1;
if (MyClock.Month == 13) {
MyClock.Month = 1;
MyClock.Year += 1;
if (MyClock.Year == 100) {
MyClock.Year = 0;
MyClock.Cent += 1;
if (MyClock.Cent=21) {
MyClock.Cent = 19;
}
}
}
MyClock.Mdays = MyClock.MonthArr[this.ClockM-1][1];
}
}
}
trace(MyClock.Hour+":"+MyClock.Min+":"+MyClock.Sec);
if (MyClock.Sec == 0) {
ClockSec.theText.text = "00";
} else if (MyClock.Sec<10) {
ClockSec.theText.text = "0"+MyClock.Sec;
} else {
ClockSec.theText.text = MyClock.Sec;
}
if (MyClock.Min == 0) {
ClockMin.theText.text = "00:";
} else if (MyClock.Min<10) {
ClockMin.theText.text = "0"+MyClock.Min+":";
} else {
ClockMin.theText.text = MyClock.Min+":";
}
if (MyClock.Hour == 0) {
ClockHour.theText.text = "00:";
} else if (MyClock.Hour<10) {
ClockHour.theText.text = "0"+MyClock.Hour+":";
} else {
ClockHour.theText.text = MyClock.Hour+":";
}
if (MyClock.Day<10) {
theDayMC.theText.text = "0"+MyClock.Day;
} else {
theDayMC.theText.text = MyClock.Day;
}
var tempMonth = MyClock.MonthArr[MyClock.Month][0];
tempMonth = tempMonth.slice(0, 3);
theMonthMC.theText.text = tempMonth;
if (MyClock.Year<10) {
theYearMC.theText.text = "0"+MyClock.Year;
} else {
theYearMC.theText.text = "0"+MyClock.Year;
}
theCentMC.theText.text = MyClock.Cent;
var tempYear = theCentMC.theText.text+theYearMC.theText.text;
theDate = new Date(tempYear, MyClock.Month, MyClock.Day);
var theDay = MyClock.WeekArr[theDate.getDay()];
theDay = theDay.slice(0, 3);
weekdayMC.theText.text = theDay;
};
and this is the changing text colour code
ActionScript Code:
elect = function (targetID) {
mycolour = new Color(targetID.base);
mycolour.setRGB(0xFFFFFF);
mytext = new TextFormat();
mytext.color = 0x0000FF;
targetID.btext.setTextFormat(mytext);
};
any ideas
ta
zen
View Replies !
View Related
Displaying Text W/ TextFormat And TextField
i have a movie clip named goButton, that executes the drawText method. it works just fine when i input in some text as with the string delimiters " " but i also have an input textfield on the _root that allows the user to input text called myInput. when you click on go for the text to display it just prints out the absolute location _level0.myInput. does anyone know what i am doing wrong. it is suppose to print out what ever the user enters.....
heres all the script which goes on the first frame of the timeline
//movie clip goButton event action
goButton.onPress = function() {
drawText(_root.myInput);
};
input = "DISPLAY THIS TEXT";
function drawText(chars) {
depth++;
numText = 10;
startSize = 100;
textX = 300;
textY = 150;
depth = 1000;
currentColor = 0xff0000;
// --- set text format
myTextFormat = new TextFormat();
myTextFormat.bold = false;
myTextFormat.size = 100;
myTextFormat.color = currentColor;
myTextFormat.italic = false;
myTextFormat.font = "eurostile";
// --- end text format
for (i=1; i<=numText; i++) {
_root.createTextField("text"+i, 500, textX, textY, startSize, startSize);
myTextField = _root["text"+i];
input = myTextField.text;
myTextField.text = chars;
myTextField.border = false;
//myTextField.embedFonts = true;
//myTextField.selectable = false;
myTextField.setTextFormat(myTextFormat);
}
}
drawText(input);
View Replies !
View Related
Unable To Change The Text Of The Textfield.
I have three textfields with instance name "Text1", "Text2", and "Text3". The following code does not work for me.
Code:
var a:Number;
for(a=1;a<=3;a++){
"Text" + a.text = "Hello";
}
How to make it work? Please do not tell me to use the actionscript like Text1.text = "Hello". I don't want to use this. I only want to set the text of three of the textfields to "Hello" by using loop.
View Replies !
View Related
Unable To View Text In My Textfield
I am able to rotate my textfield dynamically but my text has disappeared even though i have embeded the font and color.
here is the code
some_tf = new TextFormat();
some_tf.font = "myVerdana";
some_tf.size = 24;
this.createTextField("tfNewfield",1,10,10,150,30);
tfNewfield.text = "here comes the text";
tfNewfield.setTextFormat(some_tf);
tfNewfield.border = true;
tfNewfield.embedFonts = true
tfNewfield._rotation = 90;
Please help!!!!
Thanks in Advance
View Replies !
View Related
Unable To View Text In My Textfield
I am able to rotate my textfield dynamically but my text has disappeared even though i have embeded the font and color.
here is the code
some_tf = new TextFormat();
some_tf.font = "myVerdana";
some_tf.size = 24;
this.createTextField("tfNewfield",1,10,10,150,30);
tfNewfield.text = "here comes the text";
tfNewfield.setTextFormat(some_tf);
tfNewfield.border = true;
tfNewfield.embedFonts = true
tfNewfield._rotation = 90;
Please help!!!!
Thanks in Advance
View Replies !
View Related
Assign Int Value To Dynamic Text
Don't know why I can't update a Dynamic Text object with int value( it should have converted to String).
My code is simple.
It change the content to a String variable which is concat of strings and int. The strange thing is that I can trace() the correct value in the output window but the text displayed is just the string part. If i try to assign int to the score.text directly, it display nothing. I am sure the code do modify the text of the object because the original text is "Score:"
ScreenShot here
Attach Code
i++;
var score:String = "Hello " + i.toString() + "World"+123;
score = score.toUpperCase();
trace( score );
View Replies !
View Related
Dynamically Created Text Fields & TextFormat
Can anyone spot where I have gone wrong with the textFormat. The fields answer1 and 2 get created but won't take the answerFormat. They appear as the default settings.
code: //Create stage elements
this.createEmptyMovieClip("container1",1);
this.createEmptyMovieClip("container2",2);
this.createTextField("answer1", 3, 173, 290.4, 310, 150);
this.createTextField("answer2", 4, 173, 101.6, 310, 150);
//Assign properties to stage elements
answerFormat = new TextFormat();
answerFormat.font = "Arial";
answerFormat.size = 18;
answerFormat.bold = true;
with(container1){
_x=30,
_y=250,
attachMovie("salesPerson1", "sales", 1);
}
with(container2){
_x=500,
_y=100,
attachMovie("customer1","customer",1);
}
with(answer1){
multiline = true,
wordWrap = true,
html = true,
embedFonts = false;
}
answer1.setTextFormat(answerFormat);
with (answer2){
multiline = true,
wordWrap = true,
html = true,
embedFonts = true;
}
answer2.setTextFormat(answerFormat);
//Build Arrays
loadText = new LoadVars();
loadText.load("rolePlay1.txt");
loadText.onLoad = function(success){
if(success){
preTextArray = loadText.comments;
textArray = preTextArray.split("~");
}
}
letters = new Array("", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "y", "z");
//Set initial properties and variables
i=0;
container2._alpha = 50;
answer1.htmlText = "Hi, how are you?"
I have read posts and the help section on this subject and it seems like I am doing things the right way, but it won't work.
Thanks for the help.
_t
View Replies !
View Related
TextFormat Being Reset When Changing The Dynamic Text
Hello,
I have a countdown running on onEnterFrame at the root level. I also have a button when clicked changes the color of the countdown text. However, when changing the color it flashes to the new color for a split second then back to the original color. If I disable the countdown the color changes like it should. Here is some of the code:
//Countdown is a MC
//CountdownText is an instance name of a dynamic text field inside the Countdown MC
var CountdownFormat:TextFormat = new TextFormat();
CountdownFormat.size = 30;
Countdown.CountdownText.setTextFormat(CountdownFor mat);
this.onEnterFrame = function() {
currentDate = new Date();
currentMillisecs = currentDate.getTime();
this.msecs = eventMillisecs - currentMillisecs;
if (this.msecs <= 0) {
play();
return;
}
this.secs = Math.floor(this.msecs / 1000);
this.mins = Math.floor(this.secs / 60);
this.hours = Math.floor(this.mins / 60);
this.days = Math.floor(this.hours / 24);
this.msecs = String(this.msecs % 1000);
this.secs = String(this.secs % 60);
this.mins = String(this.mins % 60);
this.hours = String(this.hours % 24);
this.days = String(this.days);
while (this.msecs.length < 3) {
this.msecs = "0" + this.msecs;
}
if (this.secs.length < 2) {
this.secs = "0" + this.secs;
}
if (this.mins.length < 2) {
this.mins = "0" + this.mins;
}
if (this.hours.length < 2) {
this.hours = "0" + this.hours;
}
while (this.days.length < 3) {
this.days = "0" + this.days;
}
Countdown.CountdownText.text = this.days + "." + this.hours + "." + this.mins + "." + this.secs + "." + this.msecs;
};
//Clicking the color button fires off this function
function ChangeColor(SwatchColor){
CountdownFormat.color = SwatchColor;
Countdown.CountdownText.setTextFormat(CountdownFor mat);
}
If I comment the last line of the onEnterFrame function it changes the color. If I don't it changes for a split second then resets.
Any help would greatly be appreciated.
Thanks,
Steve
View Replies !
View Related
Variable Property For A Dynamic Text And TextFormat
I am applying a textformat to a bunch of dynamic text fields. The problem is that doing this involves an ugly for loop. Anyway, I noticed that as I highlighted all of my textfields there was still the var property so I was wondering if I can select all of my textfields that I want to apply my textformat to, give them a variable name of say txtGroup and then say txtGroup.setTextFormat(something);
This doesn't work when I tested it, but is there a way to do it like this. Does anybody know if this works or is this a pipe dream?
Thanks.
View Replies !
View Related
Add Text Within Textfield At SelectionBeginIndex, Without Losing The TextFormat
Hi
I am trying to insert a special character (such as Delta) within a textfield. I can use selectionBeginIndex to find the position to add the text. However, I can't find a way to add the character to that point in the textfield? At present I have the following code:
startofText = tf.text.substr(0, cursor) + newText;
// this gets all text up until the point of which to insert the new character or word. I then add the additional text (newText)
remainingText = tf.text.substr(cursor+Math.ceil(sym.length),tf.tex t.length);
// this variable stores the text remaining after the new character or word.
tf.text = startofText + remainingText; //
I then add the two strings together to complete the new string, which includes the new character or word at the point the user click or selected using selectionBeginIndex.
The problem with this method is that I lose all formatting gained from the following code:
tf.setTextFormat(Super, startNum, endNum);
Because the string is new it wipes out any formating I had in place. Is there a way to add a character or word to a textfield without replacing the whole string and losing my formatting?
Thanks
View Replies !
View Related
Font Property Of Flash.text.TextFormat
The font property of flash.text.TextFormat is defined as a string.
ActionScript Code:
var tf:TextFormat = txt1_ui.getTextFormat(s,e);
Dumper.info(tf.font);
tf.font = tf.font+"---";
Dumper.info(tf.font);
the output:
King's Ransom Light
King
ActionScript Code:
var str:String = "King's Ransom Light";
var tf2:TextFormat = new TextFormat();
tf2.font = "King's Ransom Light";
Dumper.info(str);
Dumper.info(tf2.font);
the output:
King's Ransom Light
King
I assume something funny is going on in the TextFormat set method, but I don't have access to that. This has been an infuriating two hour odyssey thus far.
View Replies !
View Related
Dynamic Text Fields And TextFormat Issues
So I'm building a business card app. There are dynamically created input text fields in the left interface. Their default font is in Arial. Then in the Center Pane, I attach the empty BusinessCard (myCard). this symbol has an empty movieclip on each layer to hold backgrounds, text, and then images. Inside myCard's empty movieclip for the textfields, I attach movie clips with dynamic text fields to serve as output textfields. I have shared in fonts called myArial-Bold and have set these output textfields to myArial-Bold.
This loads up fine, fontwise.Then i have whatever is in the input textfields go to the output textfields.
The output textfeld's font format gets overwritten to the default Arial font. Ok, so I use TextFormat to try to set it back to Arial-Bold, and it will not respond. It keeps the arial font.
The line that causes all this trouble:
newOutputPanel.output_txt.text = newPanel.input_txt.text;
I thought this would only bring over the text, not the format! Anyone else get this problem?
Attach Code
// in the root timeline
function addPanel() {
var newPanel = _root.LftPanel_mc.attachMovie("interface-section", "Panel" + panelNum, panelNum, {_x:0, _y:panelY});
newPanel.mylabel_txt.text = txtFields[i];
newPanel.input_var = txtFields[panelNum];
aInput.push (newPanel);
var newOutputPanel = Pane.myTxtBound_mc.attachMovie("myOutputTxt","Output" + panelNum,panelNum,{_x:0, _y:outputY});
newOutputPanel.output_txt.text = newPanel.input_txt.text;
var myFmt:TextFormat = newOutputPanel.output_txt.getTextFormat();
myFmt.font = "myArial-Bold";
myFmt.size = 20;
newOutputPanel.output_txt.setTextFormat(myFmt);
newOutputPanel.output_txt.setNewTextFormat (myFmt);
aOutput.push (newOutputPanel);
}
// in the input movieclip
myName = this._name;
var my_array:Array = myName.split("l"); //This is an "L"
myNum = my_array[1];
this.input_txt.onChanged = function(textfield_txt:TextField) {
varToChange = eval("_root.Pane.myTxtBound_mc.Output" + myNum);
var tfFormatter:TextFormat = varToChange.output_txt.getTextFormat();
Trace(tfFormatter.font);
varToChange.output_txt.text = textfield_txt.text;
varToChange.myHighlight._width = varToChange.output_txt._width;
varToChange.myHighlight._height = varToChange.output_txt._height;
_root.myOutputField = varToChange;
varToChange.output_txt.setTextFormat(tfFormatter);
Trace(tfFormatter.font);
};
// in the output movieclip
myFmt.font = "myArial-Bold";
this.output_txt.setTextFormat(myFmt);
this.output_txt.setNewTextFormat (myFmt);
this.onPress = function() {
this.startDrag();
_root.myOutputField = this;
var myFmt = this.output_txt.getTextFormat();
trace(myFmt.font);
//for (var prop in myFmt) {
//trace(prop+": "+myFmt[prop]);
//}
}
this.onRelease = function() {
this.stopDrag();
}
this.onEnterFrame = function() {
if (_root.myOutputField == this){
this.myHighlight._visible = true;
}else {
this.myHighlight._visible = false;
}
}
View Replies !
View Related
Using TextFormat() On Dynamic Text Instance Within A Button
I've created a button with instance btn_On on stage in the main timeline. The text "On" in the button's timeline in the Up state is dynamic with instance txt_On. I'm having trouble changing the text's properties as I can't navigate to it using dot syntax. I've created a simple trace() statement to see if txt_On is recognized using the code below, but the Output window says "undefined." How do I get this to work?
trace(btn_On.txt_On);
To change the color of txt_On in the Up state of btn_On, I use the following code, but it does not work:
Attach Code
var myTextOn:TextFormat = new TextFormat();
myTextOn.color = 0x000000;
btn_On.txt_On.setTextFormat(myTextOn);
View Replies !
View Related
[FMX04] HELP For TextFormat And Input Text Fields
Can anyone help with this? I am trying to create a TextField, set its type property to "input," set its format via the TextFormat object, and allow the user to add a label to a movieclip.
Assume you have a button named b_add, and you assign it this code on the main timeline:
Code:
_root.b_add.onRelease = function () {_root.createTextField("myLabel", 10, -38, -15, 76, 29.7);
_root.myLabel.type = "input";
_root.myLabel.text = "insert label";
_root.myLabel.wordWrap = true;
labelFormat = new TextFormat("Verdana", 10, 0x525252);
labelFormat.align = "center";
_root.myLabel.setTextFormat(labelFormat);
Selection.setFocus(_root.myLabel);
}
The TextField that gets created loses all of its formatting once the user starts typing. It reverts to Time New Roman and doesn't wrap. Do I have something out of order? Should I approach the problem with another solution?
View Replies !
View Related
Textformat: New Input Text Isnt Formatted
I've applied a textFormat to an input Field, which I created dynamically. Everything is just fine, except if the user clicks onthe field and adds text to the end of it, the formatiing does not apply to the new text. It does apply to text added in the middle of already formatted text. It seems like the formatting is not applied to the field, but to the text that happens to be in the field when you apply the formatting. Is there a way around this? Thanks.
Dave
View Replies !
View Related
[FMX04] HELP For TextFormat And Input Text Fields
Can anyone help with this? I am trying to create a TextField, set its type property to "input," set its format via the TextFormat object, and allow the user to add a label to a movieclip.
Assume you have a button named b_add, and you assign it this code on the main timeline:
Code:
_root.b_add.onRelease = function () {_root.createTextField("myLabel", 10, -38, -15, 76, 29.7);
_root.myLabel.type = "input";
_root.myLabel.text = "insert label";
_root.myLabel.wordWrap = true;
labelFormat = new TextFormat("Verdana", 10, 0x525252);
labelFormat.align = "center";
_root.myLabel.setTextFormat(labelFormat);
Selection.setFocus(_root.myLabel);
}
The TextField that gets created loses all of its formatting once the user starts typing. It reverts to Time New Roman and doesn't wrap. Do I have something out of order? Should I approach the problem with another solution?
View Replies !
View Related
Trouble Formatting Text With TextFormat Method
Hi there,
I'm loading in data from an XML file and then creating indivdual text fields for each piece of data.
I'm then trying to format the style of the data using the TextFormat method, but for some reason the text stays un-formatted and it's driving me nuts as I (typically) have a urgent deadline to get this sorted.
Any help would be appreciated, my code is below.
Many thanks.
M.
Code:
// create loader object for loading the tickertape XML
var loader:URLLoader = new URLLoader(new URLRequest("ticker.xml"));
loader.addEventListener(Event.COMPLETE, xmlDownloaded);
// this will be instantiated and duplicated for each item
var tf:TextField;
// set TextField's format properties such as font colour, size, weight
var myFormat:TextFormat = new TextFormat();
myFormat.font = "Arial";
myFormat.color = 0x0000FF;
myFormat.size = 20;
// this will keep track of the position of the article links
var pos:int = 0;
function xmlDownloaded(e:Event):void
{
// store the loaded XML data
var xmlData:XML = new XML(e.target.data);
//trace(xmlData.article.length());
for each (var item:XML in xmlData.children())
{
createLink(item.title, item.url)
}
for each (var item:XML in xmlData.children())
{
trace(item);
}
}
function gotoURL(e:MouseEvent):void
{
var url:URLRequest = new URLRequest(e.target.name);
navigateToURL(url,"_self");
}
function createLink(t,u):void
{
// create a new TextField that will act a link for the current article
tf = new TextField();
tf.name = u;
tf.text = t;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.background = true;
tf.backgroundColor = 0xff00ff;
tf.x = pos;
// assign the above formatting to the text field
tf.defaultTextFormat = myFormat;
// add the TextField to the display list
addChild(tf);
// add event listener to trigger function when story is clicked on
tf.addEventListener(MouseEvent.CLICK, gotoURL);
// increase the position for each TextField
pos += tf.width + 10;
}
View Replies !
View Related
Unable To See Formatting From External Text File
I have a flash site that I have built, and it contains dynamic text areas that load information for a text file. It is able to load the information fine, however, when I apply formating such as bold or italic tags, it does not work. I checked to make sure I had HTML check in the "Text Options" pane, but it was already checked. I then noticed something very odd. It does not work on my Windows computers, but works fine on my Linux computer running Netscape 4.7. Could this be an issue, or am I just missing something.
The site is http://fs.mmwa-sicw.com
Any help would be greatly appreciated.
View Replies !
View Related
Unable To Load Variable From A Text File
i am unable to load variable from a text file located in the same directory as the .swf file. here is the code:
myLoadVar = new LoadVars();
myLoadVar.load("updates.txt");
myLoadVar.onLoad = function(success) {
if (success == true) {
upd.htmlText = myLoadVar.upda;
}
};
please anybody can help?
View Replies !
View Related
Unable To Change ComboBox Text Color
Does anyone know how to pinpoint the text color style property of the highlighted text in the ComboBox component? The item text can be changed with the "color" property, but the item that is selected still appears to remain a halo green unless it's moused over.
The following doesn't seem to address this:
PHP Code:
ComboBox.setStyle("themeColor", 0xCC0000)
ComboBox.setStyle("color", 0xCC0000)
Thanks.
View Replies !
View Related
Assign A Variable To Dynamic Text
I apologize if this has been asked or answered, I seem to have a great deal of difficulty searching the boards here...
Anyway, I have created a button, one layer of which is a dynamic text field with the variable name "text", to which I can assign text easily enough by using the simple actionscript:
text = "button name";
My question is, can I duplicate the button over and over and assign different values to each instance of the variable "text"??
I thought to use something like:
_level10.buttonName.text = "button name";
but this doesn't work! Does anyone know how I would go about this? I could simply create separate buttons with regular text fields, but being a lazy git who hates making buttons I was hoping there was a simpler solution!!
Cheers
G
View Replies !
View Related
How Would U Assign A Dynamic Text Variable
I am using a form and php to pull my info from a quiz. I want to send the general name, email, (no problem there) but I also want ot gather the total score for the quiz. The total score var is called QuizTrack.percent_format
this is what I have, but the results always come back as undefined - ugh
Code:
stop();
var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();
sender.onRelease = function() {
senderLoad.theName = theName.text;
senderLoad.theEmail = theEmail.text;
senderLoad.theMessage = theMessage.text;
senderLoad.score = parent.QuizTrack.percent_format
//senderLoad.score = parent.QuizTrack.percent_format.text;
senderLoad.sendAndLoad("http://www.web.com/send.php",receiveLoad);
}
receiveLoad.onLoad = function() {
if(this.sentOk) {
_root.gotoAndStop("success");
}
else {
_root.gotoAndStop("failed");
}
}
View Replies !
View Related
|