Kerning Dynamic Text through actionscript

Hey,
i know there is a way to assign a numeric leading property to
dynamic text through the AS TextFormat class, and there is a
boolean value to determine if text is kerned or not through
TextFormat.
What I want ot do is assign a kerning number to the text like
you can using the property inspector when you drop a dynamic text
instance on the Stage. Is this possible?
I am creating a text field using AS and then manipulation it
as such:

I think the property you are looking for is called
"letterSpacing". Using your example:
txtFmt.letterSpacing = 10; // put 10 pixels before each
character
Tim

Similar Messages

  • Help with delivering dynamic text through an external file, through XML?

    I'm struggling to find the best way to deliver dynamic text
    from an external file, through XML, to a Flash file.
    I use small Flash pieces to deliver multiple sets of content
    through a single .swf file. An example is here:
    http://www.esi-intl.com/public/government/federal.asp
    In the .swf file at the bottom, I'm using a three-scene .fla
    file. I'm putting the actionScript in the Actions layer atop each
    frame. Example:
    stop ();
    loadVarsText = new LoadVars();
    loadVarsText.load("fedNews.txt");
    //assign a function which fires when the data is loaded:
    loadVarsText.onLoad = function(success) {
    if (success) {
    trace("done loading");
    //Now that we know the data is loaded,
    //set the text content of the Text Field
    //with the instance name "scroller" equal to the
    //contents of the variable
    scroller.html=true;
    scroller.htmlText = this.var1;
    } else {
    trace("not loaded");
    In that .txt file, I'm putting the information like this:
    var1=<font face="tahoma,verdana,sans-serif" size="11px"
    color="#000000"><b><a href='
    http://www.esi-intl.com/public/classroomtraining/dau.asp'>DAU
    Grants ESI Course CON353
    Equivalency</a></b><br>Advanced Business Solution
    in Contracting (CON 353) is an equivalency for DAU's CON 3535
    course, Advanced Business Solutions for Mission Support. <a
    href='
    http://www.esi-intl.com/public/classroomtraining/dau.asp'><U><font
    color="#996633">Continue</font></U></a></font>
    So much of this is pick-ups from what I've researched in
    Google. I'm looking for a way I can feel more confident in my code,
    and also have that code follow CSS.
    Lastly, I recognize the problems in XML with using single
    quotes / double quotes, and the & symbol. This is one of my
    largest time sucks, and I'd like to find a better way to do this.
    Thank you

    Hi,
    Did you ever find a resolution to this? I'm having a similar
    issue that I can't seem to get multiline dynamic text working in
    CS3.
    The font is embedded but it just displays the first line, and
    then a blank. I'm sure this worked fine in Flash MX.
    Cheers, Ant

  • Dynamic Text - Basic Question

    I am using Dreamweaver MX and ASP.Net to create a data driven
    website. I have created a database connection and set-up a dataset
    with the relevant query, which returns a table of information. I
    now want to simply insert some dynamic text that references
    specific data items on different rows.
    By inserting Dynamic Text through Dreamweaver I can only seem
    to return the information in row 1 of a specific column (i.e. the
    first data item). How do I specify which row the data should be
    taken from? The code I have at the moment for inserting the dynamic
    text is shown below:
    <%# dsCampaigns.FieldValue("CampaignName", Container)%>
    This returns the first item in the CampaignName column of the
    dsCampaigns dataset. How do I return the item on row 3?
    Thanks for your help.

    hi Ned,
    you've helped me again. Thanks.
    Putting stop in the first frame makes it now work. I don't
    really understand why, though.
    I had a 'stop' in frame 2 of my actions layer. so, when i ran
    what I started out with, with 'stop' in frame 2, when the playhead
    reaches frame one why can't I assign a value to the dynamic text
    instance?
    thanks.

  • Iterate through all dynamic text variables

    Hello,
    I'd like to be able to iterate through all of the dynamic
    text variables in my flash movie, and I'd like it so that if I add
    new text to this movie, it will show up in the iteration.
    Essentially, I want to do something like this:
    for (i in _root) {
    trace(i);
    While this seems to print out all the variables in root, it
    prints more than just the dynamic text variables, and also doesn't
    iterate down through various objects to find the dynamic text
    variable.
    Is there any way I can accomplish this in action script?
    Thanks!

    Great! That code helps me a lot.
    There are still two weird issues.
    1) the test for tl[obj].text seems to always turn out to be
    false. However, if I trace the value of text, I'll see the text.
    Example:
    trace(tl[obj].text); // This will display the value in the
    text field
    if (tl[obj].text) // This is always returning false.
    Any ideas?
    The 2nd issue might be more difficult - some of my text
    objects don't appear until later in the movie (i.e. frame 10). It
    sort of looks like this looping doesn't see objects that appear in
    the future. Do I need to advance the frame 1 by 1 and repeat this
    looping process until the text appears? Maybe instead I can always
    have the text in the first frame, but have it be invisible or
    something?

  • Actionscript for Dynamic Text

    I am designing my first flash site, and created a Dynamic
    text field called header_txt. I want the content inside this field
    changed based on which page the user navigates to. I have used an
    "IF" statement inside a Declared Function , but wonder if that is
    the best option, also, my IF statement is no working. Here it is:
    function headingChange() {
    if (_root._currentframe == "contact") {
    header_txt.text = "Contact Us";
    } else if (_root._currentframe == "about") {
    header_txt.text = "About Us";
    headingChange();
    var header_txt:String = "";
    Why is this not working, and what would be a better way of
    changing this field?
    Thanks for the help!
    Chuck

    _currentframe only returns a number. You can't access the
    frame's label with actionscript, except to specify it as a
    parameter in the gotoAndPlay() method.
    I would assume that you are calling the headingChange()
    function at each labeled frame. If you are, then just change the
    function call to this:
    At frame labeled "contact": headingChange("contact");
    At frame laveled "about": headingChange("about");
    Change your function to read as follows:
    function headingChange(s:String) {
    if (s== "contact") {
    header_txt.text = "Contact Us";
    } else if (s== "about") {
    header_txt.text = "About Us";
    Or, you could just access your dynamic textfield directly
    everytime you get to a new frame with a label by executing the
    following code in a frame:
    At the frame labeled "about": header_txt.text = "About Us";
    Either way would work. Though I like keeping stuff like this
    in a function. It makes it easier to update so that it does more in
    the future.
    Tim

  • Dynamic Text Field Height (k)

    I have generated a dynamic Text Field through ActionScript
    (actually it
    generates a bunch)
    this["char"+ii].createTextField("true_txt", 997+ii, 0, 0, 1,
    1);
    Everything is working well, with one exception. I have the
    font, size,
    color done through ActionScript. The particular font I am
    using,
    ElanBook is getting cut off in the Text Field slightly.
    I've tried a number of methods to get the text field taller,
    but no
    dice. Is there a way to specify that the text align within a
    Text Field
    to the center, bottom, baseline, etc. using ActionScript?
    -Kirk

    no, but you can size your textfield using any number of
    textfield properties. in particular, you should check the autoSize
    property.

  • Dynamic text problems

    Iv not used flash for a while so am just converting from AS2
    to AS3 and am having problems with some simple actionscript
    I have a dynamic textbox created through actionscript inside
    a movieclip and im trying to change the content of this but save
    the previous value.
    Iv taken the previous value and saved it in a variable (a
    string) called
    oldTxt (witch is working when i use trace statements to
    check)
    and then assigning the new text with
    theTextField.text = "some new text"; (again working
    perfectly)
    the problem is when i try to re-asign the old value stored in
    oldTxt, nothing happens.
    the code im using is
    theTextField.text = oldTxt; but its just removing all the
    text.
    any suggestions?

    button.addEventListener(MouseEvent.ROLL_OUT, navOut);
    function navOut(MouseEvent):void {
    trace(oldTxt);
    theTextField.text = oldTxt;
    works fine when i replace oldTxt with "some new text" and the
    value of oldTxt is coming up in the trace

  • How to embed the Greek language Characters in flash dynamic text field

    Hi,
    I have a problem with dynamic text field in flash. I want ot embed Greek Language characters like ≤, ≥, ± etc through actionscript (embedFonts).
    Plz help.
    Rakesh Kumar

    Hi,
    First u must create the new font in right click on library then choose the font.
    Right click on the font add linkage name that name here is my font
    import flash.text.TextFormat;
    var my_fmt:TextFormat = new TextFormat();
    my_fmt.font =  "my font";
    my_txt.embedFonts = true;
    my_txt.text = "Hello world";
    my_txt.setTextFormat(my_fmt);
    Try this. i think it will help u.
    Saransoft

  • Dynamic text Underline Links

    I have created a RSS feed viewer, parsing the RSS feed with
    actionscript 3.0 and viewed on the stage in dynamic text boxes. The
    text in these dynamic boxes is scripted to link to web addresses
    contained in the RSS feeds in the same node as the text being
    displayed. So far so good. Now I need the text in these boxes to
    act as if they were HTML links and show an underline and color
    change when rolled over and clicked on. Help. Attached is my code.

    The trick with the help files is to realize that everything
    is organized by classes. So if you want to do something with
    text...
    Open the help files and select the ActionScript 3.0 drop
    down. Then from that list Expand the Actionscript 3.0 language
    reference and the All Classes section. Next scroll down to the "T"
    section and start looking.
    The ones that seem interesting to me for what you were
    looking for are TextField and TextFormat. Even if you don't know
    exactly what you need those seem like they would have something to
    do with text and how it looks.
    Then start looking through the entries for each of those
    sections. Everything that can be done with text is in there. So
    after looking at TextField I didn't see anything about making an
    underline or even how to change the color. But I did see a method
    called setTextFormat()
    So next I check out the documentation on the TextFormat class
    and sure enough there is an underline property.
    Great, so by this point I've figured out how to make some
    TextFormats and then use the setTextFormat() method to apply them.
    So next you've got to figure out how to apply the different formats
    when I want them.
    Things that happen at certain times are events, so anything
    that you want to happen now, not then -- or I suppose then, not
    now! -- will require an event. So again it is something about
    events. So I'll go back to the textfield class and see what kind of
    events there are. At first glance you might think that TextFields
    only have 4 events -- change, link, scroll, textInput -- and that
    none of them seem to be what you would want. Now this is the tricky
    part...
    At the top of the events section in the documentation there
    is a little arrow for "Show inherited events." So going down that
    list you will find that TextFields get a lot of events from
    inheritance. Sure enough reading down the list I see mouseOver and
    (this is important) finishing the list I also see a rollOver. They
    both seem promising. Always read the entire list. There are many
    times when there are two similar things and if you stop at the
    first you might miss out.
    Anyways, I hope that this helps you see how the process can
    work. The Flash help files are actually pretty awesome and helpful,
    but you have to know how to work them. You will very seldom find
    the answer by searching or find a fully formed answer to your
    specific needs.
    Break it down into the classes you think you might need. Then
    look for the properties, methods, and events you might need. Most
    of them have fairly straight forward names the should suggest what
    they might be for. And then follow the hyper links to related
    classes than their methods, properties, and events.
    PS: I just noticed your second problem. So do the same thing.
    So notice that if you look through the TextField class there isn't
    anything that lets you chop a string or cut it up or anything. But
    notice the text property of the TextField class. That is what shows
    in a textfield. And notice that it takes a String.
    If you didn't know it a String is some text. You would never
    find the String class if you didn't know that techy word, but by
    noticing how often it is mentioned in the TextField class you could
    get there.
    So next look at the String class. What methods and properties
    do you need for what you want to do?
    The length property might tell you when a String is too long.
    And the methods substr() and substring() seem promising to
    cut up part of a String.
    Finally adding an ellipsis at the end might be hard to figure
    out if you don't know the trick. Fortunately you only need to read
    the methods to the "c" or concat(). Fancy talk for putting strings
    together. Always read the entry to the end. There you will see a
    link for "See Also Concatenating Strings." That will show you that
    you can easily use a plus sign to add strings together -- just like
    addition.

  • Please Help -- Dynamic Text Wont Load :-(

    Hi Gang,
    I've just written a quick mail form in Flash8Pro/PHP - the
    user enters their contact details & a message, and it sends it
    off to the specified email address.
    The feature works fine for the most part, but there's one
    little problem. The dynamic text field that confirms the message
    has been sent successfully isn't working properly. I'm using the
    following php code to send dynamic text back to the flash document
    saying the message has gone through OK:
    print "sendresult=Message Sent!";
    where sendresult is the name of the dynamic text field's
    variable.
    The strange thing is that the code works fine if the
    sendresult dynamic text field is inserted into the main flash
    document. It's only when I put the sendresult field into the movie
    clip that holds the flash mail form (including the button with the
    loadvariablesnum command), that the text won't update at all. I've
    tried:
    print "_root.enquirypage.sendresult=Data Sent!"
    and
    print "enquirypage.sendresult=Data Sent!", but neither of
    those make any difference.
    Any suggestions? Anybody know what's causing this problem?
    Any help would be very very appreciated - I know I could probably
    get around this by just setting the visibility of the dynamic text
    field on & off when necessary and keeping it in the main flash
    doc, but I'll be using this feature quite a lot and I'd really like
    a proper/versatile solution. In case it's necessary, the
    actionscript that sends the message off to the php is just:
    loadVariablesNum ("form.php", 0, "POST");
    Many thanks in advance gang,
    - Jay

    Your code loadVariablesNum ("form.php", 0, "POST"); will load
    your variable sendresult in level 0 - the main timeline. If you put
    the text field inside a movie clip it expects a local variable in
    that movie clip.
    Use _level0.sendresult or _root.sendresult as the dynamic
    field's variable.
    Or, instead of loadVariablesNum you could use loadVariables,
    like this:
    _root.enquirypage.loadVariables("form.php", "POST");
    or, if you make the call from a button inside the movie clip:
    this.loadVariables("form.php", "POST");
    /uamg

  • Dynamic text links

    Can anyone help with this? I'm trying to get text on a screen
    to link to documents (that will be on a CD, currently on my hard
    drive) such as pdf, txt etc. Using Flash 9.
    Thanks.

    Thanks again for your reply. Since my last posting, I have
    gotten mostly everything figured out except the main issue, which
    is creating a link to documents from text. In the following code I
    was able to load dynamic text from an external txt file and I
    inserted an html link in the txt file but I don't want to open a
    browser link, but rather a file on CD or hard drive:
    var textLoader:URLLoader = new URLLoader();
    var textReq:URLRequest = new URLRequest("test.txt");
    function textLoaded(event:Event):void
    getStart_txt.htmlText = textLoader.data;
    textLoader.load(textReq);
    textLoader.addEventListener(Event.COMPLETE, textLoaded);
    So everything looks good, except how do I get the html link
    in the text file to open a doc instead of a url? Or maybe something
    in your post will work.
    Regarding buttons and code, this is from a Flash website:
    "So you just started AS3.0 full of excitement and ready for
    some coding challenges, you start coding your first button and
    suddenly, horror, you end up with "WARNING: Actions on button or
    MovieClip instances are not supported in ActionScript 3.0. All
    scripts on object instances will be ignored." or "1119: Access of
    possibly undefined property onPress through a reference with static
    type flash.display:SimpleButton.", indeed the good old AS2.0 event
    system is not working anymore in AS3.0: onClipEvent, onPress,
    onRelease, onLoad, onMouseDown ..etc, have become things of the
    past!!!
    What happened? well basically the whole event handling system
    has been revamped in Actionscript 3.0 and we are going to have a
    quick look at it."
    When I select a button in Flash 9, the error message I get is
    "Current selection cannot have actions applied to it."
    Thanks.

  • UIScrollBar component dynamic text capital letter Y not appearing

    I'm using the UIScrollBar component, dynamic text is my setting.  When I view the swf or exe, all my text appears except for capital letter Y, it appears in flash, but not the swf or exe file.
    Any reason why this happens?
    Any help is appreciated.

    I finally found the answer but this scenario doesn't make
    sense. It seems you have to create a dynamic text field with a
    scrollbar during runtime through actionscript, rather then creating
    the text field and scrollbar in design mode. Here is the code that
    worked:
    import fl.controls.UIScrollBar;
    var myTxt:TextField = new TextField();
    myTxt.background = true;
    myTxt.backgroundColor = 0xFFFFFF;
    myTxt.border = true;
    myTxt.wordWrap = true;
    myTxt.width = 200;
    myTxt.height = 200;
    myTxt.x = 22;
    myTxt.y = 75;
    var mySb:UIScrollBar = new UIScrollBar();
    mySb.direction = "vertical";
    // Size it to match the text field.
    mySb.setSize(myTxt.width, myTxt.height);
    // Move it immediately right the text field.
    mySb.move(myTxt.x + myTxt.width, myTxt.y);
    // put them on the Stage
    addChild(myTxt);
    addChild(mySb);
    // load text
    var loader:URLLoader = new URLLoader();
    var request:URLRequest = new URLRequest("breakroomText.txt");
    loader.load(request);
    loader.addEventListener(Event.COMPLETE, loadcomplete);
    function loadcomplete(event:Event) {
    // move loaded text to text field
    myTxt.htmlText = loader.data;
    // Set myTxt as target for scroll bar.
    mySb.scrollTarget = myTxt;

  • How to use same dynamic text, multiple times in a Movie

    FLASH CS5.5
    How can a dynamic text field be used multiple times, on any
    frame, in any new layer during a Movie?
    ~~
    A number of unique dynamic text fields are being used.
    The intent is to use them each, many times during a Movie.
    (i.e. a users first name)
    They are successfully being "ExternalInterfaced" from a PDF form field.
    (the SWF is displayed within the PDF as a RMA)
    This all works well, IF I only use one instance of the dynamic text field.
    (one use of each unique text field)
    If I try and use that same dynamic text field, again, in a new layer, later in the SWF,
    all of that said, duplicate dynamic text fields do not display.
    ~~
    Stumped!!!
    Thanks in advance for your advice / comments!
    D-

    Thanks Ned,
    I always welcome learning something new.
    I did not know creating a new keyframe,
    creates a new instance.
    Yes, I had used the same dynamic text field instance name in
    numerous, new layers (great observation).
    With the objective to display the User's name throughout
    the timeline (on and off)...
    I'll attempt to paraphrase your solution;
    Use a single layer to display the dynamic text field.
    Extend this layer's timeline throughout the movie, or end use of the dynamic text field.
    Help with this one ??
    Set the visible properties to true or false as need through out the timeline.
    ( Does require an AS3 ? )
    I'll give that a try.....
    ~~
    Side of effect of using the above solution;
    The SWF in it's attempted state, uses the dynamic text field instance, in
    different places, different text sizes, on the stage, throughout the Movie.
    (i.e. the User's first name appears in different sentences...)
    Per the solution above,
    I believe I will be limited to One location, one format setting.
    Is this assumption correct?
    I can make this work from a display / Movie point of view.
    However, your first VAR concept, noted above, might be
    worth exploring should more flexibility be required.
    Thanks for making the time to coach...
    D-

  • How do I make dynamic text look static while the HMTL tagging is enabled?

    Hi all,
    I am using flash 8 with AS 2.0.
    I have a dynamic text field where I am setting it's text value through a variable. Now, I need this dynamic text field content to look like static font on runtime. I tried embedding the text field but that makes my file so heavy and most importantly, it disables the HTML tagging on the text field.
    Please suggest me on how to make a dynamic text field content look static on runtime while the HTML tagging is enabled and working fine.
    Thanks.

    I am sorry. But the attachment was not intended for what you
    thought my friend.
    It was there so that there are no confusions for what I mean by look of dynamic and static text fields.

  • Linking a class to a dynamic text field to load XML data.

    Hi,
    I'm quite new to ActionScript and would be grateful for any help here.
    I want to load text into a dynamic text field (called 'about_tab') using  a class depending on the language selected (by clicking on a flag icon)  by the user.
    I managed to get this to work when the ActionScript was written directly  in the timeline, but am having problems with doing the same thing via a  class.
    This is my class file:
    package
    import flash.display.SimpleButton;
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    import flash.events.Event;
    public class ChangeLang extends SimpleButton
    public function ChangeLang()
    addEventListener(MouseEvent.CLICK, switchLang);
    trace("ChangeLang class working");
    public function switchLang(event:MouseEvent):void
    var lang = event.target.name;
    var req:URLRequest = new  URLRequest("languages/"+lang+".xml");
    var loader:URLLoader = new URLLoader();
    var substance:XML;
    function xmlLoaded(event:Event):void
    trace("function xmlLoaded is running");
    substance = new XML(loader.data);
    about_tab.text =  substance.about_lbl;
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
    loader.load(req);
    Here's one of my XML files (the other is the same except "About" is  written in German):
    <substance>
    <about_lbl>About</about_lbl>
    </substance>
    When I run it, it returns my trace statements that the class ChangeLang  and the function xmlLoaded are running, but no text appears in the  dynamic text field (I should/want to see the word 'About'). I get this  error message:
    1120: Access of undefined property about_tab
    The problem, I'm guessing, is in the part in red in my code. I think I need to target the text field in the display list by creating a  reference to it. If so, could someonw point out how I do this, or perhaps a tutorial that would help. I've tried adding the word stage (i.e.,stage.about_tab.text =  substance.about_lbl; ) but it still doesn't connect. I guess there's something really simple I'm missing, so I  apologize if this comes across as a stupid question
    Thanks for any help.

    Hello flashrocket!
    I'm also new to AS3 and I've just started using external classes and I think I know what you should do to put your code to work.
    Instead of using the text field you created inside your flash file, why don't you use the "TextField" class to create an instance of this object? It's the exact same thing as when you create and instantiate a new text field inside Flash.
    First, import flash.text.*; (includes classes like TextField, TextFieldAutoSize, TextFormat, TextFormatAlign, etc)
    Than you just have to create a var like
    public var about_tab : TextField;
    or
    public var about_tab : TextField = new TextField();
    then, to adjust the properties of this tab you use dotsyntax as if it where on your stage like:
    about_tab.x = 50; about_tab.alpha = .5; etc...
    you can even create a function to "config your textField"
              private function createAndConfigTextField() : void {
                   about_tab = new TextField(); //you only need this line if you
              // only typed something like "public var about_tab:TextField;
              // if instead you used "public var about_tab:TextField = new TextField(); outside
              // this function, just skip this first line because you already have an instance of
              // text field named "about_tab"...
                            about_tab.autoSize = TextFieldAutoSize.CENTER;
                   about_tab.background = true;
                   about_tab.border = true;
                   var aboutTextFormat : TextFormat = new TextFormat();
                   format.font = "Arial";
                   format.color = 0x000000;
                   format.size = 11;
                   format.bold = true;
                   format.align = TextFormatAlign.CENTER;
                   about_tab.defaultTextFormat = aboutTextFormat;
                   addChild(about_tab);
    This is just an example of what you can do... I hope you get it... let me know if you have any doubt...

Maybe you are looking for

  • Can't see Windows 7 Boot Camp partition from Mac

    I've had a Win7 boot partition on my 2011 MBP for a while and it boots just fine. I have a Mac boot partition, a Mac data partition, and a NTFS Win 7 partition. But the Boot Camp partition is greyed out and invisible when booted in to the Mac. When i

  • Approval workflow triggers when not expected for SRM PO & without Agent ??

    Hi All, We are using SRM 5.0 integrated with SAP MM backends. We are frequently facing this problem, when a buyer  creates a PO (in SRM) within his/ her Spending (Output) Limit, the PO approval workflow triggers and is not able to find an agent. Alth

  • Matrix with group

    Hi all, I need to create a matrix which is as it is like that MRP result  grid. here i need to show 3 columns of my table as columns and another 4 columns as rows like group by  or sort by plz help me how to create this matrix plz its very importent

  • How do I download safari for mavericks

    I accidentally deleted safari on my computer. Need help on how to download or reinstall the mavericks version of safari.

  • Ipod Mini is not playing songs

    I put 74 songs on my ipod mini today. Whenever I select a song the meter at the bottom says 0:00 and skips it. I tried reseting and that did nothing.