dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: php to xml to flash

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    1

    Unhappy php to xml to flash

    Dear All,

    I currently build a flash website with someone (PHP programer) he build the backend with php, and the backend made a xml output without a .xml file. he only gave a URL

    URL : http://www.domain.com/data/catalogue/collection?designer={$designer_id}

    and the xml content are :

    <data>

    <collection>
    <id>1</id>
    <name>Amaya</name>
    <thumbnail>/images/collection/amaya.jpg</thumbnail>
    </collection>

    <collection>
    <id>2</id>
    <name>Balou</name>
    <thumbnail>/images/collection/balou.jpg</thumbnail>
    </collection>

    </data>



    Can some one show me how flash can take that thing, since i'm a beginner in flash action script..can you give a sample with details (sorry for my bad english)


    Thanks

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    PHP Code:
    arr = new Array();

    _xml = new XML();
    _xml.ignoreWhite true;
    _xml.load("test.xml");  // LOAD

    _xml.onLoad = function(){  // WHEN LOADED, PARSE
    aNodes this.firstChild.childNodes;
    len1 aNodes.length;
    for(var 
    n=0;n!=len1;n++){
    len2 aNodes[n].childNodes.length;
    arr[n] = new Array(len2);
    for(var 
    m=0;m!=len2;m++){
    arr[n][m] =aNodes[n].childNodes[m].firstChild.toString();
    }
    }
    showArray(); // ALL PARSED, SHOW THE ARRAY
    };

    function 
    showArray(){
    for(var 
    n=0;n!=arr.length;n++){
    for(var 
    m=0;m!=arr[n].length;m++){
    trace("arr["+n+"]["+m+"] = "+arr[n][m])
    }
    }
    }; 
    hope this AS2 code helps you on your way

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