[Flashcoders] Load centered images in movie clip - Heeelp!
Hi all, im making a gallery that load an image in a movie clip when i click in a button. All seems to work perffectly in local. My problem is when i put my gallery on-line. To me it appears not to get the width and the height untill the image is fully loaded. In the AS have some kind of checker, but obviously its not working, can someone help this semi-noob? :) here is the link: http://www.tendez.com.br/lage/test/flash_coders_image_loader.html Here comes the code i used in the first frame: spacing = 10; containerMC._alpha = 0; MovieClip.prototype.loadPic = function(pic) { _root.containerMC._alpha = 0; this.loadMovie(pic); _root.onEnterFrame = function() { var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded(); if (t != 0 Math.round(l/t) == 1) { var w = containerMC._width+spacing, h = containerMC._height+spacing; border.resizeMe(w, h); delete _root.onEnterFrame; } }; }; MovieClip.prototype.resizeMe = function(w, h) { var speed = 3; this.onEnterFrame = function() { this._width += (w-this._width)/speed; this._height += (h-this._height)/speed; if (Math.abs(this._width-w)1) { this._width = w; this._height = h; _root.containerMC._x = this._x-this._width/2+spacing/2; _root.containerMC._y = this._y-this._height/2+spacing/2; _root.containerMC._alpha = 100; delete this.onEnterFrame; } }; }; in the button that calls the image: on (release) { containerMC.loadPic(galerias/aleatorio_01/img/01.jpg); } Many, many thanks! Rodrigo. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Load centered images in movie clip - Heeelp!
Try using a MovieClipLoader and then wait for the onLoadInit event, after that you can set the x and y based on the width and height. Daniel ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Load centered images in movie clip - Heeelp!
The problem lies in loadMovie. Locally, the picture is already loaded, so when you ask for the pic properties, the computer can give it to you already. Online, however, you'll be downloading the picture while trying to find out its dimensions. Use MovieClipLoader, and use the listener onLoadInit. In that listener you can put the code to center your image, resize it, etc. Goodluck, -- Ramon Miguel M. Tayag ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Load centered images in movie clip - Heeelp!
Remember, im a semi-noob (or real noob, if you wich... :)), i dont have a clue where to put this codes... Rodrigo. - Original Message - From: Ramon Tayag [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Wednesday, February 15, 2006 3:52 PM Subject: Re: [Flashcoders] Load centered images in movie clip - Heeelp! The problem lies in loadMovie. Locally, the picture is already loaded, so when you ask for the pic properties, the computer can give it to you already. Online, however, you'll be downloading the picture while trying to find out its dimensions. Use MovieClipLoader, and use the listener onLoadInit. In that listener you can put the code to center your image, resize it, etc. Goodluck, -- Ramon Miguel M. Tayag ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Load centered images in movie clip - Heeelp!
See movieClipLoader in the help files for actual examples. -Marc At 10:22 AM 2/15/2006, you wrote: Remember, im a semi-noob (or real noob, if you wich... :)), i dont have a clue where to put this codes... Rodrigo. - Original Message - From: Ramon Tayag [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Wednesday, February 15, 2006 3:52 PM Subject: Re: [Flashcoders] Load centered images in movie clip - Heeelp! The problem lies in loadMovie. Locally, the picture is already loaded, so when you ask for the pic properties, the computer can give it to you already. Online, however, you'll be downloading the picture while trying to find out its dimensions. Use MovieClipLoader, and use the listener onLoadInit. In that listener you can put the code to center your image, resize it, etc. Goodluck, -- Ramon Miguel M. Tayag ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com