dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Formatting text from external file

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    336
    I have a textbox that is loading variables from an external textfile... when I typed out the textfile, I used an & before the variables..

    I have been trying to figure out how I can format the text.. I saw on a tutorial on here that the guy used HTML coding to change font size and color.. but in his tutorial he did not use an & before the variables, so i figure this had something to do with the HTML coding not working for me..

    can someone please explain this to me..

    thanks

    f.e.

  2. #2
    Junior Member
    Join Date
    Jul 2001
    Posts
    2

    text files

    well, are you trying to URL encode all of the text, or just use HTML to control the material?
    Have you got your information to appear from the text file at all?

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    336

    Re: text files

    Originally posted by bigmuffinass
    well, are you trying to URL encode all of the text, or just use HTML to control the material?
    Have you got your information to appear from the text file at all?
    yeah, the information appears fine.. but it only appears in whatever coding I give the text box in Flash.. I want to be able to manipulate it beyond that.. like at least make headers for the text..

    you can look at it if you want -
    http://ctr.usf.edu/kappasigma/realsite.html

    I'm not sure what you mean by URL encode the text?

  4. #4
    aCtioNScRipTer
    Join Date
    Feb 2001
    Posts
    274
    well, i'm not sure if that "&" is that necessary, coz I didn't use it infront of my variables and it worked. Btw, did u check the HTML box?? check it if u haven't.

    And i guess afterall it isn't that good to put in html codes because in HTML codings we normally have non-breaking spaces " ". It will take that as a new variable and everything after that all goes crazy.

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Posts
    264
    You MUST have the ampersand in front of every varible AFTER the first one. The first one doesn't actually require it although i think it's good practice if you do! If you don't put ampersands on variables after the first one, you'll get 'variableName=' with the variable value after it OK!

    This is how you do it if you want more than one variable from a single source being placed into more than one text box:

    IN YOUR text.txt file you got two variables, eg one called red and one called blue:

    Code:
    red=<FONT FACE="Times New Roman" SIZE="12" COLOR="#FF0000">Hello i am variable red, font Times, color red</FONT>
    
    &blue=<FONT FACE="Arial" SIZE="12" COLOR="#0000FF">Hello i am variable blue, font Arial, color blue</FONT>
    On _root you got 2 HTML enabled text boxes, one called "red" and one called "blue" the same as the variable declaration in the text file! (enable HTML for both text boxes)
    then load your variables from the text.txt with:

    Code:
    loadVariablesNum ("text.txt", 0);
    Thats it!

    Sam

  6. #6
    Senior Member
    Join Date
    Aug 2000
    Posts
    264
    You MUST have the ampersand in front of every varible AFTER the first one. The first one doesn't actually require it although i think it's good practice if you do! If you don't put ampersands on variables after the first one, you'll get 'variableName=' with the variable value after it OK!

    This is how you do it if you want more than one variable from a single source being placed into more than one text box:

    IN YOUR text.txt file you got two variables, eg one called red and one called blue:

    Code:
    red=<FONT FACE="Times New Roman" SIZE="12" COLOR="#FF0000">Hello i am variable red, font Times, color red</FONT>
    
    &blue=<FONT FACE="Arial" SIZE="12" COLOR="#0000FF">Hello i am variable blue, font Arial, color blue</FONT>
    On _root you got 2 HTML enabled text boxes, one called "red" and one called "blue" the same as the variable declaration in the text file! (enable HTML for both text boxes)
    then load your variables from the text.txt with:

    Code:
    loadVariablesNum ("text.txt", 0);
    Thats it!

    Oh a good tip! If you design your text layout and color etc in an HTML enabled text box in flash, and then make a duplicate and give it the same name, but disable HTML and enable "selectable", when you test / publish the movie ("CONTOL + RETURN") you get ALL your HTML code formatted automatically, this non-HTML text box to just cut n paste directly into your text.txt. Then you know that it will appear EXACTLY how you created it and never have to write any HTML at all coz flash does it all for you!

    Sam

  7. #7
    Senior Member
    Join Date
    Jul 2000
    Posts
    336

    thanks

    Thanks for the help everyone. I finally got it working. I figured out that I didn't have the HTML enabling box checked in the actual flash file.

    thanks again
    peace
    f.e.

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