AS 2 [RESOLVED] xml driven gallery not working on website
A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: [RESOLVED] xml driven gallery not working on website

  1. #1
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    318

    resolved [RESOLVED] xml driven gallery not working on website

    I can't understand what is happenning. I have just changed the folders where I had the images for the gallery, bith the thumbs and the pictures because I couldn't get it to work on my website. The way I had it before was in their respective folders and it worked locally, but as soon as I posted it, I can only see the thumbnails... I figured it could be a size problem but I have decreased the pictures' size changing them to greyscale but still only the thumbnails load.

    Any idea? Would appreciate the help,

    thanks

  2. #2
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    951
    check that the .xml is in the same folder as the .swf in the server. Check that in flash, you are calling the .xml with NO PATH EG (loadVars("C:/documents/myXML.xml")) and instead you let it single (loadVars("myXML.xml")).

    Check that you server supports scripts or/and xml files.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  3. #3
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    318
    thanks for the reply, angel,

    I just tried getting rid of some files in the server thinking It could be a file size related issue, but no change. The folders are exactly the same either locally or in the server. I can only see the thumbs loaded. I noticed it wouldn't load the png image files even locally at first when they were over a certain size, but I can't figure out what may be going on when i have changed their size and I even tried a different format (jpgs) that wouldn't work either...



    this is the code in my fla and this is my site's: http://webs.ono.com/jpdurba/


    stop();

    var myGalleryXML:XML = new XML();
    myGalleryXML.ignoreWhite = true;
    myGalleryXML.load("gallery.xml");

    myGalleryXML.onLoad = function():Void {
    gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
    gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
    gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
    gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
    myImages = myGalleryXML.firstChild.childNodes;
    myImagesTotal = myImages.length;
    thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
    thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
    full_x = myGalleryXML.firstChild.attributes.full_x;
    full_y = myGalleryXML.firstChild.attributes.full_y;
    callThumbs();
    };

    function callThumbs():Void {
    createEmptyMovieClip("container_mc", getNextHighestDepth());
    container_mc._x = gallery_x;
    container_mc._y = gallery_y;
    var clipLoader:MovieClipLoader = new MovieClipLoader();
    var preloader:Object = new Object();
    clipLoader.addListener(preloader);
    for (i=0; i<myImagesTotal; i++) {
    thumbURL = myImages[i].attributes.thumb_url;
    myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth());
    myThumb_mc._x = thumb_width*i;
    clipLoader.loadClip("thumbs/"+thumbURL, myThumb_mc);
    preloader.onLoadComplete = function(target):Void {
    target.onRelease = function():Void {
    callFullImage(this._name);
    };
    target.onRollOver = function():Void {
    this._alpha = 75;
    };
    target.onRollOut = function():Void {
    this._alpha = 100;
    };
    };
    }
    }

    function callFullImage(myNumber):Void {
    myURL = myImages[myNumber].attributes.full_url;
    createEmptyMovieClip("fullImage_mc", getNextHighestDepth());
    fullImage_mc._x = full_x;
    fullImage_mc._y = full_y;
    var fullClipLoader = new MovieClipLoader();
    fullClipLoader.loadClip("imatges/"+myURL, fullImage_mc);
    }

  4. #4
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    951
    Replace
    fullClipLoader.loadClip("imatges/"+myURL, fullImage_mc);

    With
    fullClipLoader.loadClip("images/"+myURL, fullImage_mc);

    I think that's the issue "imatges". Let me know.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  5. #5
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    318
    tahnks, angelhdz,

    no, that wasn't it. I've given up on the idea of making my gallery or portfolio xml based. I'll place all my pictures in the library instead and load them some other way, but thanks.

    I doubt it could be a coordinate related problem when it looked up perfectly on my PC. Coordinates don't change on using a different server, could they? Anyway, thanks again. I might try doing this again in the future, seems like a better idea to keep assets apart from the swf.

    thanks again

  6. #6
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    951
    Don't give up!

    What is the section in question? May you upload the FLA, so i can try to identify the issue?
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  7. #7
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    318
    yes, sure,

    I just don't know how to

  8. #8
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    318

    fla attached

    sorry about that, didn't read carefully...



    this is the XML:

    <gallery thumb_width="60" thumb_height="64" gallery_width="760" gallery_height="68" gallery_x="20" gallery_y="20"
    full_x="20" full_y="100">

    <image thumb_url="untitled - 1.png" full_url="untitled - 1.png"/>
    <image thumb_url="untitled - 2.png" full_url="untitled - 2.png"/>
    <image thumb_url="untitled - 3.png" full_url="untitled - 3.png"/>
    <image thumb_url="untitled - 4.png" full_url="untitled - 4.png"/>
    <image thumb_url="untitled - 5.png" full_url="untitled - 5.png"/>
    <image thumb_url="untitled - 6.png" full_url="untitled - 6.png"/>
    <image thumb_url="untitled - 7.png" full_url="untitled - 7.png"/>
    <image thumb_url="untitled - 8.png" full_url="untitled - 8.png"/>
    <image thumb_url="untitled - 9.png" full_url="untitled - 9.png"/>
    <image thumb_url="untitled - 10.png" full_url="untitled - 10.png"/>
    <image thumb_url="untitled - 11.png" full_url="untitled - 11.png"/>
    <image thumb_url="untitled - 12.png" full_url="untitled - 12.png"/>
    <image thumb_url="untitled - 13.png" full_url="untitled - 13.png"/>
    <image thumb_url="untitled - 14.png" full_url="untitled - 14.png"/>
    <image thumb_url="untitled - 15.png" full_url="untitled - 15.png"/>
    <image thumb_url="untitled - 16.png" full_url="untitled - 16.png"/>
    <image thumb_url="untitled - 17.png" full_url="untitled - 17.png"/>
    <image thumb_url="untitled - 18.png" full_url="untitled - 18.png"/>
    <image thumb_url="untitled - 19.png" full_url="untitled - 19.png"/>
    <image thumb_url="untitled - 20.png" full_url="untitled - 20.png"/>
    </gallery>

  9. #9
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    951
    It works on my side. I have a server on my computer with IIS, running on port 4412, and i uploaded your files there (xml, swf and thumbs folder with untitled - 1.png) and the image is being loaded successfully. Try another server.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  10. #10
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    318
    thanks for looking it up.

    I had even tried placing the thumbnails and the larger images on the same root folder and I was getting the same problem. Only the thumbnails loaded. It is possible to add a loading progress listener event on the fullimage loading part to see whether it actually loads the full image, right?

  11. #11
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    951
    Well, i don't think a listener would solve your problem. I used traces for all your functions and they are working great. On my side, your flash is working great, locally as good as remotely(server). I used 3 images of mine, and renamed it to untitled - 1.png, untitled - 2.png and so on. Then I tested the .fla and the images are successfully loaded and shown. Then when I rollover the images, the alpha changes to 75%. You have to put the images inside the folder "thumbs" and that folder goes along with the .swf and the .xml.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  12. #12
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    318
    Thanks again,

    I might try it some other time. For now, I'll build the same project but having all assets in the fla. I think it will make it simpler.

    By the way, my original idea is to load the large images in a scroll pane.

    I used the same file and changed the callFullImage function to load a scroll pane dynamically like so:


    function callFullImage(myNumber):Void {
    myURL = myImages[myNumber].attributes.full_url;
    this.createObject("ScrollPane", "cspScrollPane", this.getNextHighestDepth());
    cspScrollPane._x = 200;
    cspScrollPane._y = 10;
    cspScrollPane.setSize(800, 620);
    cspScrollPane.hScrollPolicy = "off";
    cspScrollPane.contentPath = "images/"+myURL;
    }

    it worked well but as soon as I clicked the second thumb, another scrollpnae component appeared on the top left corner of the page. I have a scrollpane component in the fla's library.

  13. #13
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    951
    Ok if you give me a break, later I can help you with this project deeper and managed to load the images in the scrollpane.
    Hi Object, Listen, i wish to return you something, but only if what you are saying is true, else, forget it, ROLL_OVER the floor, i will check for someone else at the stage, while eating a no.visible cookie.

  14. #14
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,053
    Hi,

    It will create another scrollpane every time you call the function, make a function to create the scrollpane separately before you start loading any images into it, and never call it again.

  15. #15
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    318
    of course. Excuse my impetuosity. Been trying to solve this for too long. It had me obsessed. Sorry about it. Iĺl keep researching and checking here every now and then

  16. #16
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    318
    Jesus!

    the page works! My xml file was written in lower case characters. I won't understand why it would work locally, but I take it.

    I'll most probably be back soon about creating the function to build the scrollPane component object dynamically. Thanks, both.

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