[flexcoders] loading xml

2006-08-12 Thread aaron smith



how do I load local XML? I was doing this:private function loadXML():void        {            myXML = new XML();            myXMLURL = new URLRequest(XML_URL);            myLoader = new URLLoader("
menu.xml");            myLoader.addEventListener("complete", xmlLoaded);        }                private function xmlLoaded():void        {            myXML = XML(myLoader.data);

            trace("Data loaded.");        }but it spits out errors. Is there security issues?here are the errors..SWF file file:///C|/Documents%20and%20Settings/aaronsh/Desktop/dev/flash/%5F%20AS3%20TESTING/3waylayout/classes/Main.swf
 cannot access local resource file:///C|/Documents%20and%20Settings/aaronsh/Desktop/dev/flash/%5F%20AS3%20TESTING/3waylayout/classes/menu.xml
. Only local-with-filesystem and trusted local SWF files may access local resources.Do i need to do something different for local files? I would think it would be the same as how you load from a URL... 
thanks.


__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   



  




  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Loading XML

2010-02-02 Thread ztpi1
I am getting a security error when trying to load an xml file into my swf. The 
xml and swf are right next to each other in the same directory. What gives? 
From what I understand, the swf should have access to the xml file. I have no 
problem loading jpg, or png. 



Re: [flexcoders] loading xml

2006-08-13 Thread list
Looks like you need to use the mxmlc compiler argument '-use- 
network=false' when compiling your application.

Flex livedocs entry on this topic: http://livedocs.macromedia.com/ 
flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm? 
context=LiveDocs_Parts&file=1500.html

You're code also looks a bit odd to me. I don't believe it will  
compile because the URLLoader constructors requires a URLRequest and  
won't accept a string value. I'm guessing you meant

myLoader = new URLLoader(myXMLURL);

HTH

Chafic

On Aug 12, 2006, at 8:45 PM, aaron smith wrote:

> how do I load local XML?
>
> I was doing this:
>
> private function loadXML():void
> {
> myXML = new XML();
> myXMLURL = new URLRequest(XML_URL);
> myLoader = new URLLoader(" menu.xml");
> myLoader.addEventListener("complete", xmlLoaded);
> }
>
> private function xmlLoaded():void
> {
> myXML = XML(myLoader.data);
> trace("Data loaded.");
> }
>
>
>
> but it spits out errors. Is there security issues?
>
> here are the errors..
>
> SWF file file:///C|/Documents%20and%20Settings/aaronsh/Desktop/dev/ 
> flash/%5F%20AS3%20TESTING/3waylayout/classes/Main.swf cannot access  
> local resource file:///C|/Documents%20and%20Settings/aaronsh/ 
> Desktop/dev/flash/%5F%20AS3%20TESTING/3waylayout/classes/menu.xml .  
> Only local-with-filesystem and trusted local SWF files may access  
> local resources.
>
> Do i need to do something different for local files? I would think  
> it would be the same as how you load from a URL...
>
> thanks.
>
> 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] loading xml

2006-08-13 Thread Samuel Colak


Aaron,there is a space in the filename " menu.xml" and i also think it might be in the resources directory - try "resources/menu.xml" - when you go and publish this you need to be aware that the relative path is from the root of the webserver - not the path of the flash file.I have a nice utility library which does this and also loads jpgs etc in a queue fashion if you are interested.RegardsSamuelOn 13 Aug 2006, at 02:45, aaron smith wrote:how do I load local XML? I was doing this:private function loadXML():void        {            myXML = new XML();            myXMLURL = new URLRequest(XML_URL);            myLoader = new URLLoader(" menu.xml");            myLoader.addEventListener("complete", xmlLoaded);        }                private function xmlLoaded():void        {            myXML = XML(myLoader.data);            trace("Data loaded.");        }but it spits out errors. Is there security issues?here are the errors..SWF filefile:///C|/Documents%20and%20Settings/aaronsh/Desktop/dev/flash/%5F%20AS3%20TESTING/3waylayout/classes/Main.swf cannot access local resourcefile:///C|/Documents%20and%20Settings/aaronsh/Desktop/dev/flash/%5F%20AS3%20TESTING/3waylayout/classes/menu.xml . Only local-with-filesystem and trusted local SWF files may access local resources.Do i need to do something different for local files? I would think it would be the same as how you load from a URL... thanks.
__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   



  




  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___


RE: [flexcoders] loading xml

2006-08-13 Thread Franck de Bruijn












I use a function like this:

 

private
function loadXml(aXmlFileName:String, aResultCallBack:Function):void

