Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flash General Questions > Flash 9 General Questions

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-14-2010, 10:12 PM   #1
ddtom13
Registered User
 
Join Date: Sep 2010
Posts: 2
Default Help Centering Images in Image Gallery

Hi just looking for a little help..hopefully its an easy fix.

Right now when my gallery loads my images via XML it seems to place them from the top left corner of the picture. i would like for them to load from the center of the image so when different size pictures load they will all be centered correctly. This is my code:

_root.main.big_mc.big_mc_image.textLoader._visible = false;
var _loc2 = _root.main.big_mc.big_mc_image.createEmptyMovieCli p("container", "100");
_loc2._x = 0;
_loc2._y = 0;
_root.main.big_mc.big_mc_image.my_mc = new MovieClipLoader();
preload = new Object();
_root.main.big_mc.big_mc_image.my_mc.addListener(p reload);
preload.onLoadStart = function (targetMC)

I can adjust the x value but that isnt a good fix as it will only work if all the images are the same size (which they are not). Any help will be greatly appreciated.
ddtom13 is offline   Reply With Quote
Old 09-16-2010, 03:33 AM   #2
ddtom13
Registered User
 
Join Date: Sep 2010
Posts: 2
Default Any Help

Any help with this would be great ive wasted hours trying to correct it.


_root.main.big_mc.big_mc_image.textLoader._visible = false;
var _loc2 = _root.main.big_mc.big_mc_image.createEmptyMovieCli p("container", "100");
_loc2._x = 0 ;
_loc2._y = 0;
_root.main.big_mc.big_mc_image.my_mc = new MovieClipLoader();
preload = new Object();
_root.main.big_mc.big_mc_image.my_mc.addListener(p reload);
preload.onLoadStart = function (targetMC)

{
_root.main.big_mc.big_mc_image.container._alpha = 0;
_root.main.big_mc.big_mc_image.textLoader._visible = true;
};
preload.onLoadProgress = function (targetMC, lBytes, tBytes)
{
percentage = int(lBytes / tBytes * 100);
_root.main.big_mc.big_mc_image.textLoader.loader.g otoAndStop(percentage);
_root.main.big_mc.big_mc_image.textLoader.loader.a utoSize = true;
_root.main.big_mc.big_mc_image.textLoader.loader.t ext = Math.round(lBytes / tBytes * 100);
};
preload.onLoadComplete = function (targetMC)
{
changeColor();
_root.main.big_mc.big_mc_image.container._alpha = 100;
_root.main.big_mc.big_mc_image.textLoader._visible = false;
};
_root.main.big_mc.big_mc_image.my_mc.loadClip(theP icPath, "_root.main.big_mc.big_mc_image.container");

I tried using this code in a few different ways but as soon as i change the preload.onLoadStart everything gets messed up.

_root.createEmptyMovieClip("imagecontainer", _root.imagecontainer.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadInit = function(mc:MovieClip) {//is now loaded and initialized in flash,- ready to center
mc._x = Stage.width/2 - mc._width/2;
mc._y = Stage.height/2 - mc._height/2;
}
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("image18.jpg", imagecontainer);

I just need to find a way to divide this by 2
_root.main.big_mc.big_mc_image.container.

nothing is working
ddtom13 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:18 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.