I would suggest to keep the loading of the parameter file simple and
create a ParameterFilesLoader class that would handle a queue of urls to
load in an array.
The class would eventually dispatch state events that your main class
would listen to, and show appropriate message to the user and handle the
state of your app.
Using mx.utils.Delegate and mx.events.EventDispatcher is a good practice
;) Ask me if you need some help building this stuff.
jcanistrum a écrit :
ok .. some of these solutions occurred to me, but are these solution the
best OO design pratices ?
Because depending on how deep this process goes it would be hard to detect
or explict to some one else what your app does,
I was expecting that would be possible, but I don´t know how to build
some event like
onAllXmlSucced or
onInitializationSuccess
that would be fired after all this XML reading using for example the Andre
suggestion on having an array or queue of events, but how to build my own
callBack function that would be fired after all the files were successfully
read ???
PS: I´d like to use these approach inside an AS 2.0 class with MTASC static
main style.
João Carlos
2006/6/7, Nitin Gore <[EMAIL PROTECTED]>:
Better way is you can use the recursion, If your XML files follows same
tags.
As below:-
>
..........................................................................
> 1.. var myParameters:XML = new XML();
> 2.. myParametersignoreWhite = true;
> 3.. myParameters.onLoad = function(success)
> 4.. {
> 5.. if ( success)
> 6.. {
> 7.. // get the Paramenters from myParameters
> 8.. // begin reading other XML files
> 9.. // wait for them to succed
myParameters.load("Other XML file");
> 10.. // start app
> 11.. }
> 12.. };
> 13.. myParameters.load("parameters.xml");
>
..........................................................................
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED] On Behalf Of eric dolecki
Sent: Wednesday, June 07, 2006 4:54 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] callBack for Beginners ?
you could daisy-chain function calls when xml documents get their onLoad(
success:Boolean)... that would work pretty well.
On 6/7/06, jcarlos <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I need help
>
> I trying to develop some small app that read a Parameters list from a
XML
> file and then if succeded, read other XML files as specified by the
> Parameters file and only after these files were read and succeed the
app
> would start, what is usually get with something like this
>
>
..........................................................................
> 1.. var myParameters:XML = new XML();
> 2.. myParametersignoreWhite = true;
> 3.. myParameters.onLoad = function(success)
> 4.. {
> 5.. if ( success)
> 6.. {
> 7.. // get the Paramenters from myParameters
> 8.. // begin reading other XML files
> 9.. // wait for them to succed
> 10.. // start app
> 11.. }
> 12.. };
> 13.. myParameters.load("parameters.xml");
> ....................................................................
>
> but I´m guessing how to do it in a clean way, because after some files
it
> gets messy and hard to read and mantain,
>
> how could I make each XML loading dispatch some special event after it
> succed to the main app and only after all events of all files occurred
it
> would start it ??
>
> Should the main app be implemented as some kind of OBSERVER pattern
where
> it stays listening to these events ?
>
> João Carlos
> Rio Brazil
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> 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
>
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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