dcsimg
A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Centering html styl dynamic text

  1. #1
    Senior Member NCsmartart's Avatar
    Join Date
    Feb 2003
    Location
    In an office cube
    Posts
    162

    Centering html styl dynamic text

    I load this in my text field and its left justified but if I view it in explorer its centered. Im sure there is some code to center the text that should probably be places in the load text code.

    here is my code

    loadVarsText = new loadVars();
    _root.org.wordWrap = true;
    loadVarsText.load("org.txt");
    loadVarsText.onLoad = function(success) {
    if (success) {
    trace("done loading");
    org.html = true;
    org.htmlText = this.var1;
    } else {
    trace("not loaded");
    }
    };

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You want the text centered?

    < p [align="left"|"right"|"center"]>

  3. #3
    Senior Member NCsmartart's Avatar
    Join Date
    Feb 2003
    Location
    In an office cube
    Posts
    162
    Hey oldnewbie still up?
    when I paste < p [align="center"]> behind var1= all the text that follows no longer shows up. here is my html txt file

    var1=
    <html>
    <head>
    <title>The Organization of Walters Companies</title>
    </head>
    <body>
    <center>
    <h2><strong>
    Walters Homes, Ltd. and Walters Commercial Builders</strong></h2><br><p>
    <h3><strong>
    David W. Walters (President)<br>Brian C. Tessau (Vice-President) <br>Jerry Steffen (Senior Project Manager)<br>
    Dave Schott (Construction Supervisor)<br>Jay Cowan (Construction Supervisor) <br><p>
    Walters Commercial Realty<br>Angela Tessau (President)<br><p>
    Walters Management<strong>Angela Tessau (President) <br>Jackie Klacik (Operations Manager <br>T.J. Patzner

    (Financial Manager) <br>Bo Braune (Maintenance Director) <br><p>
    <strong>
    Office Manager </strong><br>Robin Svadbik <br><p>
    <strong>
    Administrative Assistants</strong><br>Jonette Wisecup<br>Linda Page<br><p>
    <strong>
    General Counsel</strong><br>Phil Stover<br><p>
    </h3>
    </center>
    </body>
    </html>

  4. #4
    Senior Member NCsmartart's Avatar
    Join Date
    Feb 2003
    Location
    In an office cube
    Posts
    162
    oops

    I will just attach the txt
    Attached Files Attached Files

  5. #5
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Nah! Nah! Nah!

    No html page into Flash! Html formated text maybe, but only using these 11 html1.0 supported tags:

    http://www.macromedia.com/support/fl...s/htmltext.htm

  6. #6
    Senior Member NCsmartart's Avatar
    Join Date
    Feb 2003
    Location
    In an office cube
    Posts
    162
    The code (var1 = "(lessthn)p align=\"center\"(grthn)" is it in the right place because its error free but the text is not centered. The tutorial says to asign a var on the dynamic txt box but I assign my var with this code right. I have tried this several dif ways without success the tut is a little confusing since I am doing this a dif way.

    stop();
    loadVarsText = new loadVars();
    _root.org.wordWrap = true;
    loadVarsText.load("org.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
    org.html = true;
    org.htmlText = this.var1;
    var1 = "<p align=\"center\">";
    } else {
    trace("not loaded");
    }
    };

  7. #7
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Don't know what the bold is doing there?

    ...
    //contents of the variable
    org.html = true;
    org.htmlText = this.var1;
    var1 = "

    ";

    } else {
    trace("not loaded");
    }
    };...

    It should be...

    ...
    //contents of the variable
    org.html = true;
    org.htmlText = this.var1;
    } else {
    trace("not loaded");
    }
    };...

  8. #8
    Senior Member NCsmartart's Avatar
    Join Date
    Feb 2003
    Location
    In an office cube
    Posts
    162
    this is my orig code below, what I want to know is where this code should go and is it right.
    var1 = "ltp align=\"center\"gt";

    lt is less than sign and gt is well you know.

    stop();
    loadVarsText = new loadVars();
    _root.org.wordWrap = true;
    loadVarsText.load("org.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
    org.html = true;
    org.htmlText = this.var1;
    } else {
    trace("not loaded");
    }
    };

  9. #9
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    var1 is the variable that should start off your text file, and the align tag as any other tag goes in the text file, not in the LoadVars() code.

    var1=< p align='center'>< b>Your text< /b> follows here...

    Note no spaces between the "<" and the first character in the tag...

  10. #10
    Senior Member NCsmartart's Avatar
    Join Date
    Feb 2003
    Location
    In an office cube
    Posts
    162
    Dohhhhhhh!!!!!!!
    I tried it earlier but never close the tag thats why none of the text would show.
    Thanks,
    Thanks,
    and Thanks.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center