PDA

View Full Version : CSS,XML With Flash


adobemove
05-16-2005, 05:16 AM
I was going over this tutorial on XML and CSS located here AS.ORG xmlcss (http://www.actionscript.org/tutorials/beginner/XML-Formatted_Content/index.shtml)

And was wondering if there is another way to go about doing this.
Because im using the Xmlconnector too load alot of data in this format and going through and adding drunken monkey to every line would suck and get confusing changing it.
-----------------------------------------------------------------------
the first line of xml looks something like this

<myXml>
<mcc id="1" title="WOW CSS" contents="IM STUCK" linkUrl="http://www.google.com" />

------------------------------------------------------------------------
and i was working on CSS something like this

.titlecss {
font-family: Arial, Helvetica, sans-serif;
font-size: 8px;
font-weight: bold;
color: #000000;
}


------------------------------------------------------------------------
Then im stuck with the ActionScript


var format = new TextField.StyleSheet();
var path = "mydoc.css";

// This is the part below im stuck on, Title is loaded with XML how can i change the paragraph break part <p>title</p> so it loads what
//the title really is in my xml into the titletxt instead of just the word title?

var titleformat = "<br><p class='titlecss'>title</p>";

format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
titletxt.styleSheet = format;
titletxt.text = titleformat;

} else {
titletxt.text = "Error loading CSS file!";
}
};

Thanks

MichaelxxOA
05-16-2005, 06:25 AM
this might be helpful.

http://www.createage.com/tutorials/xml_css_menu.htm

-Michael

adobemove
05-16-2005, 07:17 AM
yea ill have to check into the way you got the css changing the xml that might be it.
thanks

adobemove
05-16-2005, 10:26 AM
WOOT i figured it out after almost falling alseep going through livedocs trying to find a way then i seen the email adress ......
var address_str:String = "dog"+String.fromCharCode(64)+"house.net";
trace(address_str); // output: dog@house.net

AND then it dawned on me that i am a idiot or i just made a new friend called String.fromCharCode. Well for future referance anyone wanting to split strings up and combine them with special characters AND VARIABLES here ya go i give you.......

teh WATCHA TALKIN ABOUT WILLIS script

var format = new TextField.StyleSheet();
var path = "myCSS.css";

var titleformat:String = String.fromCharCode(60)+"p"+String.fromCharCode(32)+"class"+String.fromCharCode(61)+String.fromCharCode(39)+"titlecss"+String.fromCharCode(39)+String.fromCharCode(62)+t itle+String.fromCharCode(60)+String.fromCharCode(4 7)+"p"+String.fromCharCode(39);


format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
titletxt.styleSheet = format;
titletxt.text = titleformat ;
} else {
titletxt.text = "NO FREAKING Error's WHATCHA TALKING ABOUT WILLIS!";
}
};

notice title is not in quotes , ah im tired

jrk_productions
05-16-2005, 03:07 PM
im just wondering, can fromCharCode be used to display characters like å, æ , @ etc, in a dynamicly loaded text?