AS 2 [RESOLVED] Thought I understood
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: [RESOLVED] Thought I understood

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

    resolved [RESOLVED] Thought I understood

    Hi, I have been practicing around with the examples Fruitbeard suggested me but later I realized that I wanted to find out whether the container boxes haad finished loading depending on their sizes, so that it looked random and I started playing around with the code below but I can't see why it only works once the first image has loaded. I guess it can also be achieved but I'm too saturated to think by now so I decided to post.

    My variable comes from the first frame in each of the containers (which I could remove if needed) instead of declaring one in the frame, but I just can't see what's so wrong with the code. I'm completely messed up.

    Code:
    	myListener.onLoadInit = function(target:MovieClip):Void {
    		if(_level0["box"+a].targetBox.getProgress == loadProgress.bytesTotal){
    		gotoAndStop(5);
    		}
    	}
    it works, right after the first image is loaded and I need to have it work after the three containers I'm using load their respective images but not consecutivelly, but randomly, depending on their size.

    I tried it the long way as well and got the same result:

    Code:
    	myListener.onLoadInit = function(target:MovieClip):Void {
    		if(_level0.box1.targetBox.getProgress == loadProgress.bytesTotal && _level0.box2.targetBox.getProgress == loadProgress.bytesTotal && _level0.box3.targetBox.getProgress == loadProgress.bytesTotal){
    		gotoAndStop(5);
    		}
    	}

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    897
    Hi,

    Here you go Cap, a refurbished file for you,

    CS5:

    As for loading the images by size, that's a different story, you'll probably need to create array of the sizes and sort them high to low, you will probably need to create the array using php with getimagesize(); or filesize(); you'll need to look it up.
    this is incase you wish to swap images a lot or whenever, then you can do it on the fly dynamically.

    then load your images according to the array.

    if you never change the images, then find out what size they are and create your array by hand.
    something like so,
    PHP Code:
    var sizeArray = ["image4.jpg""image3.jpg""image1.jpg""image2.jpg"]; 

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    897
    Hi,

    Here is a version which will load the images randomly for you, basically it just swaps the order around each time you publish it, or run it.

    CS5:

  4. #4
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    309
    Thanks, FruitBeard,

    I did solve that late that night creating an object, if it is called so. Or an array; I found a similar thread where a variable is declared at the begginig of the frame and then just add another instance onLoadInit: something like so:

    var imagesLoaded:Number = 0;

    myListener.onLoadInit = function(target:MovieClip):Void {

    imagesLoaded ++;
    gotoAndStop(4);
    }
    }

    myListener.onLoadComplete = function(target:MovieClip):Void {

    }

    myLoader.addListener(myListener);
    myLoader.loadClip(url+"Untitled - "+a+".jpg", "box"+a+".targetBox");

    }

    But now I'm having a new issue and it looks as if you're the only person caring to answer here so I might as well ask you in this reply whether there is a way to annull a mouseListener from a button on(release) handler.

    My gallery is begginig to look as one but if I change urls the way I have set it up, obviously when clicking on a different url button the mouseListener runs and causes a little conflict loading the images. I'm not uploading the file because I might be able to post it in a few days now that I have a better deal with my ISP.

  5. #5
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    897
    Hi,

    In the files I have attached I removed any of your mouse listeners (if you look at the code).

    You can always use movieClipName.button.enabled = false; and then enable it after your motion has finished, which is in the files.

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    897
    Hi,

    Last one for you Cap, all 3 attachments have most (but not all) of the drab initial code removed and reasonably different from the original, all code is also removed from your button clips too - CS5:

  7. #7
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    897
    Hi,

    Ok I missed something on the last one, so do this one: CS5

  8. #8
    Senior Member
    Join Date
    Jan 2007
    Location
    Barcelona
    Posts
    309
    Thanks again, FruitBeard,

    I'm still checking the versions you have included. Thanks a lot for your time, but I need to stop the slide run, that's why I used the listener to stop it and rename all the boxes. I do want that option. What worries me is figuring out how to disable or avoid the mouse Listener if I change directories. That will take me some time to see.

    Ok. I think I saw what you're suggesting with enabling the clipButton as I was writing ... let me look at it and get things straightened out before I click on your banner and treat you to a couple of ebeers.

    by the way. I've contacted my ISP technical department and they haven't been able to tell me why my page won't load properlly. I never changed a thing and all of a sudden it simply quit showing any images. I suspected it could be related to a domain policy issue, but I don't remember if I had a crossdomain file in my site or not. It worked though. This would be it: http://webs.ono.com/jpdurba/

    thanks

  9. #9
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    897
    Hi,

    Thank you for the ebeer, I shall enjoy it and cheer you when I do.
    I looked at your link yesterday and it didn't work, I looked again today and it seems to work fine, some nice images there.
    From seeing the way you have your image paths I don't think you need to worry about domain policy too much.
    i look forward to helping you with other things too.

    Fruit

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