{

  var
xmlLoader:HTTPService;

  

  xmlLoader
= new HTTPService();

  xmlLoader.resultFormat
= "e4x";

  xmlLoader.url
= "">

  xmlLoader.addEventListener("fault",
Application.application.handleFault);

  xmlLoader.addEventListener("result",
aResultCallBack);

  xmlLoader.send();

}

 

The URL ‘aXmlFileName’ follows
the format "config/MasterData.xml" for example, where config is a
directory in the folder where the Flex application has been downloaded from.

 

In your callback function, you can deal
with the XML as follows:

 

private
function handleMasterDataXmlLoaded(aEvent:ResultEvent):void

{

 
var masterDataXml:XML;

  masterDataXml
= aEvent.result as XML;

}

 

HTH,

Franck

 









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of aaron smith
Sent: Sunday, August 13, 2006 2:45
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] loading xml



 







how do I load local XML? 

I was doing this:

private function loadXML():void
        {
            myXML = new XML();
            myXMLURL = new
URLRequest(XML_URL);
            myLoader = new
URLLoader(" menu.xml");
            myLoader.addEventListener("complete",
xmlLoaded);
        }
        
        private function xmlLoaded():void
        {
            myXML = XML(myLoader.data);
            trace("Data loaded.");
        }



but it spits out errors. Is there security issues?

here are the errors..

SWF file file:///C|/Documents%20and%20Settings/aaronsh/Desktop/dev/flash/%5F%20AS3%20TESTING/3waylayout/classes/Main.swf
cannot access local resource file:///C|/Documents%20and%20Settings/aaronsh/Desktop/dev/flash/%5F%20AS3%20TESTING/3waylayout/classes/menu.xml
. Only local-with-filesystem and trusted local SWF files may access local
resources.

Do i need to do something different for local files? I would think it would be
the same as how you load from a URL... 

thanks.






__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   



  




  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






Re: [flexcoders] loading xml

2006-08-13 Thread aaron smith



Ok question about using the -use-network switch.why do you have to use that to access local files. That just seems like a pain. why would you have to switch back and forth depending on you're build type. DEV sv LIVE. What if in some cases you're DEV version needs to access network for remoting or wsdls? Or services other vendor's provide..
Is this absolutely neccessary to use in order to access local file system?thanks.On 8/13/06, Samuel Colak <
[EMAIL PROTECTED]> wrote:












  



Aaron,there is a space in the filename " menu.xml" and i also think it might be in the resources directory - try "resources/menu.xml" - when you go and publish this you need to be aware that the relative path is from the root of the webserver - not the path of the flash file.
I have a nice utility library which does this and also loads jpgs etc in a queue fashion if you are interested.RegardsSamuel
On 13 Aug 2006, at 02:45, aaron smith wrote:
how do I load local XML? 
I was doing this:
private function loadXML():void
        {            myXML = new XML();
            myXMLURL = new URLRequest(XML_URL);            myLoader = new URLLoader(" 
menu.xml");            myLoader.addEventListener("complete", xmlLoaded);
        }
                private function xmlLoaded():void
        {
            myXML = XML(myLoader.data);            trace("Data loaded.");
        }
but it spits out errors. Is there security issues?
here are the errors..
SWF filefile:///C|/Document
s%20and%20Settings/aaronsh/Desktop/dev/flash/%5F%
20AS3%20TESTING/3waylayout/classes/Main.
swf cannot access local resource
file:///C|/Documents%20and%20Settings/aaronsh/
Desktop/dev/flash/%5F%20AS3%20TESTING/3waylayout/
classes/menu.xml . Only local-with-filesyst
em and trusted local SWF files may access local resources.
Do i need to do something different for local files? I would think it would be the same as how you load from a URL... 
thanks.


  















__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   



  




  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] loading xml

2006-08-13 Thread Raffaele Sena

I had the same questions and I did some testing today.

If you are using URLLoader.load you don't have to use the use-network 
compiler switch.

Assuming you are using relative URLs, as in URLLoader.load(new 
URLRequest("data.file")), you will be able to load from local to local 
(when testing your app in FlashBuilder) and remote to remote (when you 
deploy).

I think the compiler switch is for (remote ?) applications that use 
local data files (so they can either use only local data files or only 
remote data files)

-- Raffaele


