views:

53

answers:

2

Hi!

I was wondering if it was possible to edit an xml on the server side from a web based flex application. When you use XML files in a Flex application and then compile it to upload it in the server, Flex Buidler generates a swf file with the xml data embedded. How should I do to have access to those XML files??

Thanks for your answers.

Regards. BS_C3

+1  A: 

If I understand your question you're using a XML mxml tag that embeds the XML. Try to use a URLLoader instead. Maybe like this:

var xmlLoader:URLLoader = new URLLoader();
        var myXml:XML;

        function init():void
        {
            xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
            xmlLoader.load(new URLRequest('teste.xml'));
        }
        function xmlLoaded(e:Event):void
        {
            myXml = new XML(e.target.data);
        }
Jonathan Simas
Hi!Thanks for your answer, but this enables me to load the content. What I'd like to do is to edit and save the content back into the XML file. Do you know how to do that without using a service? Also, what is the eventlistener for? Couldn't you just do function init():void{ xmlLoader.load(new URLRequest('test.xml'));}??Regards
BS_C3
A: 

You can load the content but you cannot save it back directly from Flash without calling some server side method. You should pass the new content (or delta) as a parameter to this method on the server side.

Cornel Creanga
Hi!Thaks for your answer. That's what I was looking for =)Regards.
BS_C3