381 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 50+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+2 more
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?

2671 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 100+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 50+ items on Envato Market
+5 more
Chuckanucka says

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

381 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 50+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+2 more
Yvo says

Fantastic, thanks for the tip!

3402 posts
  • Has been part of the Envato Community for over 8 years
  • Has referred 500+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+6 more
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);

381 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 50+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+2 more
Yvo says

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

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by