- Bought between 1 and 9 items
- Exclusive Author
- Has been a member for 6-7 years
- Netherlands
- Referred between 50 and 99 users
- Sold between 1 000 and 5 000 dollars
He guys,
FD has been a great learning experience for me and making a little money on the side.
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?
yep, you can get the width and height on the onLoadInit function.
- Bought between 1 and 9 items
- Exclusive Author
- Has been a member for 6-7 years
- Netherlands
- Referred between 50 and 99 users
- Sold between 1 000 and 5 000 dollars
Fantastic, thanks for the tip!
- Author was Featured
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 6-7 years
- Item was Featured
- Microlancer Beta Tester
- Referred between 500 and 999 users
- Sold between 100 000 and 250 000 dollars
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);
- Bought between 1 and 9 items
- Exclusive Author
- Has been a member for 6-7 years
- Netherlands
- Referred between 50 and 99 users
- Sold between 1 000 and 5 000 dollars
Thanks very much for that example Bobocel. Now I don’t have to look it up anymore. Very clear example indeed.
