ActionScript 3.0 :: Text Disappears When Changing TextFormat Or Text?
Apr 24, 2009
I have a textfield that is dynamicly created which contains some text and has a textformat applied to it, which works fine, and I have my happy little text field.
the problem comes when I try to change the text and textformat after an event. I am doing it as so:
Code:
targ.getChildAt(2).setTextFormat(WoodTxtFmt.contentTitleSel)
targ.getChildAt(2).text = "back"
then the text becomes invisible. I know it is changed because once I rollover the container movieclip, the text appears.
I tried to dispatch a rollover event after I change the text, but no dice.
View 1 Replies
Similar Posts:
Jan 19, 2010
I have a TextField that is formatted with bold and blue. However, when I change TextField.text, the formatting of the textfield resets and I have to setTextFormat again. This is the code I use to set my TextField. myText is the variable for my TextField. (This is just part of my code; it is part of a function for my EventListener.)
View 3 Replies
Jan 3, 2007
Can someone explain why the text of a dynamic text object disappears at runtime when rotated?It happened when I rotated a MovieClip object via actionscript that contained a dynamic text object. So, to test whether this happens all the time, I created a movie clip again with a dynamic text object in it, populated the dynamic text object with a single letter, and rotated it by hand and ran the movie - the letter disappeared.
LOL in a happy, rare accident, I discovered the answer myself. Page 432 of the Flash 8 Actionscript Bible says, "Aside from just allowing text to look the way you want it to look, embedded fonts actually enable your Textfield objects to do some things they wouldn't otherwise do. For example ... a TextField object that uses device fonts (nonembedded fonts) cannot be rotated nor can you change the alpha. But once you embed the font, you can do both of these things."
How: (for dynamic or input text objects) clicking the Embed button in the Property inspector.Note, this will increase the size of your swf. Just embedding the lowercase and uppercase letters from a-z of one font increased the swf filesize from 3-9KB.
View 2 Replies
Apr 24, 2009
...when i set the textField with new text eg:
var tf = new TextField();
var myFormat = new TextFormat();
//set textField format
[code].....
View 1 Replies
Dec 1, 2006
tried following the Embed Font example here: http:[url].... exactly with absolutely no results.When I add txtField.embedFonts, the text no longer shows up, and without embedFonts, the fonts are just Times New Roman or something. Regardless, the [Embed source="..."] syntax described in the example does not seem to work. Has ANYONE gotten Embed fonts to work in AS 3.0? Second, when I add wordwrap = true to a text field, the text disappears. (it used to work fine. It stopped around when I started trying to embed the fonts, but it doesn't work even if I remove all embed code.)
View 5 Replies
Jun 2, 2010
I'm having a little trouble using URL links in text. If I select a part of the text and give it a URL link (I'm using mailto: links here), strange things are happening to all the text in that text box at runtime in some cases the leading changes, other times some or all of the text disappears. But it only happens at runtime, so I have no way of knowing if or how to compensate. And simply removing the offending link or linked text doesn't fix the problem once the link has been created the only way to fix it is to create a new text box with no links.
View 4 Replies
Aug 10, 2006
For some reason when I rotate text it disappears from the swf when i test movie!!?
View 2 Replies
Aug 25, 2004
You've seen those Input Text Fields on web sites that have titles on them, i.e. Name, Email, Message, in the Text field itself. Then, when you click on the the text field to type something in, the "title" disappears and you can type your info in. Perfect example: [URL] (Under "contact")
View 14 Replies
Jun 29, 2011
Forgive me if this is an obvious one but it has me a bit confused. I have the following sample:
Code:
import flash.display.Sprite;
import flash.text.TextField;
[code].....
View 2 Replies
Aug 27, 2011
I want the font size of a dynamic text box to change according to the number of characters of the input text. The user types in whatever (up to 50 characters long), then hits an update button to see it in the dynamic text box. But since the dynamic text can only be a single line within a defined area with no horizontal scrolling.
Here's the code I'm having a problem with:
Code:
updateBtn.addEventListener(MouseEvent.CLICK, updateIt);
inputText.maxChars = 50;
function updateIt(event:MouseEvent):void{
[Code]......
View 1 Replies
Aug 27, 2011
I want the font size of a dynamic text box to change according to the number of characters of the input text. The user types in whatever (up to 50 characters long), then hits an update button to see it in the dynamic text box. But since the dynamic text can only be a single line within a defined area with no horizontal scrolling.
Here's the code I'm having a problem with:
ActionScript Code:
updateBtn.addEventListener(MouseEvent.CLICK, updateIt);
inputText.maxChars = 50;
function updateIt(event:MouseEvent):void{
[Code].....
View 6 Replies
Apr 17, 2008
This is not styling my text. What am I doing wrong?
this.textScroll.createTextField("my_txt", this.getNextHighestDepth(), 0, 0, 255, 200);
textScroll.my_txt.multiline = true;
textScroll.my_txt.html = true;
[code].....
View 5 Replies
Aug 29, 2009
I am basically creating a new text field for every number, i though 10. And I want to apply Text format to each and every text field so that I can tell it which font I want to use and yada yada.
[Code]...
View 1 Replies
Nov 24, 2004
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;
[Code]...
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 6 Replies
Mar 25, 2010
I'm not sure if I should format all the text using Stylesheets or Textformat.
View 3 Replies
Mar 3, 2009
Is there a way to prevent Flash from removing the applied textFormat style whenever a textField.text value is redefined?
View 5 Replies
Aug 25, 2010
Basically what I have is a dynamic text field that gets text into it from an external file using loadVars(). I have got every single HTML tag to work, except for the one I really need, which is the tabstops attribute of the <textformat> tag.The content I have is like so:
Code:
<textformat tabstops='[50,100]'>Damn stupid tabstops doesn't work.</textformat>
Which displays as:
[code].....
View 2 Replies
Sep 26, 2009
I am making a simple contact form in as3, but I am having problems formating it. As soon as I use a FocusEvent, as below, it completely ignores the formating which I set?
[AS]private function onFocus(evt:FocusEvent):void
{
if(evt.target.text == "Enter here.") {
[code].....
View 2 Replies
Apr 7, 2008
I want to make some buttons and use the buttons.fla library. The button is inserted and given an instance name. A second button is inserted (same kind) and given a new instance name. But when I am trying to change the label text in one of my buttons the text is changing on the other button as well. I believed they where separate instances?
[Code]...
View 3 Replies
Jun 14, 2009
I have a code that creates 10 dynamic text fields, along the "y" axis, based on a loop.
What I want to happen is, for each text field that is created, i want the numbers to constantly change based on a timer (they'll all change at the same time, but to random numbers).
Right now, the code below changes the numbers, but keeps stacking the new numbers on top of the old...
Code:
Code:
var timer:Timer = new Timer(100,0);//called every Xms, repeated infinately (0);
timer.addEventListener (TimerEvent.TIMER, doNumber);
timer.start ();
[Code].....
View 6 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
Mar 1, 2012
I've been struggling with this problem for a while:I have a string containing HTML and I'm using a regular expression to get the characters between the tags. I'm then attempting to apply a TextFormat to those characters.The problem is that I'm using the TextField's "htmlText" property instead of it's "text" property (because I don't want the HTML tags to be visible). So, the character index that's returned from the regular expression is incorrect, when I apply the TextFormat.Here is some sample code which illustrates the problem:
var txt:String = "<b>Sample</b> string with bold text";
var tf:TextField = new TextField();
addChild(tf);
[code].....
View 2 Replies
Oct 21, 2009
Is it possible to change the text property of a text field that is contained within a sprite? I've been trying but can't come up with the right syntax. Here is what I'm doing:
I've created a sprite named "lessonSprite" and added a text field to it in one function. Now, in another function, I'd like to change the text in the field.
I've tried to use this:
lessonSprite.titleField.text = xmlLsnContent.attribute("title");
where "titleField" is the name of the field added to the sprite "lessonSprite" in an earlier function.
View 4 Replies
Sep 9, 2010
I have a Dynamic Text box in my Library. I drag it to my main stage and give it a name..it is now a movieclip. The name is 'mcAdmin' I added an event listener for MOUSE_OVER I want the text to change color, but for now I'm just trying to change the text; however, it's not displaying the change in text I want. I do a trace, and the change is in there on the output window, but it is not displayed as such.How can I :1) use AS3 to change the font color of the text2) use AS3 to change the text and have it display?
function onMouseOver_txtAdmin(e:MouseEvent):void{ Mouse.cursor="button";
//Current mcAdmin text is 'Administration'
//I want to change the color of Administartion on Mouse_Over
[code].....
View 2 Replies
Mar 15, 2011
Consider I have the text
A quick brown fox jumps over the lazy dog.
Now, this text is in a dynamic text field. I do not want to change the color of the whole field. just made fox red and dog blue.
How, can I do that in AS3. Have been looking around without no luck.
View 2 Replies
Jul 10, 2002
I just started playing with scripting and here is a question i got. I got 1 button.A movie with containts 3 graphics , graph1 , graph2 , graph3 Each graphic contains a Dynamic Text field. The var of that field within graph1 = text1, graph2 = text2 etc. On release should put the text "test" in each of the textfields and should play the whole movie wich contains the graphics with textfields. this is the code i made
Code:
on (release) {
set ("_root.movie.graph1.text1", test);
[code]....
View 2 Replies
Oct 1, 2010
I am new to CS4 and I have an issue with writing text on frames. I am using the text tool to write a paragraph of text which I type in to word to do spell check etc. Then I transfer to Flash and using the text tool paste it in. Now as soon as I let go of the mouse the text disappears but when I click on the text again it reappears why?
View 1 Replies
Jan 9, 2010
I'm using Flash MX to create a website. The user navigates between different scenes/frames using buttons, just like moving to different pages in html (except the "pages" are different parts of the main movie's timeline).The problem I'm having is that on two embedded movie clips there are text boxes which dynamically load html-formatted text files (news updates for different topics). When I run the movie, both of these "pages"/"frames" work beautifully, but after the first time, when I come back to either of them, the dynamic text boxes' scrollbars have disappeared and the up/down scroll buttons don't work. By clicking on the loaded text and dragging I can force it to scroll, so all the content is there, but the controls are gone.
I've been searching forums for a couple of hours on this now and the only thing I found was someone found a similar issue on CS3 which required giving scrollbars instance names (which I did) and then inserting Actionscript telling them to update--and that is a bit beyond me. Is there something I have to type in when the text loads to get it to do that?The script I'm using to load the text into the fields is as basic as it gets (and obviously cut and pasted from somewhere else):
loadText = new loadVars();
loadText.load("history.txt");
//creating the loadVarsText function
[code]....
View 2 Replies
Sep 10, 2009
Text box instance is labelled,
Property set to 'Dynamic Text'
Behavior set to 'MultiLine'
Text set in Actionscript:
[code].....
View 1 Replies
Oct 17, 2009
I based the following on an old code I barely understood while creating it, and decided to begin messing with it again in my "learn japanese kanji" minigame. When my sprite contacts a movieclip, (like a door or sign), I want the text screen to appear, and disappear when they are no longer in contact.
The code below almost does that. When the sprite contacts the movieclip (contact code at the bottom of this post), the textbox appears, the text appears, and everything works... for about a split second, and then the text - but not the box, disappears. I think disappearing text has something to do with being loaded through an on EnterFrame, but I don't understand why the box remains.
[Code]....
View 2 Replies