6 Replies Latest reply on Jul 11, 2007 2:13 PM by the_brigade

    need help loading .swfs one by one, in specific order

    the_brigade
      i have been trying to figure this out for weeks now, and have even posted on other forums about this, but nobody seems to be willing to help me. i have a main swf, which is the basis for my image gallery. once this page loads, a thumbnail should start loading with a preloader displaying the precentage loaded. once the percentage hits 100%, the image shows up, and the next thumbnail starts, and so on. there are 15 thumbnails total that have to be loaded. each one should load with a 10 pixel gap all around, and i want to have 5 images load per row. i think i need to create empty movie clips for each thumbnail to load into, but i'm not sure. hell, i don't even know how to code this so it will work correctly.

      would someone be willing to put this together for me? i am a beginner actionscripter, and if people simply tell me "add this line in so this will happen," i will have no idea what to do, so that is why i need the code put in for me. i'm hoping someone here is nice enough to do this for me, because being ignored on two other forums has made me just want to say "screw it."

      so PLEASE, can someone help me?

      i have uploaded my files into a .zip file. i have only uploaded 6 of the pictures, so that i can see if the code (that someone will hopefully make) works when i asked for 5 thumbnails per row.

      file is located here: http://www.arielseri.com/fla_files.zip
        • 1. Re: need help loading .swfs one by one, in specific order
          kglad Adobe Community Professional & MVP
          there are plenty of people that can help you. but you're not really asking for help, you're asking for someone to do your work for you.

          all of use on this forum volunteer our time helping people that need a push to overcome a hurdle. we're happy to help those people for no compensation.

          but to be asked to do your work for you is quite another thing. perhaps others have felt the same way and that's why noone's stepped forward to do your work for you.
          • 2. Re: need help loading .swfs one by one, in specific order
            the_brigade Level 1
            i understand what you're saying. can you maybe point me to tutorials or movies that use a command such as "load this .swf, display the progress, when it is at 100% load the .swf and move onto the next .swf"? because i cannot find any tutorials or movies that are about how to sequentially load .swfs into their own placeholders with coordinates x and y from the previous one. any help i can get on this i will appreciate. i am an actionscript beginner, which is why i asked for such detailed help.
            • 3. Re: need help loading .swfs one by one, in specific order
              kglad Adobe Community Professional & MVP
              flashkit.com has lots of tutorials for beginning and intermediate actionscripters.
              • 4. Re: need help loading .swfs one by one, in specific order
                the_brigade Level 1
                i meant direct links for my questions - ive scoured flashkit and actionscript.org and have found nothing...
                • 5. Re: need help loading .swfs one by one, in specific order
                  neeks
                  you do not need to go to any tutorials site, I think flash help alone will suffice for this purpose.
                  All you need is logic and be a little more persistence in searching for solution.
                  I agree with kglad with what he says.

                  what you need here is to have an array of all the items you need to load,
                  then load the first item and attach a listener to wait till the first item has loaded,
                  then call the same function to load the second file and have the listener to wait
                  and so on.

                  have a look at the load, loadmovie etc in the flash help. These types of functions usually have examples with listeners in the help file.
                  also learn how to attach listeners using the attachListener command.

                  the best way to learn is to first be sure of what and HOW you want to achieve
                  a particular step and then search for how to achieve the same in a particular
                  language.

                  I'm sorry if I am overdoing the teaching stuff, but hey, we are here to help, not be
                  used. on forums people work for respect and not money.
                  • 6. Re: need help loading .swfs one by one, in specific order
                    the_brigade Level 1
                    i completely understand. i've actually come up with a semi-working solution!

                    i have 15 thumbnails total, but when i play the movie, all 15 load on one line and after 5 show up, the rest go off the stage. i would like to set it up so that there are 5 .swfs per row. i have one main .swf file, and two .as files. the code for each is as follows (the ========== is just to separate the code):

                    main .swf code (called test.swf):
                    ==========
                    fscommand("fullscreen", "false");
                    fscommand("allowscale", "false");

                    // A container clip for our thumbnails
                    var thumbnails_mc:MovieClip = this.createEmptyMovieClip("thumbnails_mc", this.getNextHighestDepth());

                    // An array holding the paths to our thumbnails
                    var thumbnailPaths_arr:Array = ["1.swf", "2.swf", "3.swf", "4.swf", "5.swf", "6.swf", "7.swf", "8.swf", "9.swf", "10.swf", "11.swf", "12.swf", "13.swf", "14.swf", "15.swf"];

                    // Our ThumbnailManager
                    var thumbnailManager:ThumbnailManager = new ThumbnailManager(thumbnails_mc, thumbnailPaths_arr);
                    ==========

                    ThumbnailManager.as code:
                    ==========
                    import Thumbnail

                    class ThumbnailManager
                    {
                    private var counter:Number = 0;
                    private var root_mc:MovieClip;
                    private var thumbnailPaths_arr:Array;

                    public function ThumbnailManager (target:MovieClip, paths:Array)
                    {

                    root_mc = target;
                    thumbnailPaths_arr = paths;

                    (thumbnailPaths_arr.length > 0)? createThumbnail() : null;
                    }

                    private function createThumbnail ():Void
                    {

                    var thumb:Thumbnail = new Thumbnail(this, thumbnailPaths_arr[counter], root_mc, counter);
                    counter++;
                    }

                    public function onThumbnailLoaded ():Void
                    {

                    if (counter < thumbnailPaths_arr.length)

                    {
                    createThumbnail();
                    }
                    else
                    {

                    }
                    }
                    }
                    ==========

                    Thumbnail.as code:
                    ==========
                    import AsBroadcaster
                    import ThumbnailManager

                    class Thumbnail
                    {
                    public var addListener:Function;
                    public var removeListener:Function;
                    public var broadcastMessage:Function;

                    private var thumbnailWidth:Number = 88;
                    private var thumbnailHeight:Number = 61;
                    private var thumbnailOffsetX:Number = 10;
                    private var thumbnailOffsetY:Number = 10;
                    private var view_mc:MovieClip;
                    private var image_mc:MovieClip;
                    private var loader_mcl:MovieClipLoader;

                    public function Thumbnail (manager:ThumbnailManager, url:String, target:MovieClip, d:Number)
                    {

                    AsBroadcaster.initialize(this);
                    this.addListener(manager);

                    render(url, target, d);
                    }

                    private function render (url:String, target:MovieClip, d:Number):Void
                    {
                    view_mc = target.attachMovie("thumbnail", "thumb_"+d+"_mc", d);
                    view_mc._x = (d * thumbnailWidth) + (d * thumbnailOffsetX);
                    view_mc._y = 0;

                    image_mc = view_mc.createEmptyMovieClip("image_mc", view_mc.getNextHighestDepth());
                    image_mc._x = 0;
                    image_mc._y = 0;

                    loader_mcl = new MovieClipLoader();
                    loader_mcl.addListener(this);
                    loader_mcl.loadClip(url, image_mc);
                    }

                    public function onLoadError (target:MovieClip, error:String):Void
                    {
                    broadcastMessage("onThumbnailLoaded");
                    }

                    public function onLoadProgress (target:MovieClip, bL:Number, bT:Number):Void
                    {
                    }

                    public function onLoadInit (target:MovieClip):Void
                    {
                    broadcastMessage("onThumbnailLoaded");
                    }
                    }
                    ==========

                    can anyone help me out with what code to put where? i have uploaded a .zip file which contains all of the files here:
                    http://www.arielseri.com/thumbnails.zip