As a follow up i'll also show you code that doesnt work properly.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="horizontal"
creationComplete="initApp();" currentState="selectGallery"
viewSourceURL="srcview/index.html">

    <!-- Define the HTTP service -->
    <mx:HTTPService 
        id="photoService"
        url="http://malaszuk.net/photos.xml"; 
        resultFormat="e4x"
        result="photoResultHandler(event);"
        useProxy="false"
        />

<mx:Script>
        <![CDATA[
                import mx.collections.XMLListCollection;
                
                import mx.controls.Alert;
                import mx.core.BitmapAsset;
                import mx.core.UIComponent;
                import flash.net.URLLoader;
                import mx.rpc.events.ResultEvent;
                
                [Bindable] var photoData:XML;
                //var loader:URLLoader = new URLLoader();
                //var request:URLRequest = new
URLRequest("http://80.192.78.134/photos/photos.xml";);


                public function initApp():void{
                
                photoService.send();
                //loader.load(request);
                //loader.addEventListener(Event.COMPLETE, onComplete);

                        
                }
                
            // Result handler - gets called after RSS is loaded.
        private function photoResultHandler(event:ResultEvent):void
        {
            photoData = event.result as XML;
        }
                
                //public function onComplete(event:Event):void {
                  //  var loader:URLLoader = URLLoader(event.target);
                   // photoData = new XML(loader.data);
                    //trace(photoData.toXMLString());
                //}
                
                
                public function showInfo():void {
                        var info:String = "PhotoAlbum 1.0 \nCopyrights
Maciej Malaszuk 2007";
                        Alert.show(info);
                }
                
                private function handleImageComplete(event: Event): void {
                        var bitmap: Bitmap = ((event.target as
Image).content as Bitmap);
                        if (bitmap != null) {
                        bitmap.smoothing = true;
                        }
                }
                
                public function changePhoto(url:String):void {
                        photoDisplayed.load('http://malaszuk.net/'+url);
                        photoDisc.text = url;
                }
        ]]>
</mx:Script>
 

Regards,
Maciek




-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Michael Labriola
Sent: Wednesday, May 30, 2007 2:45 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Problem with loading xml file using HTTPService or
URLLoader


Maciek,

You may want to read up on crossdomain files. You should be able to google
this term and find information. Here is a link to explore, but there are
probably easier to understand resources.

http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14213
<http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14213> 

Mike

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ,
"Maciek Malaszuk" 
<[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> I'm struggling with strange problem.
> I'm trying to load XML file in my code which containst data about 
> images but thats nor really relevant.
> 
> Lets assume i have remote server where i run my code (domain 
> xxxxx.net).
> 
> When i point both httpservice or urlloader to http://mydomain.net/ 
> <http://mydomain.net/> photos.xml it does work on my local machine but 
> DOES NOT when i
copy 
> the file to that mydomain server.
> 
> This is only one configuration it works on. 
> 
> Different scenario i tried and does not work is:
> loader pointing to http://mylocalmachineIP/photos.xml 
> <http://mylocalmachineIP/photos.xml>  (which is accessible from the 
> internet) and application neither on local machine nor server works.
> 
> Did anyone encountered similar problem before? I would expect 
> httpservice to be able to access file regardless of its location if 
> the url is valid...
> 
> Thanks for help as i'm really stuck on this one.
>



 

Reply via email to