XML FLASH FORMATTING HMTL
- Started
- Last post
- 56 Responses
- wendog0
in the xml file, format each string as cdata , google for the correct syntax - as for the actual string, use CSS and HTML formatting to give it styles...just be aware that not all CSS is supported by flash, so something really fancy may not be supported...it shouldnt be too hard at all though, just be aware that more parsing of XML equals more loading time
- PonyBoy0
okay... first... you don't need the tags...
... second... 'bold' and 'italic' won't work unless a 'bold' font is embedded...
- PonyBoy0
you don't need the 'html' tags (pvn kicked that part out of my last post)...
- FrdmOfSpch0
http://rafb.net/p/pPwtt930.html
ok well i did it without the html tags and same deal. i've embedded all characters and no dice.
its prolly something with the text.html = true bit in flash.
the code is really complicated not sure where to execute it.
i'll return to this thread tomorrow when i can be fucked.
thanks for your help
over and out.
- PonyBoy0
dude...
... 'myTextfield_txt.text =' won't cut it...
... you need to use 'myTextfield_txt.htmlText =' if you want the html stuff in there:
The diff. in the two? '.htmlText =' vs. just '.text ='
- PonyBoy0
may I suggest you thoroughly read through kirupa's notes/tutorials on the subject?
Very informative... I recommend getting a cup of coffee and setting aside a few hours to fully go through all this stuff:
- FrdmOfSpch0
Yeah i read through that Kirupa already. Doesn't really explain putting HTML in XML, or if you know better link??
Is there a different solution to this? I'm willing to forego everything else formatting wise as long as i can put line breas in my XML text... is there a way of doing this without recourse to HTML?
t.i.a.
- UndoUndo0
you can use the html tgas supported by flash in yr xml nodes.
html support if limited so check it out and make sure you have yr text fields rendered for html text ie
myText.html = true
myText.htmlText = "yr string";
- st33d0
You're doing it wrong:
http://pastebin.coconut.se/?id=4…
And you should stick to the html. You are pretty much fucked as far as formatting tools in Flash go. Just once you get your head around the above example, look up external CSS styles in Flash so you can have your links appear a different colour.
- FrdmOfSpch0
fuck me.
i'm gonna spend a few hours on this and see what i come up with.
i'm not sure how you guys mean though cos basically your telling me to hardcode my xml string within actionscript? and format it using html there? where i want to load an external dynamically generated xml document that has html format in it, in only one node i.e. < article > < /article > node. the other notes < date > < /date > < time > < /time > < tags > < /tags > are not gonna have html etc...
i'll experiment a bit more and get back at yeah.
thanks.
- UndoUndo0
you should read the xml with actionscript, inside the nodes you read there can be html tags (only the ones supported by flash).
when you have yr text field in flash rendered as html and set its value to equal that of yr node containing the html, it will display it as you want.
- FrdmOfSpch0
so i can't have something as simple as line breaks any other way?
- UndoUndo0
this is the simplest way.
- st33d0
My code was just a compact demonstration. I didn't mean for you to take it literally - it was just to show you what working code looks like.
- joyride0
what exactly is your file not doing?
And what would you like it to do?
you can put whatever html you want in the xml file, but if flash cannot do anything with it, what's the point?
- cram0
html in your xml is the way to go. you do have to use the cdata stuff. you do have to use myfield.html = true; and myfield.htmlText = string; the text will disappear if you try to use bold on an embedded font unless you also embed the bold version. you can use system fonts if you don't want to embed the fonts. use the br tag for line breaks.
i know that this sounds confusing and it is at first but once you get it it really is quite easy. you are on the right path... good luck.
- FrdmOfSpch0
in myfield.htmlText = string
what is string?
- st33d0
createTextField("txt", 0, 200, 200, 200, 200);
txt.multiline = true;
txt.wordWrap = true;
txt.html = true;
txt.htmlText = "If you can't get your head round this, perhaps you need to give up";
- flavorful0
txt.htmlText = "If you can't get your head round this, perhaps you need to give up";
st33d
(Apr 10 07, 09:47)hahahhahaha
- cram0
string is whatever value you are passing from your xml.