Results 1 to 5 of 5

Thread: textfield alignment from left to right

  1. #1
    brndn's Avatar
    1,096
    posts
    has cme t snuf da rooster

    Fla Script textfield alignment from left to right

    Hey all
    I have created a dynamic text area that populates via an xml feed.
    it works really well. I found the solution from someone here.

    the only thing is I have the languages change from english-russian-arabic.
    this works well but arabic needs to be align from the right.


    Code:
    MovieClip.prototype.resize = function() {
        var speed = 2;
        var w = box.caption.textWidth+5
        var h = box.caption.textHeight+5;
    
                this._width = w;
                this._height = h;
        
    };
    
            _root.x = 1;
            box.createTextField("Caption", 1, box.test._x+2, box.test._y+2, 230, 50);
            box.Caption.type = "dynamic";
            
            box.Caption.html = true;
            box.Caption.multiline = true;
            box.Caption.wordWrap = true;
            myformat = new TextFormat();
            box.Caption.size = 18;
            box.Caption.autoSize = "left";
            box.Caption.textColor = 0xffffff;
            myformat.font = "Arial";
            box.test.resize();
            
            box.Caption.setNewTextFormat(myformat);
            myformat.align = "right";
            box.setMask (scrollerMask);
            box.Caption.htmlText = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
    myformat.align = "right";
    this in my opinion should force the text alignment.
    I have tried textAlign box.text.align and so on.
    does anybody have any wisdom on the matter??

    cheers
    Last edited by brndn; September 4th, 2007 at 08:30 AM.

  2. #2
    Noct's Avatar
    332
    posts
    Toys in the attic...
    You just need to apply the align before you apply the format:
    Code:
    myformat = new TextFormat();
    myformat.size = 18;
    myformat.textColor = 0xffffff;
    myformat.font = "Arial";
    myformat.align = "right";
    box.Caption.setNewTextFormat(myformat);
    Just one dimension shy of a career in 3D gaming.

  3. #3
    brndn's Avatar
    1,096
    posts
    has cme t snuf da rooster
    cheers nocturnal.But no love with that method


  4. #4
    Noct's Avatar
    332
    posts
    Toys in the attic...
    Hmmm...Well, this exact code works when I test it:
    Code:
    box.createTextField("Caption", 1, box.test._x+2, box.test._y+2, 230, 50);
    box.Caption.type = "dynamic";
    box.Caption.html = true;
    box.Caption.multiline = true;
    box.Caption.wordWrap = true;
    myformat = new TextFormat();
    myformat.size = 18;
    myformat.autoSize = "left";
    myformat.textColor = 0xffffff;
    myformat.font = "Arial";
    //box.test.resize();
    myformat.align = "right";
    box.Caption.setNewTextFormat(myformat);
    //box.setMask(scrollerMask);
    box.Caption.htmlText = "<b>This is the text...This is more Text, This is even More....</b>";
    //box.Caption.htmlText = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
    So, it must have somehting to do with the XML file being pulled in if it doesn't work with your file... Not sure why it would matter really...Is the XML text being displayed?
    Just one dimension shy of a career in 3D gaming.

  5. #5
    brndn's Avatar
    1,096
    posts
    has cme t snuf da rooster
    yeh the xml text works fine.
    its kinda random.

    cheers anyway

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012