A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS3 load XML from a PHP script

  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    4

    AS3 load XML from a PHP script

    I spent a lot of time trying to understand why, loading XML from a PHP that used to work in AS2 wasn't working in AS3.

    Well I found out and it work.

    So to spare a lot of head hack to others here a little explanation:

    When you test in Flash (IDE), your URLRequest should be absolute like:

    var XMLnewsList:URLRequest = new URLRequest("http://localhost/myxml.php");

    OR

    var XMLnewsList:URLRequest = new URLRequest("http://www.yourdomain.com/myxml.php");

    It should NOT be relative like:

    new URLRequest("myscript/myxml.php");

    This is a new anti cross domain security policy.

    Note that within a browser (wamp or else) relative URLRequest works fine.
    Last edited by ced_damoo; 07-09-2008 at 03:14 AM.

  2. #2
    Junior Member
    Join Date
    May 2008
    Posts
    4

    html in xml parsed by AS3

    And also if you want to put a link in your xml don't forget to use :

    <![CDATA[]]>

    everything inside this tag will be treated as a string by AS3. Example:


    <link><![CDATA[<a target="_blank" href="http://www.yourdomain.com/">your text for the link</a>]]></link>

    This <a></a> tag will not become an XML node.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center