TextFormat doesn't do anything

my code is correct, but anyhow, anyway my textformat does not work, examine follow code. Didnt see what i did wrong.

//SCROLLING SPEED var scrolling_speed:int = 2; //TEXT TO SCROLL var url:String = "tekst.txt"; var loadit:URLLoader = new URLLoader(); loadit.addEventListener(Event.COMPLETE, completeHandler); loadit.load(new URLRequest(url)); var my_text:TextField = new TextField(); addChild(my_text); function completeHandler(event:Event):void { my_text.text = event.target.data as String; } //set a format var format:TextFormat = new TextFormat(); //set the color to the hex //set the font size format.size = 24; format.align = "center"; //apply formatting my_text.setTextFormat(format); my_text.x = stage.stageWidth = 50, 0; //set y coord in middle of stage (about) my_text.y = stage.stageHeight; //not selectable my_text.selectable = false; //no border my_text.border = false; my_text.multiline = true; my_text.textColor = 0xFFFFFF; //field scales with more text my_text.autoSize = TextFieldAutoSize.LEFT; //add the listener to scroll; my_text.addEventListener(Event.ENTER_FRAME,move_text); //scroll function; function move_text(myevent:Event):void { my_text.y -= scrolling_speed; if (my_text.y<(0-my_text.height)) { my_text.y = stage.stageHeight; } }

For who dont know

The fontsize stays little or the same. and the align doesn't work. Any help would be wonderfull

-------------Problems Reply------------

Instead of my_text.setTextFormat(format);, try my_text.defaultTextFormat = format;

Category:flash Views:0 Time:2011-06-09

Related post

  • Multiple fonts in flash.text.TextFormat 2009-06-18

    Is there a way to set multiple fonts in flash.text.TextFormat similarly as in flash.text.StyleSheet? What I'm trying to do is to have global common TextFormat for all texts in my project, and I would like to make it flexible by providing multiple fon

  • Flash/Flex error 1067: can't make a custom TextFormat object? 2009-06-24

    Because I want to avoid repetitive code, and I'm using a lot of text formats, I created a CustomTextFormat class in Flex Builder. Another class, called CustomInputBox.as is using this object to create a format: package { import flash.display.Sprite;

  • my vs2008 addin for textformatting is awfully slow 2009-06-30

    i wrote a little addin, which does some formatting of my C# code. in the addins Exec method i do the following try { TextSelection selection = (EnvDTE.TextSelection)_applicationObject.ActiveDocument.Selection; String foo = String.Empty; if (!text.IsE

  • Flash: How to change a text fields' textFormat on the fly/per action in AS3? 2009-09-08

    Hi :) my question today is how to change a textFormat on a textfield. I have a textFormat that has white text and one that has green text, on a button rollover I need to swap that textFormat on my textField to one that has green text. The textFields

  • Trying to pass TextFormat into other Classes, getting error 2009-11-17

    Happy Tuesday everyone :) I noticed I was using the same fonts over again in several of my Sub Classes, so I figured I'd just make a Fonts Class to handle all those. Anyways I'm scratching my head around how to get those TextFormats created in my Fon

  • Actionscript TextFormat resets when changing TextField.text 2010-01-19

    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 TextFi

  • Why is TextFormat.size an object? 2010-03-22

    According to the ActionScript 3.0 documentation, the TextFormat classes size property is an Object. Why is this? Clearly this is a number! When I check its type (using typeOf()), it returns Number. So whats the deal? --------------Solutions----------

  • Removing last char from textfield without destroying textformat 2011-01-03

    i have a problem where i want to remove the last character from a textfield (including linebreaks) that has multiple textformats without removing the formats. so far i have: textfield.replaceText(textField.length-1,textField.length-1,''); i guess thi

  • AS3 textformat, embedfonts and multiple fonts? 2011-12-02

    Here is my issue : I have a dynamic html text field, to which i passed html text / textformat such as : <P ALIGN="LEFT"><FONT FACE="Trebuchet MS" SIZE="14" COLOR="#000000" LETTERSPACING="0" KERNING="0">Some text<B>some bold text<

  • Which font label do I use when calling TextFormat? 2012-01-13

    I'm trying to use an embedded font in a ComboBox component and following the documentation it's done as my code has it below. However, Macromedia fails to explain what myFormatWhite.font is looking for, as a string. There are SO many places where fon

  • TextFormat and TextFields display different outside of FlashPlayer 2012-02-14

    I have been using TextFields like this to render text for a game. I've been developing in FlashDevelop, so the SWF is compiled using the Flex compiler. My problem is that this text is not displayed with the appropriate formatting when I view it insid

  • Actionscript - using regular expression and TextFormat to style text between HTML tags 2012-03-01

    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 usin

  • How to read an extension .proto file (textformat.merge) with old code? 2012-04-07

    My question is related with the C# implementation of the google protocol buffers (protobuf-csharp-port, by jon skeet, great job!) I am experiencing troubles with the extensions: let's say I wrote: "transport_file.proto" with a "transport message" and

  • android EditText and textformatting 2010-12-23

    in my custom listview that Contain an image and EditText ,and in EditText i can comment the photo ,i can give text comment max length of 50 ,when i lost the focus in EditText i want to rearrange the text in EditText in following format EG: suppose co

  • How do you set the textFormat of a textField within a loaded .swf 2011-11-30

    I am witnessing a strange behavior when attempting to set the text format of a textfield within a runtime loaded swf. //This works on a textfield in the main app _ui.title.text = _data.text.title.en; _ui.title.defaultTextFormat = enScreenTitleFormat;

  • How do I change the colours of a textarea in actionscript? 2008-10-06

    I create a TextArea in actionscript: var textArea:TextArea = new TextArea(); I want it to have a black background. I've tried textArea.setStyle("backgroundColor", 0x000000); and I've tried textArea.opaqueBackground = 0x000000; but the TextArea stays

  • Displaying RichText in Crystal Reports 2008-10-09

    I have a report created in Crystal (the version that comes with Visual Studio 2005) that contains an IFieldObject that I want to use to display some rich text. I have set the TextFormat of the IFieldObject to crRTFText, however when I run the report

  • Flash AS2.0 - Increase Label's Font Size 2008-10-14

    I know this sounds like a really obvious question, but it's proving harder to figure out than I thought. I'm developing in Flash 8/ActionScript 2.0. I have a label component, and I'm dynamically assigning it text from an xml document. For example: la

  • How do I change the font used by the FLVPlaybackCaptioning component for subtitles? 2008-10-16

    How can I set the font used by the FLVPlaybackCaptioning component for subtitles? Using the style property of the textarea does nothing, and using a TextFormat makes the text go blank, even though the font had been embedded. --------------Solutions--

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.216 (s). 11 q(s)