A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: render dynamic text as html

  1. #1
    Denim Demon
    Join Date
    Jun 2002
    Location
    Outside of society
    Posts
    514

    render dynamic text as html

    I'm using loadVariables to enter text into a dynamic text field.
    When I don't click the 'render text as HTML' option, it works fine. But when I do choose this option, my text no longer loads in. Even if I don't mark up the text with any tags, it still doesn't load in.
    What am I doing wrong?

    My text box variable is myText.
    My text document that gets loaded in is called text.txt.
    The code on the first frame says:
    loadVariables ("text.txt", myText);

    The first line of the text document starts with
    myText=
    Davy Paycheck- Kicking more ass than your daddy on a 3 bottle night.

  2. #2
    FK Robot Wrangler

    Join Date
    Aug 2000
    Posts
    536
    try embedding the text by clicking "Characters" in the Properties palette and then selecting "All Characters".

  3. #3
    Junior Member
    Join Date
    Jul 2003
    Location
    Where there are no beaches
    Posts
    12
    I was having this same problem. Go to the posts for randomFlasher. There is a link to a tutorial that really helped me out. Also at the beginning of your text document, you need to use & to show that it is a variable.

    ex: &text=Anything you want to show up in your dynamic text box.

    Good luck.
    Jason

  4. #4
    Junior Member
    Join Date
    Jul 2003
    Location
    Where there are no beaches
    Posts
    12
    sorry, that last post was kind of vague as to where you can find help. Here is macromedia's tutorial. For html in a dynamic text box, it explains it at the bottom. tutorial

    Good luck!
    Jason

  5. #5
    Denim Demon
    Join Date
    Jun 2002
    Location
    Outside of society
    Posts
    514
    Ok.
    I just tried another one doing it this way:

    loadVariables ("test.txt", myText);
    theText.html=true;
    theText.htmlText=myText;

    That worked. I did NOT use the 'render as HTML' button.
    So my question now is, what's the point of having that button at all? Or is it just for publishing to Flash 5?
    Last edited by davyPaycheck; 07-30-2003 at 01:18 PM.
    Davy Paycheck- Kicking more ass than your daddy on a 3 bottle night.

  6. #6
    Member
    Join Date
    Apr 2002
    Location
    Whidbey Island WA
    Posts
    40

    Sorry, but that tutorial doesn't work for me.

    I am using LoadVars (the object) just like that tutorial is. DavyPayCheck is using the older method loadVariables. The tutorial does not mention any button. I don't even know where that button is. Maybe I need to find it.

    Anyway, if you understand it, can you tell me what I am doing wrong with my code? It seems like I am doing exactly what the tutorial suggests.

    I do use a few wrinkles because as usual, the tutorial assumes a few things, like on one LoadVars object. It also skips over what kind of file to upload. Should it be a html or txt? I tried both and it just displays the html tags (and not the whole file).
    I wonder if the fact that I generated it in word is part the problem. What I am trying to do is display in flash a large word document that uses word tables (I hate word). I wonder if word generated html is the problem. It seems to use xml too.

    Oh, I know I can make it a pdf, but that is a large file. And it uploads very slowly.

    stop();
    FP1LoadVars = new LoadVars();
    FP1LoadVars.load("Open2.html"); //I tried this with a txt file, same
    //result

    //assign a function which fires when the data is loaded:
    FP1LoadVars.onLoad = function(somesuccess) {
    if (somesuccess) {
    trace("done ");
    //Now that we know the data is loaded,
    //set the text content of the Text Field
    //with the instance name "Heavybox2" equal to the
    //contents of the variable GreetingP and tell the
    //player that the instance is set to
    //accept html.
    Heavybox2.htmlText = true;
    Heavybox2.htmlText = FP1LoadVars.GreetingP;
    gotoAndPlay("SecondLoad")
    } else {
    trace("not loaded");
    play();
    }
    };
    Tommy, the third orienteer

  7. #7
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Should be a simple .txt file (like with Notepad!).

    On a few supported html1.0 tags by Flash...

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

  8. #8
    Member
    Join Date
    Apr 2002
    Location
    Whidbey Island WA
    Posts
    40

    Yep. I've got it now.

    Yea. I found that out. I can always replace one problem with another. Now I have to figure out how to format HTML so it looks decent. I thought it would be a simple matter of taking a word file and converting it to html. But that does not work. I think word uses some coding that is beyond the Flash limitations (xml I think). It seems to call some file up. I may need to take a part of the file and put it in the launching html file (the one created by Flash).

    My son keeps telling me I should learn html. Well, I guess I need to work on it. The file was originally created in word and has a long table that compares one website to another. It is a class project. I wanted to display it on my Flash site. Well, as we know, nothing is easy.
    Tommy, the third orienteer

  9. #9
    Denim Demon
    Join Date
    Jun 2002
    Location
    Outside of society
    Posts
    514
    I already knew how to render dynamic text boxes as html for Flash MX. When I started this thread what I wanted to know is why the render text as html button doesn't work. It doesn't do anything.
    The methods discussed in this post work for Flash MX (which makes sense since this is a FMX board) but what if you want to publish backwards for F5 player?
    Also, what's the point of having a button on the properties panel if it doesn't work?
    I must be missing something here...
    Davy Paycheck- Kicking more ass than your daddy on a 3 bottle night.

  10. #10
    Member
    Join Date
    Apr 2002
    Location
    Whidbey Island WA
    Posts
    40

    One of life's little mysteries

    Yea. I know Davy. I was just riding your coattails. I had some issues, and I know everyone's gonna look at your post (It’s my inferiority complex). Sorry for taking your discussion afield.

    About that properties html button, I think it is an archeological artifact. Just a relic from the past. I do know that pushing it makes things worse not better (which suggests it actually does do something).
    Tommy, the third orienteer

  11. #11
    Denim Demon
    Join Date
    Jun 2002
    Location
    Outside of society
    Posts
    514
    Oh, well. No big deal.
    Davy Paycheck- Kicking more ass than your daddy on a 3 bottle night.

  12. #12
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Davy... That html tab does have it's utility! It all depends what you're using it for. Could you attach a mockup of the .fla you were mentioning in your first post (along with the text file, if there 's one envolved), and specify why you were actually setting the html tab?

  13. #13
    Member
    Join Date
    Apr 2002
    Location
    Whidbey Island WA
    Posts
    40

    Oh, about that LoadVars with HTML problem

    I already apologized about buttin in on Davy with my different problem and Davy forgave me (thanks Davy), but I should at least finish the story. (Least aways, long as I did but in, I arta finish buttin in).

    I forgot to tell ya'all that someone helped me with the code on that. The problem was the line that says:
    "Heavybox2.htmlText = true;"
    Should be:
    "Heavybox2.html = true;"

    And, as Oldnewbe said, use .txt not .html (that was just deperation).

    That solved my problem.
    (ok, that's it. I hain't buttin in no more. [promise])
    Tommy, the third orienteer

  14. #14
    Denim Demon
    Join Date
    Jun 2002
    Location
    Outside of society
    Posts
    514
    It's not a big deal. It's just that I thought you could publish an swf for the F5 player and use that tab to render dynamic text as html.
    I know how to do that the MX way... ie, making a text Object and accessing its methods such as html=true, or whatever.

    In the old days, couldn't you just pull in a txt file and then click that tab to render the mark up as html?
    Otherwise, what is that tab for?
    Davy Paycheck- Kicking more ass than your daddy on a 3 bottle night.

  15. #15
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    In MX you still can do it that way, and not using the AS ...html=true; bit... That's why I wanted to see your problematic .fla... There must of been something else that was preventing it from working properly.

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