A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Problems displaying space character in dynamic htmltext

  1. #1
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262

    Problems displaying space character in dynamic htmltext

    i am loading text from a TXT file called myText.txt into a dynamic text field called myTextField using loadVars.

    myText.txt contains the following:

    PHP Code:
    &mainText=<p><a href="#">watch video (10 mb)</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="interview/interview-01.html" target="_blank">read transcript</a></p
    my loadVars code is set out below:

    PHP Code:
    //load relevant text file.
    var textVar = new LoadVars();
    textVar.onLoad = function(ok) {
      if (
    ok) {
        
    myTextField.htmlText this.mainText;
      }
    };

    textVar.load("myText.txt"); 
    basically, i want to display two links ("watch video" and "read transcript") on the same line separated by 4 spaces. if i type the spaces in manually, only one appears. if i use the html equivalent of a space character & n b s p ;, loadVars interprets everything following the first & as a new variable.

    i tried using the "\" character to have flash ignore the &, but that doesn't seem to work.

    anyone have any ideas?

    thanks a lot.

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Try the + character.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262
    thanks, that doesn't work exactly as i'd like it to. it does add a space, but only if there is something else there. for example...

    PHP Code:
    &mainText=<p><a href="#">watch video (10 mb)</a>++++<a href="interview/interview-01.html" target="_blank">read transcript</a></p
    ...displays: watch video (10mb)read transcript

    but....

    PHP Code:
    &mainText=<p><a href="#">watch video (10 mb)</a>++++hello++++<a href="interview/interview-01.html" target="_blank">read transcript</a></p
    ...displays: watch video (10mb)&nbsp;&nbsp;&nbsp;&nbsp;hello&nbsp;&nbsp;&nb sp;&nbsp;readtranscript

    maybe i'll just throw an "or" there?

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Have you tried a space instead of a hello, or url encode spaces.....

    %20 is the replacement for space.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262
    i tried & n b s p; and %20, but neither seems to work. is that what you meant?

  6. #6
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    You can not use &nbsp as it contains a & character, which is used solely to separate variables. The %20 should work fine.

    What I meant is that if you use + characters and they seem to work only when something else is added between them, try a ordinary space ( in between ).

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  7. #7
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262
    this is what i tried, and it doesn't work... at least not for me.

    PHP Code:
    &mainText=<p><a href="#">watch video (10 mb)</a>++++%20++++<a href="interview/interview-01.html" target="_blank">read transcript</a></p
    it ends up displaying: watch video (10mb)read transcript

    if you got it to work, please let me know how, otherwise i'll just add the "or".

    thanks a lot for all your help. i really appreciate it.

  8. #8
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I meant space like ++++ ++++ ,that may be enough.

    Or >+++++read transcript

    It may be that you place your spaces between tags and not before or after text.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  9. #9
    Senior Member ceglia's Avatar
    Join Date
    Jan 2003
    Location
    Los Angeles
    Posts
    262
    hey pellepiano,

    i had tried ++++ ++++ and that didn't work.

    your second suggestion, >+++++read transcript, does work. the only drawback, and it's a minor one, is that the hit area of the link includes the area occupied by the +++++. not a big deal though.

    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