-
XML Game Quiz
I'm trying to fine tune these files.
Some of the code I think is unnessisary.
I have tried deleteing some of it but then the game does not work.
Code:
--------------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1" ?>
<questions>
<question difficulty="3" name="Fach: English">
<questiontext><![CDATA[ Do you think this is the first question?]]> </questiontext>
<answers>
<answer visible="true" rightone="true">
<![CDATA[ True]]>
</answer>
<answer visible="true" rightone="false">
<![CDATA[ False]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ Camel]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ Hippo]]>
</answer>
</answers>
</question>
<question difficulty="3" name="Deutsch">
<questiontext><![CDATA[ Is this the second question?]]> </questiontext>
<answers>
<answer visible="true" rightone="false">
<![CDATA[ False]]>
</answer>
<answer visible="false" rightone="true">
<![CDATA[ True]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ Second Camel]]>
</answer>
<answer visible="true" rightone="false">
<![CDATA[ Second Hippo]]>
</answer>
</answers>
</question>
<question difficulty="3" name="A.U.P.">
<questiontext><![CDATA[ Is this the third question?]]> </questiontext>
<answers>
<answer visible="true" rightone="true">
<![CDATA[ True ]]>
</answer>
<answer visible="true" rightone="false">
<![CDATA[ False]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ Another Hippo]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ No Camel this question]]>
</answer>
</answers>
</question>
</questions>
--------------------------------------------------------------------------
Can I delete these 3 lines from the code?
<question difficulty="3" name="Fach: English">
<question difficulty="3" name="Deutsch">
<question difficulty="3" name="A.U.P.">
-
Looks like the code did not paste correctly.
PHP Code:
<?xml version="1.0" encoding="iso-8859-1" ?>
<questions>
<question difficulty="3" name="Fach: English">
<questiontext><![CDATA[ Do you think this is the first question?]]> </questiontext>
<answers>
<answer visible="true" rightone="true">
<![CDATA[ True]]>
</answer>
<answer visible="true" rightone="false">
<![CDATA[ False]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ Camel]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ Hippo]]>
</answer>
</answers>
</question>
<question difficulty="3" name="Deutsch">
<questiontext><![CDATA[ Is this the second question?]]> </questiontext>
<answers>
<answer visible="true" rightone="false">
<![CDATA[ False]]>
</answer>
<answer visible="false" rightone="true">
<![CDATA[ True]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ Second Camel]]>
</answer>
<answer visible="true" rightone="false">
<![CDATA[ Second Hippo]]>
</answer>
</answers>
</question>
<question difficulty="3" name="A.U.P.">
<questiontext><![CDATA[ Is this the third question?]]> </questiontext>
<answers>
<answer visible="true" rightone="true">
<![CDATA[ True ]]>
</answer>
<answer visible="true" rightone="false">
<![CDATA[ False]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ Another Hippo]]>
</answer>
<answer visible="false" rightone="false">
<![CDATA[ No Camel this question]]>
</answer>
</answers>
</question>
</questions>
Last edited by tupps; 03-07-2005 at 10:38 PM.
-
please check xml file enclosed in zip
there is a line before each question.
I want to delete it.
<question difficulty="3" name"Fach: English">
-
<question difficulty="3" name="Fach: English">
-
Senior Member
Just added php tags around your code to make it appear.
Thanks
Luke
-
Senior Member
Why are you trying to optimise and what end result do you want (reduced load time, smaller downloads etc)?
-
I'm using this on a pocket pc, what to optimize the code in the XML file and FLA file.
-
I want to have the fla file to continue playing questions even if you get them wrong. Right now it ends if you get one wrong.
Last edited by keith30; 03-07-2005 at 11:30 PM.
-
-
Senior Member
Well the functionality of the flash app (keeps playing even if you questions wrong) is something that will require modification of the flash code not he XML file.
As for the XML file I can't see much room for optimising. Even on Pocket PC this should work pretty well. The only optimising I could see would be splitting the file into individual questions and loading them 1 at a time, but I don't think this is going to help.
Thanks
Luke
-
your suggesting if I have 400 questions, I have to have 400 XML files?
-
Senior Member
Not necessarily.
There are no guidelines for this sort of thing, but I am guessing any file (whether XML or text) with 400 questions will be quite big.
I suggest that you look at putting your questions in a database and deliver the data via a script (php asp etc).
Thanks
Luke
-
php? asp? does that work on pocket PC?
-
Senior Member
Are you trying to build this as a standalone app?
Thanks
-
Yes, it will be standalone app.
-
Do you have any suggestions for me?
-
Senior Member
Best thing to do is to test your app, work out how slow/fast it is. Then if it takes to long to load the XML files you could split them into a couple of chunks. There is no point optimising somethign that only takes a small amount of time.
The other option would be to embed the quiz data into the flash file, but then you would have to produce a new executable every time the questions update.
Thanks
Luke
-
Hi there,
if this is for a pocketPC app then i'd suggest using an old fashioned variable text file, rather than an xml file, as the resulting file would be smaller and there should be less processing time since there's no xml to parse.
i know it'd be a pain to maintain, but you could use php or something to generate the text file from a db, to be saved along with you flash app.
hope this helps,
Andy
-
Is there a way to convert my existing xml file to a txt file and have it work without much effort.
-
Can you explain what parsing is and how that affects xml? Or just send me a link I can read up on it. Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|