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 tr...@nts3rd.com 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 zt...@yahoo.com
 *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: [flexcoders] Loading XML

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





From: ztpi1 zt...@yahoo.com
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-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 zt...@yahoo.com
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: [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

Application
.
.
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






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

 Application
 .
 .
 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


  


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_Partsfile=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] 
 mailto:[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/