aaron smith wrote:
> Ok question about using the -use-network switch.
> 
> why do you have to use that to access local files. That just seems like 
> a pain. why would you have to switch back and forth depending on you're 
> build type. DEV sv LIVE. What if in some cases you're DEV version needs 
> to access network for remoting or wsdls? Or services other vendor's 
> provide..
> 
> Is this absolutely neccessary to use in order to access local file system?
> 
> thanks.
> 
> 
> 
> 
> 
> On 8/13/06, *Samuel Colak* < [EMAIL PROTECTED] 
> > wrote:
> 
> 
> Aaron,
> 
> there is a space in the filename " menu.xml" and i also think it
> might be in the resources directory - try "resources/menu.xml" -
> when you go and publish this you need to be aware that the relative
> path is from the root of the webserver - not the path of the flash
> file.
> 
> I have a nice utility library which does this and also loads jpgs
> etc in a queue fashion if you are interested.
> 
> Regards
> Samuel
> 
> 
> On 13 Aug 2006, at 02:45, aaron smith wrote:
> 
>> how do I load local XML?
>>
>> I was doing this:
>>
>> private function loadXML():void
>> {
>> myXML = new XML();
>> myXMLURL = new URLRequest(XML_URL);
>> myLoader = new URLLoader(" menu.xml");
>> myLoader.addEventListener("complete", xmlLoaded);
>> }
>>
>> private function xmlLoaded():void
>> {
>> myXML = XML(myLoader.data);
>> trace("Data loaded.");
>> }
>>
>>
>>
>> but it spits out errors. Is there security issues?
>>
>> here are the errors..
>>
>> SWF filefile:///C|/Document
>> s%20and%20Settings/aaronsh/Desktop/dev/flash/%5F%
>> 20AS3%20TESTING/3waylayout/classes/Main. swf cannot access local
>> resource file:///C|/Documents%20and%20Settings/aaronsh/
>> Desktop/dev/flash/%5F%20AS3%20TESTING/3waylayout/ classes/menu.xml
>> . Only local-with-filesyst em and trusted local SWF files may
>> access local resources.
>>
>>
>> Do i need to do something different for local files? I would think
>> it would be the same as how you load from a URL...
>>
>> thanks.
>>
> 
> 
>  !DSPAM:44df440397918033519354!


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [flexcoders] Loading XML

2010-02-02 Thread cholid cholid
can you tell how you call the xml is?





From: ztpi1 
To: flexcoders@yahoogroups.com
Sent: Wed, February 3, 2010 8:53:59 AM
Subject: [flexcoders] Loading XML

  
I am getting a security error when trying to load an xml file into my swf. The 
xml and swf are right next to each other in the same directory. What gives? 
From what I understand, the swf should have access to the xml file. I have no 
problem loading jpg, or png. 


 


  

[flexcoders] loading xml with AS3

2006-08-11 Thread aaron smith



I'm having troubles figuring out where the functionality to load xml went. What classes do i use to load xml?thanks

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   



  




  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Loading XML question again.

2006-09-18 Thread aaron smith



when I run this i get a runtime error about not being able to access
local files. If I comment out the local xml file reference and
uncomment the reference to sephirot's xml file. it works fine. 



