A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: Loading external swf which itself uses xml

  1. #1
    Member
    Join Date
    Jul 2006
    Posts
    35

    Loading external swf which itself uses xml

    I have a photo viewer swf that uses XML to load photos from /images into itself.

    When I load this viewer using MovieClipLoader the clips loads, but the SWF clearly cannot load xml/photos, probably due to it looking in parent directory of test.swf.

    My question is how do I fix this? It shouldn't be too awkward, hopefully it is possible.

    I have attached a PNG to show folders.

    (test = main swf, gal1 contains viewer.swf, xml, /images folder)

    Hope you can help! Thanks

    Phil
    Attached Images Attached Images

  2. #2
    Member
    Join Date
    Jul 2006
    Posts
    35
    Bump, sorry!

  3. #3
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    ok.. a few questions:

    - are you using the airtightinteractive 'simple viewer' gallery?...(looks like it)
    - what version of Flash are you using?...
    - which player are you publishing for?...
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  4. #4
    Member
    Join Date
    Jul 2006
    Posts
    35
    Flash 8 Pro (yes I actually own it) - publishing for flash 8, and yes I am using the airtightviewer autoviewer app. I only blurred out the filenames to make it more relevant.

    It's a great photo gallery viewer! But only for individual gallerys. I figured I could make a dynamic gallery chooser that floats over the gallery itself..

    Any help would be lovely, and when it all works I will post source here, I'm sure there are others who would like it.

    Phil

    EDIT: I was thinking of making my app take a thumb from each directory 'thumb.jpg' and scroll across the top in the same style as the viewer itself.
    Last edited by svenviking; 08-03-2006 at 06:36 PM.

  5. #5
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    ok.. the problem is.. that the 'simpleviewer' is published for Flash Player 6 and was coded in ActionScript 1.0. And you're publishing for Flash 8 with AS2.0... That's why you're having conflicts. You'll either have to buy the SimpleViewer source files and edit/update them to AS 2.0, or find another gallery..... sorry...

    you could try this: http://www.imagevuex.com/index.php?p=30

    or just create your own...
    Last edited by madzigian; 08-03-2006 at 07:11 PM.
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  6. #6
    Member
    Join Date
    Jul 2006
    Posts
    35
    ..Well interestingly enough I published as flash 6 AS1.0 -and the same thing occurs- the gallery loads the interface - but no content.

    :E

  7. #7
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    ok.. more questions:

    - does the gallery work properly on it's own?...
    - is the XML file in the same directory as the swf and the 'thumbs' & 'images' folders
    - is your XML doc formatting properly?..
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <SIMPLEVIEWER_DATA maxImageDimension="480" textColor="0xFFFFFF" frameColor="0xFFFFFF" bgColor="0x181818" frameWidth="20" stagePadding="40" thumbnailColumns="3" thumbnailRows="3" navPosition="right" navDirection="LTR" title="Example Title" imagePath="" thumbPath="">
    <IMAGE>
    	<NAME>IMG_1.jpg</NAME>
    	<CAPTION>Image 1</CAPTION>
    </IMAGE>
    <IMAGE>
    	<NAME>IMG_2.jpg</NAME>
    	<CAPTION>Image 2</CAPTION>
    </IMAGE>
    <IMAGE>
    	<NAME>IMG_3.jpg</NAME>
    	<CAPTION>Image 3</CAPTION>
    </IMAGE>
    </SIMPLEVIEWER_DATA>
    ---> check to make sure all tags are correct and not missing a '<' or '>' somewhere...

    - did you save all your images as 'non-progressive' jpgs?.... or are they progressive? (flash can't load progressive jpg files)

    - are you loading into a container clip?.. or into a _level?

    and finally..

    - did you buy the source files?.. or are you using the free version? (if you bought the source files, then you can do some troubleshooting...)

    i know i bought the source files like 2 years ago so i could see how they put it together so i could try to make my own. It also allowed me to make changes and adjustments according to my own likes/dislikes.... I also believe in supporting people who invest their time and energy into creating something they make available for free unlimited use.
    Last edited by madzigian; 08-03-2006 at 09:02 PM.
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  8. #8
    Member
    Join Date
    Jul 2006
    Posts
    35
    I am using the free Autoviewer app. It has a plugin for picasa to autogenerate galleries.

    Runs perfect on it's own, xml files are lovely - standalone its perfect.

    My code for loading the SWF is as follows:

    code:

    on (release) {

    var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(this);
    mcLoader.loadClip("gal1/viewer.swf", container);

    function onLoadInit(mc:MovieClip) {
    trace("onLoadInit: " + mc); //returns: onLoadInit:_level0.instance2.container
    }

    }



    I have also attached a gif with screenies of the swf running.

    Any help greatly appreciated!!

    Phil
    Attached Images Attached Images

  9. #9
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    well first, your syntax for the MovieClipLoader listeners is wrong... but you can look that up in HELP...

    try putting you xml file, the viewer.swf and the THUMB and IMAGE folders all in your root directory and see if it works
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  10. #10
    Member
    Join Date
    Jul 2006
    Posts
    35
    Moving the folders around didn't seem to help.

    Syntax problem? If there was a syntax problem it would tell me surely.. I will check it out though..

    grr >

  11. #11
    Member
    Join Date
    Jul 2006
    Posts
    35
    I thought flash had a problem where if you load a movie in externally, and that movie has external resources in a subdirectory - that the external file would be looking for the external files relative to the parent movie clip - not itself.

    am I wrong?

  12. #12
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    try this:
    Code:
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    var listen:Object = new Object();
    
    listen.onLoadStart = function(target_mc:MovieClip) {
           trace("Loading...");
    };
    listen.onLoadInit = function(target_mc:MovieClip) {
           target_mc._lockroot = true;
           //  this should trace all the info & vars from the clip being loaded...
           trace("From : " + target_mc);
           for (i in _root) {
               trace("  "+i+" -> "+_root[i]);
               }
          trace("");
    };
    
    listen.onLoadComplete = function(target_mc:MovieClip) {
          //  this should hopefully trace back all info from your main movie.....
          trace("From : " + _level0);
          for (var i in _level0) {
                trace("  "+i+" -> "+_level0[i]);
              }
           trace("");
    };
    
    mcLoader.addListener(listen);
    
    var container:MovieClip = _parent.createEmptyMovieClip("container", _parent.getNextHighestDepth());
    
    mcLoader.loadClip("gal1/viewer.swf", container);
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  13. #13
    Member
    Join Date
    Jul 2006
    Posts
    35
    Thanks! Exactly the same result - the output:

    code:

    Loading...
    From : _level0
    $version -> WIN 8,0,22,0
    container -> _level0.container
    instance2 -> _level0.instance2
    instance1 -> _level0.instance1

    From : _level0.container
    $version -> WIN 8,0,22,0
    container -> _level0.container
    instance2 -> _level0.instance2
    instance1 -> _level0.instance1

    Error loading XML doc
    Error opening URL "file:///C|/Documents%20and%20Settings/x/Desktop/test/gallerydata.xml"



    As I originally thought the problem is it's looking in the same place as test.swf, not it's own folder (gal1) for the XML.

    So does anyone know how to make the paths relative to loaded swf NOT the page the flash is on (if that makes sense)

    thanking you muchlies for your help madzigian

  14. #14
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    it''s really easy to create relative paths.... but you need to be able to edit the code to do it. The way that gallery was created does not give you an option to change the path to the XML file (actually, it's a little funny... because they actually wrote a check for a default file path into the XML file's preloader, but then they never added a way to actually alter the path.... so it's really just 2 or 3 useless lines of code.) The XML file allows you to change the default image/thumb folders... so why don't you just keep the viewer.swf and xml file in your root directory with all your other main files and load your images from wherever you want?...
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  15. #15
    Member
    Join Date
    Jul 2006
    Posts
    35
    Well the idea was that I can export from picasa lots of autoviewer gallerys (gal1, gal2, gal3, gal4, gal5 etc) and then make a main flash program that will load each one individually. Having to edit each one everytime kinda beats the point of it.

    However, I could buy the code - and what would I need to do exactly - anywhere I can start?

    Thanks.

  16. #16
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    i would just edit the code so you can provide alt paths to XML files.. then you just need one xml file for each gallery.... and you'd simply point the viewer towards the appropriate xml file..
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

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