ActiveDen

Size of a loaded picture

381 posts
  • Has been a member for 5-6 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
  • Netherlands
  • Referred between 50 and 99 users
Yvo says

He guys,

FD has been a great learning experience for me and making a little money on the side. :D I’m finally getting around to making my own first photo gallery in flash, but there is one thing I’m not sure about yet. I’ve seen many galleries around that use photo’s with different dimensions. It usually has a little frame around it, which first tweens to the size of the next photo and then the photo is loaded in.

Now my question is: If I use the MovieClipLoader class. Is there any way to check what the size is of the photo I loaded? Or do people simply put in the dimensions in the xml file and read it from there?

4 years ago
2671 posts
  • Has been a member for 5-6 years
  • Won a Competition
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 50 and 99 items
  • United Kingdom
  • Referred between 50 and 99 users
Chuckanucka says

yep, you can get the width and height on the onLoadInit function.

4 years ago
381 posts
  • Has been a member for 5-6 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
  • Netherlands
  • Referred between 50 and 99 users
Yvo says

Fantastic, thanks for the tip!

4 years ago
3336 posts
  • Has been a member for 5-6 years
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 10 and 49 items
  • Spain
  • Referred between 500 and 999 users
bobocel says

Here you go:


/**

Movieclip loader

*/

var listnerGallery : Object = new Object();

listnerGallery.onLoadProgress = function(mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void  
{
    var pct:Number = bytesLoaded/bytesTotal*100;
    if (pct>5) 
        {
        mcLoader._visible = true;
        mcLoader.mcBar._xscale = pct;
        }
};

listnerGallery.onLoadInit = function(mc:MovieClip) 
{
trace(mc._width + " " + mc._height);
};

var objGallery:MovieClipLoader = new MovieClipLoader();
objGallery.addListener(listnerGallery);
objGallery.loadClip("img.jpg", mcHolder);
//objGallery.unloadClip(mcHolder);

4 years ago
381 posts
  • Has been a member for 5-6 years
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 1 and 9 items
  • Netherlands
  • Referred between 50 and 99 users
Yvo says

Thanks very much for that example Bobocel. Now I don’t have to look it up anymore. Very clear example indeed.

4 years ago
by
by
by
by
by