How can this be used to load local XML? And i think using the compiler
switch to allow local access is not a good solution. in a previous post
i mentioned not being able to use http when allow loca lis on, well
then if you have vendors with services you rely on, you can't test dev
builds with that compiler switch. Here is my code to load some xml.Startup.as:::package{        import flash.net.URLLoader    import flash.net.URLRequest    import 
flash.events.*    import XPLogger;        public class Startup    {        private var mainXML:XML;        private var loader:URLLoader;                public function Startup()        {
            loader = new URLLoader();            loader.addEventListener(Event.COMPLETE, onComplete);            //loader.load(new URLRequest("
http://www.sephiroth.it/tutorials/flashPHP/E4X/files/test.xml"));            loader.load(new URLRequest("xml/test.xml"));        }                private function onComplete( e:Event ):void
        {            mainXML = new XML(loader.data);            XPLogger.debug( loader.data );            XPLogger.debug( "xml loaded, start parsing using E4X syntax" );        }    }
}

Now the other thing im wondering about is if FlexBuilder somehow
manages this internally when you're compiling the swfs. I am using
FlashDevelop for this. I know someone mentioned all you have to do is
use URLLoader and URLRequest. but it sure doesn't work for me. 

can someone test this code and see if it works for FlexBuilder? 

or if somone can create an example that works, help me out.

Thanks all!PS: here is the XPLogger class:::XPLogger.as::: (use Xpanel logger)package {        import flash.net.LocalConnection;    import flash.utils.getTimer;
    public class XPLogger extends Object    {        private static var s_lc:LocalConnection = null;        public static var enabled : Boolean = true;        public static var level   : Number  = LEVEL_ALL;
        public static var LEVEL_DEBUG:int   = 0x01;        public static var LEVEL_INFORMATION:int = 0x02;        public static var LEVEL_WARNING:int = 0x04;        public static var LEVEL_ERROR:int   = 0x08;
        public static var LEVEL_NONE:int    = 0xFF;        public static var LEVEL_ALL:int = 0x00;                public static function debug( o : Object ):void        {            _send( LEVEL_DEBUG, o );
        }        public static function info( o : Object ):void        {            _send(LEVEL_INFORMATION, o );        }        public static function error( o : Object ):void        {
            _send( LEVEL_ERROR, o );        }        public static function message( o : Object ):void        {            _send( LEVEL_INFORMATION, o );        }        public static function warn( o : Object ):void
        {            _send( LEVEL_WARNING, o );        }        public static function warning( o : Object ):void        {            _send( LEVEL_WARNING, o );        }        public static function trace( o : Object ):void
        {            _send( LEVEL_DEBUG, o );        }        private static function _send( _level_:Number, o:Object ):void        {            if( _level_ < level )                return;
            if( s_lc == null )                s_lc = new LocalConnection();            s_lc.send( "_xpanel1", "dispatchMessage", flash.utils.getTimer(), ( typeof o =="xml" ? 
o.toXMLString() : " " + o ), _level_ );        }    }}

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  






  
  Your email settings: Individual Email|Traditional 
  Change settings via the Web (Yahoo! ID required) 
  Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured 
   
Visit Your Group 
   |
  
Yahoo! Groups Terms of Use
   |
  
   Unsubscribe 
   
 

  




__,_._,___



RE: [SPAM] Re: [flexcoders] Loading XML

2010-02-02 Thread Tracy Spratt
Yes, the physical location is not what matters, it is the domains.  Post the
error message, it will tell us a lot.

 

Often times people will launch their app using a file url, an then try to
access a resource via a net url, this will produce a security error.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of cholid cholid
Sent: Tuesday, February 02, 2010 10:49 PM
To: flexcoders@yahoogroups.com
Subject: [SPAM] Re: [flexcoders] Loading XML

 

  

can you tell how you call the xml is?

 

  _  

From: ztpi1 
To: flexcoders@yahoogroups.com
Sent: Wed, February 3, 2010 8:53:59 AM
Subject: [flexcoders] Loading XML

  

I am getting a security error when trying to load an xml file into my swf.
The xml and swf are right next to each other in the same directory. What
gives? From what I understand, the swf should have access to the xml file. I
have no problem loading jpg, or png. 

 





Re: [SPAM] Re: [flexcoders] Loading XML

2010-02-03 Thread Peeyush Tuli
All requests to load resources are HTTP requests  in Flex.flex is not the
best at returning you the exact HTTP status codes in these situations(which
will tell you the true reason for the error). Try using an HTTP traffic
monitor like

http://www.charlesproxy.com/

It will tell you exactly what causes the error. you can post the HTTP
traffic dump which we could analyze.

I believe flex 4 also has a network monitor which can be used during
development time.

On Wed, Feb 3, 2010 at 11:27 AM, Tracy Spratt  wrote:

>
>
>  Yes, the physical location is not what matters, it is the domains.  Post
> the error message, it will tell us a lot.
>
>
>
> Often times people will launch their app using a file url, an then try to
> access a resource via a net url, this will produce a security error.
>
>
>
> Tracy Spratt,
>
> Lariat Services, development services available
>   --
>
> *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
> Behalf Of *cholid cholid
> *Sent:* Tuesday, February 02, 2010 10:49 PM
> *To:* flexcoders@yahoogroups.com
> *Subject:* [SPAM] Re: [flexcoders] Loading XML
>
>
>
>
>
> can you tell how you call the xml is?
>
>
>  --
>
> *From:* ztpi1 
> *To:* flexcoders@yahoogroups.com
> *Sent:* Wed, February 3, 2010 8:53:59 AM
> *Subject:* [flexcoders] Loading XML
>
>
>
> I am getting a security error when trying to load an xml file into my swf.
> The xml and swf are right next to each other in the same directory. What
> gives? From what I understand, the swf should have access to the xml file. I
> have no problem loading jpg, or png.
>
>
>   
>


[flexcoders] Loading XML in preloader/ before application onComplete

2008-04-03 Thread Varun Shetty
Hi,

I am creating a flex application that has its UI elements and some basic
data that are dependent upon a config.xml.

Loading the config.xml on application preinitialize/initialize/onComplete
would not be appropriate as my application preloading would be complete and
I still dont see any UI elements on the screen.

Creating second preloader on initialize would not look that great.

I am pretty sure we can load the XML in the preloader and delay/deffer the
application instantiation.

Just not sure how to go about it and what API's should I look for or where
exactly should I use them.

Appreciate a lead on how to go about it.

Thank you,
Varun Shetty


Re: [flexcoders] Loading XML in preloader/ before application onComplete

2008-04-03 Thread Rico Leuthold
Extend the DownloadProgressBar Class (name it e.g myPreloader) and  
override the preloader:


override public function set preloader(value:Sprite):void
{

value.addEventListener(FlexEvent.INIT_COMPLETE,  
FlexInitComplete); // I added my download function to the  
INIT_COMPLETE event


}

Write sometihing like this as the event handler:

private function FlexInitComplete(event:Event):void
{

Security.loadPolicyFile("[you'll need a policy file I guess]");
var getXMLReq:URLRequest = new URLRequest("http:// 
[whatever].xml");


var xmlLoader:URLLoader = new URLLoader();

xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
	xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,  
securityErrorHandler);


try {
xmlLoader.load(getXMLReq);
} catch (error:Error) {
 trace("Unable to load requested document.");
Alert.show("Security error " + error.errorID.toString());
}

}

Then sth. like this ...

private function xmlLoaded(event:Event):void
{

var loader:URLLoader = URLLoader(event.target); 

var theXML:XML = new XML(loader.data);

}

Check the DownloadProgressBar doc for some more events to complete the  
process



In the Application tag set your preloader




Hope that helps somehow ... for me it works.


On 03.04.2008, at 17:28, Varun Shetty wrote:

Hi,

I am creating a flex application that has its UI elements and some  
basic data that are dependent upon a config.xml.


Loading the config.xml on application preinitialize/initialize/ 
onComplete would not be appropriate as my application preloading  
would be complete and I still dont see any UI elements on the screen.


Creating second preloader on initialize would not look that great.

I am pretty sure we can load the XML in the preloader and delay/ 
deffer the application instantiation.


Just not sure how to go about it and what API's should I look for or  
where exactly should I use them.


Appreciate a lead on how to go about it.

Thank you,
Varun Shetty






Re: [flexcoders] Loading XML in preloader/ before application onComplete

2008-04-03 Thread Varun Shetty
Wow, that is pretty descriptive... thank you very much Rico...!

umm.. so Extending the downloadprogressbar class is the way...

I will try it out in sometime. Thank you very much for your help..

regards,
Varun Shetty

On Thu, Apr 3, 2008 at 1:26 PM, Rico Leuthold <[EMAIL PROTECTED]> wrote:

>   Extend the DownloadProgressBar Class (name it e.g myPreloader) and
> override the preloader:
>
> override public function set preloader(value:Sprite):void
> {
>
> value.addEventListener(FlexEvent.INIT_COMPLETE, FlexInitComplete);
> // I added my download function to the INIT_COMPLETE event
>
> }
>
> Write sometihing like this as the event handler:
>
> private function FlexInitComplete(event:Event):void
> {
>
> Security.loadPolicyFile("[you'll need a policy file I guess]");
> var getXMLReq:URLRequest = new URLRequest("http://
> [whatever].xml");
>
>  var xmlLoader:URLLoader = new URLLoader();
>
>  xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
>  xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
> securityErrorHandler);
>
>  try {
> xmlLoader.load(getXMLReq);
>  } catch (error:Error) {
>   trace("Unable to load requested document.");
>  Alert.show("Security error " + error.errorID.toString());
>  }
>
> }
>
> Then sth. like this ...
>
> private function xmlLoaded(event:Event):void
> {
>   var loader:URLLoader = URLLoader(event.target);
>
>  var theXML:XML = new XML(loader.data);
>
> }
>
> Check the DownloadProgressBar doc for some more events to complete the
> process
>
>
> In the Application tag set your preloader
>
>  .
> .
> preloader="myPreloader"
> .
> . />
>
> Hope that helps somehow ... for me it works.
>
>
> On 03.04.2008, at 17:28, Varun Shetty wrote:
>
> Hi,
>
> I am creating a flex application that has its UI elements and some basic
> data that are dependent upon a config.xml.
>
> Loading the config.xml on application preinitialize/initialize/onComplete
> would not be appropriate as my application preloading would be complete and
> I still dont see any UI elements on the screen.
>
> Creating second preloader on initialize would not look that great.
>
> I am pretty sure we can load the XML in the preloader and delay/deffer the
> application instantiation.
>
> Just not sure how to go about it and what API's should I look for or where
> exactly should I use them.
>
> Appreciate a lead on how to go about it.
>
> Thank you,
> Varun Shetty
>
>
>