ActionScript 3.0 :: Setting Different Formats To Segments Of Text In A Text Field?
Dec 5, 2009
I want to assign different formatting to different segments of text in a textfield. I tried assigning a format to a string and then concatinated it to the text and it was not accepted.How would I assign different formatting in the same textfield?
code follows:
format assigned to the textfield:
var sngTitle:TextField = new TextField(); sngTitle.text = 'Title: ';var sngTtlForm:TextFormat = new TextFormat(); sngTtlForm.font = "Stencil Std"; sngTtlForm.italic = true; sngTtlForm.color = 0xffcc00; sngTtlForm.size = 24; text I want to add to the above textfield:[code]................
View 2 Replies
Similar Posts:
Jan 25, 2011
I have a little issue im trying to resolve. Basically i want to inherit the embedded text format properties from one text field which i have off the stage (empty) to another text field i have on stage. Ive came across the function of getTextFormat(), however when i try to apply this to the other text field it doesnt work:
ActionScript Code:
onStageTextField.getTextFormat(offStageTextField);
Ive embedded italics into my test field which is off stage. I guess im doing this completely wrong?! I know i could simply create a new TextFormat() then apply that to the text field but is there a way of inheriting the format properties of one tex tfield to another on stage?
View 3 Replies
Jan 21, 2010
I am trying to bring in multiple RSS feed nodes into one Dynamic Text field in Flash CS3 using AS3. I have made vars for my headline node and my description text node and I am able to have them both display in the same dynamic text field by formatting them with HTML tags. My problem is changing the text size and color for the description node var. Is this possible in the same Text field. Can the default text format be overidden by code?
Here is what I have so far....
ActionScript Code:
//This code loads and Parses the RSS feed
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
[Code].....
I tried adding size = '8' in the <p> tag but it did not override the default size in the Dynamic Text Field (dtfa) properties.
View 1 Replies
Jun 21, 2009
I'm having difficulty setting the text of a dynamic text field when using an if statementI have a gallery and thumbnails, which gives each image a picNum, ie 1, 2 etc;When I click on the thumbnails, it sets the picNum accordingly.What I want to do is set the caption depending upon my picNum, so I set a function to change the caption depending upon the picNum that is called when the thumbnail is clicked. Ie.
caption = function() {
if(picNum=1) {_root.caption.text = "image 1 caption"};
if(picNum=2) {_root.caption.text = "image 2 caption"};
[code].....
View 5 Replies
Dec 8, 2010
I'm creating an XML-driven pie chart in AS3 with 2 text boxes in each pie slice. Both text fields are dynamic in the sense that they are populated by the XML doc and then told where to place themselves in the AS3. I've got them both using the same x and y position to place themselves at the moment (which of course puts them right one top of each other), but I'd like to make one of the fields (which acts like a label or a title to the larger number and % text field) place itself in a particular spot around the other text field. The result I'm looking for is to have the smaller "title" text field appear approximately 5 pixels above and left-justified to the larger "percentage" field.
Anyway, here are two sections of code that I've currently got. The first chunk, for the Tags portion, sets the position for the "percentage" text field using a good old x and y method. The second chunk, for Titles, is setting the position for the smaller "title" text.
//evaluate tags
private function evaluateTags():void{
for (s=0; s
[Code]....
View 1 Replies
Feb 3, 2007
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.
View 1 Replies
Apr 30, 2009
i have a text input box in which i want to insert Hebrew (RTL language) text. now, the RTL support i need is basic, and thats easy enough to do. however, for entering hebrew in the box, the user has to set hebrew in his windows language bar. is there a way of making the default input language in the box hebrew, regardless of what is currently set in the language bar? note - the hebrew characters are showing just fine, its just that to enter them you have to make sure the language bar is set to hebrew as well.
View 2 Replies
Jun 15, 2009
I'm currently working on a project that involves adding text fields dynamically, and I realized I need to change the color of the highlight when the text is selected
View 2 Replies
May 4, 2009
I want to have the caret (flashing cursor) to appear when I set the focus to a text field. It works fine when the user clicks on the text field.
the following does not seem to work for me:
Code:
stage.focus = mytxtfield
mytxtfield.setSelection(mytxtfield.text.length,mytxtfield.text.length);
When I try this it merely focuses on my text field and no caret comes up! mytxtfield is the instance name of my input type textfield.
View 4 Replies
Jul 15, 2010
I've got a number of related projects set up in Flash Builder. Each project gets its graphical assets from an exported SWC file (or multiple SWC files.) This works fine, but I wanted to create a shared project that contains stuff used across all projects. The first item in there is a screen with a number of clips containing dynamic text fields on them. This screen (and associated assets) are exported to a SWC and then I have written code in the shared project to add functionality to the screen and buttons. I'm using 2 fonts, both are embedded.
Both show up just fine in my test harness, but when I link the shared SWC and src folder (which is required in order to use this code/assets in the other projects) the textfields blank out if I try to set their text properties. If I leave the default text (set in the FLA) it shows up, and the static text fields in the FLA also show up, it's only when I set the text property.
I've tried a number of combinations, including removing embedding, exporting for ActionScript, setting all textfields in the shared project to dynamic, all with no luck. The main project does have the same font embedded, and I've checked that the same glyphs are selected in both the main and shared projects. I realize this is a rather complicated setup, but I have yet to find a workflow to allow a designer and developer to work on large projects that is better (but I'd love to hear one!)
View 2 Replies
Jul 17, 2003
Is it possible to login through flash using one Dynamic Text Field and one Input Text Field and no buttons? If so how? I have seen many tutorials dealing with logging in to PHP using flash but it requires you to make your own php scripts which i am not familiar with. Can some one tell me how to do this with PHPBBs existing php scripts... I want to be able to login thorugh a Input Text Field box and have it verify it in PHP and also be able to register and view other PHP info such as users online and FAQ..
View 2 Replies
Mar 30, 2006
I'm making a calculator using Flash MX that works the same way as the basic calculator found on windows (not the scientific one). But having the user input a number, store it as a variable, store which function the user wants to perform and clear the text field then store the new input in the same text field as a different variable and multiply or add or divide or subtract the 2 numbers and getting the equals sign to display the answer when clicked is harder than I thought it would be.
View 3 Replies
Nov 15, 2004
I am working on a file that has a rotating dial, and I'd like the dial to reveal contents of a text field (a link) as the dial points in the direction of the text field. I have 4 text fields located at 90, 180, 270 and 360 degrees (top, bottom, left and right). I have it controlled via AS, so I've got all the Math but I was hoping someone might know how to reveal the links when the arrow (in the dial) is pointing in these directions.I set up a text field for testing, which shows the degrees, but I'm getting 'NaN' in the field (problems with Theta and converting degrees to Radians, I think). I thought this might help me figure out how to reveal those links, if I can get the NaN to work.Currently, the file is rotating with an onPress, but I'm going to convert it to a mouse follow, instead, so the user only has to float around to see the links.
View 5 Replies
Apr 24, 2010
Problem: I am trying to get a very simple text resize going, for my main content area in a flash website. My aim is to get a button, that on click, increases the text size of a dynamic text field.
[Code]....
This is what I tried, I am very new to Action Script, so excuse the futility of my code.
View 1 Replies
Oct 17, 2002
I was wondering: how to make a dynamic text box a little more customizable.what i mean: how do i start new paragraphs.. i've set it to multiline, but it just goes onto next line at end of current one which is fine
if i press enter, and go to new line in the actionscript, it creates an error, as the on function isn't finished...also, how to set the box to justify ALL test inside it.. even though i've selected the justify tab on the properties of the box, it doesn't do it properly ....
View 7 Replies
Oct 13, 2009
Is it possible to create gradient text with text in a text field, without using a different object?
I have three text fields sitting right next to each other, to create a row. Some times the text is longer than the width of the text field, I don't want to widen the the text field to make it fit, I just want to fade the last 20 - 50 pixels of the text out.
Is this possible to do without using an object above it, such as a gradient?
View 2 Replies
Nov 21, 2003
I have a problem with a dynamic text field. I have 1 text field on frome 10 which displays text from a text file. This text can change when a button is clicked. I have another text file on frame 20, which i want to display what ever text is in the text filed on frame 10.
I have tried:-
[AS]MyTextboxFrame20.text = MyTextboxFrame10.text;[/AS]
but it doesn't work.
View 3 Replies
Dec 11, 2008
how I can make one String, displayed in a TextField, have different text formats?
View 2 Replies
Dec 16, 2010
What I'm trying to do is to write something in an input field and then it should show up in a dinamic field. I can make this happen, but the problem is that the dinamic field shows its new text in the same format as the Input field. For example, the input text is written in TimesNewRoman and the dinamic text is in Arial, but when the dinamic text shows the input, the text is still in TimesNewRoman when I want it to be in Arial.
View 11 Replies
Nov 8, 2010
I've created a dynamic text field - mediaImportName001 (created , and populated it with the name of a file that I choose to import using a browse button (as3 and AIR).This works fine - I can import the file, and the name appears in the field.
I'd now like to pass the contents of the text field to another text field. But I can't get the contents. If I try to trace the contents of the textField trace("mediaImportName"+thisNum).text - Flash returns "undefined" (even though I'm asking it to trace after the field has been populated).
I use the following code to check that the field really is there and named correctly (the code returns the children):
for (var i:uint = 0; i < this.numChildren; i++){ trace (this.getChildAt(i).name + ' type:' + typeof (this.getChildAt(i))+ ' ' + this.getChildAt(i));}
it returns:
instance370 type:object [object Shape]mediaImportName001 type:object [object TextField]mediaFiletype001 type:object [object TextField]
How do I get Flash to give me the text in mediaImportName001?
It's bizarre - this.getChildAt(i).name
from above gives me...
mediaImportName001 ,
yet
trace (["mediaImportName"+thisNum].name);
returns undefined (thisNum represents an increment I use to name multiple clips and text fields, and in this case trace(thisNum); returns 001)
View 4 Replies
Mar 3, 2010
I create a dynamic text object on my stage. I set the family to Arial and style to Bold. When I change the text by setting the .text to something else, the bold goes away and it just becomes Regular. How can I make it stay Bold?
View 1 Replies
Jun 8, 2006
I have the folowing codo to load text from a text file into a text field in my flash document:
loadVarsText = new loadVars();
loadVarsText.load("homePage.txt");
loadVarsText.onLoad = function(success) {
[Code]....
the same, and I want to make the homePage.txt file load when the flash file starts, that is what it does right now by placing the code on the main timeline.
View 3 Replies
Aug 8, 2011
It's what this image describes:For some reason, I cannot use bold tags to set the TLF text to bold, even though both the regular and bold fonts are embedded.so that the webpage that embeds this movie can call its function (otherwise the movie itself will be wrapped by TLF).his is not exactly a question since there is an obvious solution to this. Just set the htmlText as something like "<font face='Myriad Web Pro'><b>BOLD</b></font>" and you're done.hs issue is, why does it not render the bold text without the font tag in the first place, if I have already set the font of the TLF text in the PI?
View 2 Replies
Jul 15, 2009
I'm trying to get the letters in a word (each letter is an individual text object) to cycle through three different colors when clicked. Right now, all they do is change from their original color, blue, to black when clicked. No further "cycling" occurs. I'm appending the code. The part of interest is (probably?) in what is presently (and inaccurately) the "traceTextEvent()" function/method. It starts around line 90 of the code.
[Code]....
View 0 Replies
Jul 24, 2009
I'm trying to pass text from an input text in frame 1 to a dynamic text field in frame 10. Thus when the user enters text and clicks the submit button it takes them to frame 10 and shows them what they typed. It's not working but I'm not getting any errors. Here's the link:
[Code]...
View 3 Replies
May 13, 2011
I have a dynamic text on the stage which gets updated (shows numbers) when some buttons are pressed.I just need to know if it is possible to show the first dynamic textfield in another dynamic textfield.Lets say the first dynamic textfield called "price" and the second one called "price2". when a button is pressed, the first dynamic textfield "price" will show a number. is it possible to show whatever is shown in the "price" in "price2" ?
View 1 Replies
May 8, 2009
I have a text field component that I am dynamically populating with text. The words appear one letter at a time in a teleprinter style fashion. I also have rendered certain words with HTML to make style changes within the text.Now all this works fine, except because the HTML text is larger than the body of the other text, I am losing theteleprintereffect at the bottom of the text field. In other words, after a set amount has been printed, users are not seeing the letters printed out one at a time, but instead just get a printed line of text appear from beneath the visible section of the text window.
View 2 Replies
Jan 27, 2011
I created a somewhat custom Spark button by doing the File > New > MXML skin and basing it on spark.components.button. The problem is that I need to add an extra text field to the button component and dynamically change that text...but of course, the property isn't recognized on a Spark Button.
Is there a simple way to add this field to my custom button skin & its property so it can be addressed? If not, is there a simple way to take what I've done and just extend the Spark Button? I can't seem to find any examples that show how to do it without writing it all up in ActionScript.
View 1 Replies
Jan 20, 2010
I have a dynamic text filed scrolling with a drag button on a track or the mousewheel. What I am trying to do now is have the scroll button and track not visible if the content is smaller than the text field.
ActionScript Code:
//this if statement not working as should. button and track are always invisible.
//txt is text field name
if (txt.textHeight < txt.height){[code]......
View 8 Replies
Feb 19, 2010
Is there a way to detect if a dynamic text field that has basic english characters embedded can't display some foreign text, japanese for example?
So I can then switch the text to display in an arial device font text field.
Sorry if this has been answered b4, but I can't find it if it has.
View 0 Replies