View Full Version : short questions
Dark_Element
09-14-2004, 12:25 PM
im still a newbie :( so as a newbie i have a few questions. Please help me.
Questions:
-What is a projector file?
-How do you avoid ppl from pressing the rewind button? (it is annoying when its a socket app)
-How do you read stuff from multi leveled XML? (eg:
<data>
<foo p1="something" p2="somethingelse">
<bar>nothing</bar>
</foo>
</data>
how to get value of p1, p2, and bar?
That is all the small pieces of questions for now.
Thanks for your time
J.W_(Dark_Element)
emergency_pants
09-14-2004, 01:57 PM
Hi Dark_Element,
A projector file is an executable file which can run on any PC or Mac. Instead of publishing to a swf file, Flash will publish to an *.exe file. The exe file is totally self-contained and does not depend on the end user having flash player or flash plugin installed. Not great for delivering stuff online.
Rewind button... don't know.
Suppose you have an XML class object called "xmlObject" and the following is loaded into it... xmlObject.load("myfile.xml");
<data>
<foo p1="something" p2="somethingelse">
<bar>nothing</bar>
</foo>
</data>
To get p1:
xmlObject.firstChild.firstChild.attributes.p1
To get p2:
xmlObject.firstChild.firstChild.attributes.p2
To get bar:
xmlObject.firstChild.firstChild.firstChild
if there were lots of elements called "foo" you would use the childNodes[i] to get at whatever one you wanted. There's details in the Flash help under "XML class"
Hope that helps.
emergency_pants
09-14-2004, 02:19 PM
ah.. I just read your othe rpost about tiled maps... so your xml access will be something like this:
<root>
<row>
<square type="1">
<square type="3">
<square type="2">
</row>
<row>
<square type="1">
<square type="3">
<square type="2">
</row>
<square type="1">
<square type="3">
<square type="2">
</row>
</root>
That's a 3x3 xml set up.
To acces the third square of the second row:
xmlObject.firstChild.childNodes[1].childNodes[2]
That is: the firstChild(root), the second node of its childNodes (childNodes[1]) the third child of that childNode(childNodes[2])
In tile-based maps that I have made in the past, I have simply noted a "type" in the xml file and then processed that in Flash when the data is processed. So a certain "type" will determine whether a tile is walkable, which frame the tile should go to to show the correct terrain type, etc. NB: that saves you having to add 100x100 entry changes to your XML file if you want to add a new property to your square!
Hope that makes a bit of sense!!!!!!
Dark_Element
09-15-2004, 04:44 AM
thanks man. that helped a lot
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.