include actionscript
- Started
- Last post
- 21 Responses
- stewart0
unfit, that was so unbelievably helpful. many thanks for that.
- stewart0
the result is still sort of zero.
please have a look at this, maybe it explains everything:
- stewart0
owkay, thanks, let's try that!
- urban100
if using unfit's format as your xml... you can pull in the xml data into flash using:
function xmlParser (success) {
listing = thisXML.firstChild.firstChild;
if (listing.hasChildNodes) {
if (listing.nodeName == "titles") {
listing = listing.nextSibling;
itemTitle = listing.attributes.title;
}
}
}dataXML = new XML();
dataXML.ignoreWhite = true;
dataXML.onLoad = xmlParser;
dataXML.load("data.xml");
- stewart0
thanks unfit, it looks great, but it still doesn't work,
is it because i have to 'parse' the xml in flash, or is...
load_xml = new XML();
load_xml.load('document.xml');...enough??
- unfittoprint0
use this instead
myArray.push(new Array(i+1, content[i].attribute s.title));
your xml should look like:
< titles >
< item title="asas" />
< item title="wew2" />
< item title="wew2123" />
. . .
< / titles >
- stewart0
thanks System, you made your point ;)
but i have to solve this little problem before tomorrow.all the rest is finished, i only have to put this piece of code dynamicaly into my swf file...
eehr... unfit?
where you saidmyArray[] = Array(i+1, content[i].attributes.title);
}it has to be something like
myArray[i] or something?man, i think i can't get this to work today.
this is my last flashthing ever, for sure...
- System-Idle0
http://www.ultrashock.com/ff.htm…
http://www.macromedia.com/devnet…
I am shure there are many better eg's out there than these, but is a starting point
- stewart0
okay, XML.
anyone with an example how to get...
myArray = new Array();
myArray[0] = Array(1,"title 01");
myArray[1] = Array(2,"title 02");
myArray[2] = Array(3,"title 03");
myArray[3] = Array(4,"title 04");...via XML into my swf file?
i never used the XML in Flash before, so a little push in the right direction can be very useful!
- System-Idle0
sorry, ignore that. go with the xml route if you want to use the array for e.g updating projets/content
- System-Idle0
can u not update it in flash using the array class functions?
see array class (flash help)
- stewart0
if you use "include" you will have to republish everytime you make changes.
j_red------
exactly!
but, silly question, how do i get this exact variable list i posted into my actionscript via XML ?
- unfittoprint0
shit.
I see you want to change your content, not exactly your code.You coul use an XML file to list all your tittles, and have an for loop to check for al the nodes an construct your array.
myArray = new Array();
content = myXML.firstChild.ChildNodes;
for(i=0; i { content.length; i++){
myArray[] = Array(i+1, content[i].attributes.title);
}
- j_red0
if you use "include" you will have to republish everytime you make changes.
if you want dynamic data, load it in via XML.
- unfittoprint0
well, as long as you use the include in the top of your code, you'll be able to change afterwards.
i think this is what you meant.
ps: this would probably be faster:
ntitle=20;
myArray = new Array()
for(i=0; i
- stewart0
urban, i can't use php because of the server type.
another thing is that editing the .as file is not my problem.
the problem is how to get that edited script back into my .swf file.
# include .as doesn't work in this case, because i don't want to re-publish the .swf file.
know what i mean??