loading images through xml....Preloader?
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: loading images through xml....Preloader?

  1. #1
    Junior Member
    Join Date
    Jul 2007
    Posts
    6

    loading images through xml....Preloader?

    Well I have looked through several threads and I just cant seem to figure it out, idk if its the late night and i am just to tired to figure it out or if it is because I am a super noob when it comes to flash. But here is my problem, I have a slideshow that will load the images from an XML document, here is my actionscript code.

    PHP Code:
    myXML = new XML();
    myXML.ignoreWhite true;
    myXML.onLoad = function(success){
    if(
    success){
    loadMovie(myXML.firstChild.childNodes[0].firstChild.nodeValuef0);
    loadMovie(myXML.firstChild.childNodes[1].firstChild.nodeValuef1);
    loadMovie(myXML.firstChild.childNodes[2].firstChild.nodeValuef2);
    loadMovie(myXML.firstChild.childNodes[3].firstChild.nodeValuef3);
    loadMovie(myXML.firstChild.childNodes[4].firstChild.nodeValuef4);
    loadMovie(myXML.firstChild.childNodes[5].firstChild.nodeValuef5);
    loadMovie(myXML.firstChild.childNodes[6].firstChild.nodeValuef6);
    loadMovie(myXML.firstChild.childNodes[7].firstChild.nodeValuef7);
    loadMovie(myXML.firstChild.childNodes[8].firstChild.nodeValuef8);
    loadMovie(myXML.firstChild.childNodes[9].firstChild.nodeValuef9);
    loadMovie(myXML.firstChild.childNodes[10].firstChild.nodeValuef10);
    loadMovie(myXML.firstChild.childNodes[11].firstChild.nodeValuef11);
    loadMovie(myXML.firstChild.childNodes[12].firstChild.nodeValuef12);
    loadMovie(myXML.firstChild.childNodes[13].firstChild.nodeValuef13);
    loadMovie(myXML.firstChild.childNodes[14].firstChild.nodeValuef14);

    loadMovie(myXML.firstChild.childNodes[15].firstChild.nodeValuep0);
    loadMovie(myXML.firstChild.childNodes[16].firstChild.nodeValuep1);
    loadMovie(myXML.firstChild.childNodes[17].firstChild.nodeValuep2);
    loadMovie(myXML.firstChild.childNodes[18].firstChild.nodeValuep3);
    loadMovie(myXML.firstChild.childNodes[19].firstChild.nodeValuep4);
    loadMovie(myXML.firstChild.childNodes[20].firstChild.nodeValuep5);
    loadMovie(myXML.firstChild.childNodes[21].firstChild.nodeValuep6);
    loadMovie(myXML.firstChild.childNodes[22].firstChild.nodeValuep7);
    loadMovie(myXML.firstChild.childNodes[23].firstChild.nodeValuep8);
    loadMovie(myXML.firstChild.childNodes[24].firstChild.nodeValuep9);
    loadMovie(myXML.firstChild.childNodes[25].firstChild.nodeValuep10);
    loadMovie(myXML.firstChild.childNodes[26].firstChild.nodeValuep11);
    loadMovie(myXML.firstChild.childNodes[27].firstChild.nodeValuep12);
    loadMovie(myXML.firstChild.childNodes[28].firstChild.nodeValuep13);
    loadMovie(myXML.firstChild.childNodes[29].firstChild.nodeValuep14);

    loadMovie(myXML.firstChild.childNodes[30].firstChild.nodeValuee0);
    loadMovie(myXML.firstChild.childNodes[31].firstChild.nodeValuee1);
    loadMovie(myXML.firstChild.childNodes[32].firstChild.nodeValuee2);
    loadMovie(myXML.firstChild.childNodes[33].firstChild.nodeValuee3);
    loadMovie(myXML.firstChild.childNodes[34].firstChild.nodeValuee4);
    loadMovie(myXML.firstChild.childNodes[35].firstChild.nodeValuee5);
    loadMovie(myXML.firstChild.childNodes[36].firstChild.nodeValuee6);
    loadMovie(myXML.firstChild.childNodes[37].firstChild.nodeValuee7);
    loadMovie(myXML.firstChild.childNodes[38].firstChild.nodeValuee8);
    loadMovie(myXML.firstChild.childNodes[39].firstChild.nodeValuee9);
    loadMovie(myXML.firstChild.childNodes[40].firstChild.nodeValuee10);
    loadMovie(myXML.firstChild.childNodes[41].firstChild.nodeValuee11);
    loadMovie(myXML.firstChild.childNodes[42].firstChild.nodeValuee12);
    loadMovie(myXML.firstChild.childNodes[43].firstChild.nodeValuee13);
    loadMovie(myXML.firstChild.childNodes[44].firstChild.nodeValuee14);

    } else {
    }
    }
    myXML.load("myImage.xml"); 
    this is however in a movie clip called "slide".

    this is my xml code from "myImage.xml"
    PHP Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <myImage>
    <imagePath>images/f0.jpg</imagePath>
    <imagePath>images/f1.jpg</imagePath>
    <imagePath>images/f2.jpg</imagePath>
    <imagePath>images/f3.jpg</imagePath>
    <imagePath>images/f4.jpg</imagePath>
    <imagePath>images/f5.jpg</imagePath>
    <imagePath>images/f6.jpg</imagePath>
    <imagePath>images/f7.jpg</imagePath>
    <imagePath>images/f8.jpg</imagePath>
    <imagePath>images/f9.jpg</imagePath>
    <imagePath>images/f0.jpg</imagePath>
    <imagePath>images/f1.jpg</imagePath>
    <imagePath>images/f2.jpg</imagePath>
    <imagePath>images/f3.jpg</imagePath>
    <imagePath>images/f4.jpg</imagePath>
    <imagePath>images/f5.jpg</imagePath>
    <imagePath>images/f6.jpg</imagePath>
    <imagePath>images/f7.jpg</imagePath>
    <imagePath>images/f8.jpg</imagePath>
    <imagePath>images/f9.jpg</imagePath>
    <imagePath>images/f0.jpg</imagePath>
    <imagePath>images/f1.jpg</imagePath>
    <imagePath>images/f2.jpg</imagePath>
    <imagePath>images/f3.jpg</imagePath>
    <imagePath>images/f4.jpg</imagePath>
    <imagePath>images/f5.jpg</imagePath>
    <imagePath>images/f6.jpg</imagePath>
    <imagePath>images/f7.jpg</imagePath>
    <imagePath>images/f8.jpg</imagePath>
    <imagePath>images/f9.jpg</imagePath>
    <imagePath>images/f0.jpg</imagePath>
    <imagePath>images/f1.jpg</imagePath>
    <imagePath>images/f2.jpg</imagePath>
    <imagePath>images/f3.jpg</imagePath>
    <imagePath>images/f4.jpg</imagePath>
    <imagePath>images/f5.jpg</imagePath>
    <imagePath>images/f6.jpg</imagePath>
    <imagePath>images/f7.jpg</imagePath>
    <imagePath>images/f8.jpg</imagePath>
    <imagePath>images/f9.jpg</imagePath>
    <imagePath>images/f0.jpg</imagePath>
    <imagePath>images/f1.jpg</imagePath>
    <imagePath>images/f2.jpg</imagePath>
    <imagePath>images/f3.jpg</imagePath>
    <imagePath>images/f4.jpg</imagePath>
    </myImage>
    Ideally I would like my preloader on my first frame to preload these images for me here is my preloader AS
    PHP Code:
    onClipEvent (load) {
        
    total _root.getBytesTotal();
    }
    onClipEvent (enterFrame) {
        
    loaded _root.getBytesLoaded();
        
    percent int(loaded/total*100);
        
    text percent+"%";
        
    //trace(percent)
        
    this.gotoAndStop(percent);
        if (
    loaded == total and total>380 and a<>1) {
            
    a=1;
            
    _root.gotoAndPlay(2);
        }

    I truly would appreciate anyones guidance on the matter, and thanks for your help.

  2. #2
    Junior Member
    Join Date
    Jul 2007
    Posts
    6
    Well I have done a lot of reading and am still left without a resolve... it seems that my solution lies somewhere with a MovieClipLoader, but I can not be certain. The things that makes this seem tricky to me is I want the images to load with the main preloader, I would really appreciate some guidance, but If I find a solution I will be sure to post. Thanks.

  3. #3
    Junior Member
    Join Date
    Jul 2007
    Posts
    6
    Found a fix for whoever comes across this.

    The problem was is that when you load the XML Gallery it doesnt preload any content that you have linked in the XML file so you have to preolad that data before they get to the XML gallery and when it preloads those files it will store them in the users cache.

    http://www.actionscript.org/forums/s....php3?t=138292

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

Poll by Flashkit.com