homepage Welcome to WebmasterWorld Guest from 54.234.228.64
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
flash: dynamic text
containing & and <xml>
benihana




msg:1563901
 4:47 pm on Nov 4, 2003 (gmt 0)

im loading text from a php script into dynamic text boxes in flash mx2004. unofrtunately some of it contains &amps;, some xml tags and other whatnot. when flash encounters one it stops reading that particular text and cuts off in mid sentance.

i dont really want to strip them out server side as the xml tags will be handy.

also, the same text boxes wont show apostrophes ' - just the square box you get when a characters not availabe.

any ideas how to get round this?

cheers
ben

 

winstun




msg:1563902
 6:55 pm on Nov 4, 2003 (gmt 0)

G'day, Ben.

Regarding the ampersands, when flash recieves variables from an outside source, eg. a text file or an echo from php, an ampersand is read as an introduction to a new variable name.

For example if the following was in a text file:
&var1=some text&var2=some other text
Flash thinks it is loading 2 separate variables named var1 and var2.

The only way that I know of to get around this is to use String.fromCharCode(38). Where 38 is the unicode value of an ampersand.

eg.
myVar = "some text "
myVar += String.fromCharCode(38);
myVar += " some more text"

Result: some text & some more text

I'm not sure of an easy work around for this problem in your case.

----------------------------------------

Your other question regarding apostrophes could be simpler.
If you are using an embedded font and that font does not have an apostrophe in it is the first thing that comes to mind.

Now if this were a string written within Flash I would suggest using a backward slash [\] in conjunction with the [']. As the [\] is used before various characters for differing effects.

eg.
\n is a new line, \" shows quotes, \t tabs the string.

You could try this method in your echo, but no guarantees as I don't have access to a php server handy atm. I only tested this from a text file and the slashes showed up in the text field .

... so after all this I really don't have an easy answer for you.
8~/
Sorry.

G'luck.

benihana




msg:1563903
 11:06 am on Nov 5, 2003 (gmt 0)

winstun -- thanks again for your help.

im a bit perplexed on the apostrophes - im using verdana and not embedding.

cheers

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved