Thanks Henry - I am going to go with the XML route as I did not have much
joy with getting the JSON up and running anyway.

My plan is to load all the xml data into an array when the CDROM starts...

So my xml file would be something like this

<sections>

        <section>                               
                <navLabel>1_0</navLabel>
                <bgImage>section1_bg.jpg</bgImage>  
                <videoClip>none</videoClip>
                <previousButtonDisplay>no</previousButtonDisplay>
                <nextButtonDisplay>yes</nextButtonDisplay>
                
        </section>


        <section>
                <navLabel>1_1</navLabel>
                <bgImage>section1_bg.jpg</bgImage>  
                <videoClip>1_0.flv</videoClip>
                <previousButtonDisplay>no</previousButtonDisplay>
                <nextButtonDisplay>yes</nextButtonDisplay>

                
        </section>
        
        
</sections>

And to load the xml file the following:

sectionData = new XML();
sectionData.ignoreWhite = true;
sectionData.load("media/xml/sections.xml");


sectionData.onLoad = function(success){
        if(success){
                
                //
----------------------------------------------------------
                // The XML document loaded without error, continue
processing
                //
----------------------------------------------------------
        
        
                rootNode = this.firstChild;             
                
                How_Many_Sections = rootNode.childNodes.length;
                                
                Section_Data = new Array();
                
                for (var vSection_Index=0; vSection_Index<How_Many_Sections;
vSection_Index++) { 
                
                        var vNavLabel  =
rootNode.childNodes[vSection_Index].childNodes[0].firstChild.nodeValue;

                        var vVideoClip =
rootNode.childNodes[vSection_Index].childNodes[1].firstChild.nodeValue;

                                                
                        var vData_For_One_Section = new Array();
                        
                        vData_For_One_Section.navLabel = vNavLabel;
                        vData_For_One_Section.videoClip = vVideoClip;

                        
                        Section_Data.push(vData_For_One_Section);

                
                }       
                
        currentSectionIndex = 0;
                
                
    } else {
                // The XML document could not be loaded, stop processing.
    }

I am basing this on an xml quiz I did a while back however I do like how you
have used a "name" property. I will read up on this as I am not keen on
retrieving the properties using 

var vNavLabel  =
rootNode.childNodes[vSection_Index].childNodes[0].firstChild.nodeValue; 

Thanks

Paul



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Henry Cooke
Sent: 30 January 2007 15:05
To: Flashcoders mailing list
Subject: Re: [Flashcoders] JSON vs. XML for CDROM configuration

I'd probably do that in XML, as what you're defining is a bunch of different
sections, each with a number of different properties. A simple text config
is more suitable for basics like screen size, basic interface text strings,
resource locations etc (IMHO)

I'd probably do it something like this:

<section name="sectionName" navLabel="[nav mc label]">
 <title>Section Title</title>
 <clip name="someMovie.flv">
 <button name="forward" display="yes">
 <button name="backward" display="no">
 etc...
</section>

And repeat that section node a whole bunch of times for all your sections.
You'll need to read up on the XML class as to how to parse this in a useful
way for you though...

h.


On 30/01/07, Paul Steven <[EMAIL PROTECTED]> wrote:
>
> Thanks Ian for the useful advice. I would appreciate your thoughts and
> indeed the thoughts of anyone else,  on my use of a config file for this
> project.
>
> Not sure if a config file is the best solution for what I am doing.
> Basically the CDROM consists of 60 separate pages / sections. I have just
> used 60 labels on the timeline for these
>
> e.g
>
> 1_1
> 1_2
> 2_1
> 2_2
> Etc
>
> I have not created separate swf files for each of the 60 sections as the
> content of most sections is simply a video clip or one sentence of text. I
> therefore thought it was more manageable to keep all the sections within
> one
> flash movie. All video clips are external flv files.
>
> I have also set up the navigation menu like this, with 60 labels.
>
> The idea of using a config file is to set various things for each section
> such as:
>
> What video clip to play
> The Page title
> Which label of the navigation menu mc to display
> Which buttons to display e.g forward / backward
> Which label to navigate to when any button is clicked
> Assign actions to visible buttons
>
> etc
>
> The idea of doing it this way is to prevent there being lots of code in
> all
> the 60 labels across the timeline.
>
> Hence the configuration file would have details of what actions to take
> upon
> arriving at each of the 60 sections.
>
> Does the above solution sound like the right way to go? Or can you suggest
> a
> better solution. The application is PC only and is being developed with
> Flash 8.
>
> Thanks
>
> Paul
>
>
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
> Sent: 30 January 2007 08:27
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] JSON vs. XML for CDROM configuration
>
> We've had absolutely no problem reading text files from CD-ROM using Flash
> 8. :-)
>
> XML/JSON wouldn't be any faster to read in.
>
> I'd choose XML if you had a much more complex configuration task that
> needed
> lots of nested config (unlikely unless you've got a huge sprawling app -
> you
> can handle most situations by choosing your key=value keynames
> appropriately) or if your config involved chunks of (possibly unicode)
> textual data.
>
> I wouldn't use JSON for configuration as I find it far less readable -
> it's
> primarily a serialisation/data interchange format rather than a
> configuration file format. Additionally, it ties you to a particular
> implementation/data layout in your app; whereas if, for whatever reason,
> you
> wanted other apps to read your key/value pairs plain text file (for
> example,
> for patching or updating or simply cataloguing) then it's very
> straightforward.
>
> Cheers,
>   Ian
>
> On 1/30/07, Paul Steven <[EMAIL PROTECTED]> wrote:
> >
> > Hmm good point Ian.
> >
> > Any reason why people would use xml or json files rather than plain
> text?
> > Ease of editing, speed of loading etc?
> >
> > With regards security implications, just wanted to be sure there was no
> > problem reading data from the CDROM as I am sure I read somewhere about
> > some
> > issue that arised with Flash 8.....
> >
> > Thanks
> >
> > Paul
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Ian
> Thomas
> > Sent: 30 January 2007 08:08
> > To: Flashcoders mailing list
> > Subject: Re: [Flashcoders] JSON vs. XML for CDROM configuration
> >
> > Um - surely there's a third option, which is plain text? It does depend
> > what
> > you're configuring, but our external configuration files look like
> > java.properties files:
> >
> > language=en
> > useDirectX=true
> >
> > etc. etc.
> >
> > We just read them in using LoadVars (overriding onData) and parse them.
> > Very
> > straightforward.
> >
> > Security implications etc. - well, that entirely depends what you're
> > trying
> > to protect against, and what info you're putting in the configuration
> > file.
> > In general, if the config file is on the CD itself, it's unchangeable,
> so
> > I
> > don't see a huge issue?
> >
> > Unless I've got the wrong end of the stick and you're talking about
> > configuring a CD-ROM app via a net connection (some sort of activation
> > system) - in which case ignore me. :-)
> >
> > Ian
> >
> > On 1/30/07, Paul Steven <[EMAIL PROTECTED]> wrote:
> > >
> > > I am creating a CDROM application (Flash 8 PC only) and would like to
> > > control it with an external configuration file.
> > >
> > > >From what I can see, I have a choice of a XML or JSON solution - can
> > > anyone
> > > recommend one over the other?
> > >
> > > Also if anyone has a link to a working version of JSON and JSONConfig,
> > > then
> > > I would appreciate it as the version I downloaded is giving me several
> > > errors.
> > >
> > > Any pointers on the use of a configuration file for a CDROM also
> > > appreciated
> > > - such as any problems I could encounter with security etc
> > >
> > > Thanks in advance
> > >
> > > Paul
> > >
> > > _______________________________________________
> > > [email protected]
> > > To change your subscription options or search the archive:
> > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > >
> > > Brought to you by Fig Leaf Software
> > > Premier Authorized Adobe Consulting and Training
> > > http://www.figleaf.com
> > > http://training.figleaf.com
> > >
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to