I am using the kirupa xml foto gallery and I am loading different sized images… if they would load nicely centered the problem is solved… (not to stage width/height…!!)
The movieclip “picture” has to load the images centered from its own registration point so that it can be placed anywhere on the stage…
now its loads the images from aka left top…
any help greatly appreciated…
best
arn
i used this :
_x -= _width/2;
_y -= _width/2;
but it throws the images in a strange place on stage…
i’m not familiar with the kirupa gallery, but standard the registration point of a movieclip is top left. So you can use this knowledge to center the image.
However, this can only be done AFTER the image is loaded, so keep that in mind.
After it’s been loaded, just do somethink like this:
If you plan on doing it like this, and load every image in the same mc_image movieclip, you have to set the _xscale and _yscale back to 100 every time you load a new image into it.
…it has to be centered to it’s own registration point…not that of the for example “stage”…
By the way…
My “picture” clip is completely emty…aka…no content on frame one…
(just using it like a container function…). is this right?..
hope someone can bring up the code…I think we are getting close…
Rasper your last code does the centering job …but it puts the loaded images not anywhere near the “picture” clip…i moved it across the stage but your code places the pictures always at the same position…
seam not te relate to the picture clip position…although it does the job…some finetuning…needed…
it will place the movieclip at the coördinates that equal to the half of your image size. For example if your picture-movieclip is directly located in the _root, and it is 500px wide, this will mean that it will be placed on _x = 250. If it were 300px wide, it will be placed on _x = 150.
But, if you want to use an empty movieclip to place your image in, and then place that movieclip somewhere (manually) so that the registration point is the middle of the picture, you will have to do something else. I think you should put your picture-movieclip inside another ‘holder’ movieclip. When the picture is loaded, you can use the code in this post to position it inside that holder movieclip. That way you can keep your holder movieclip on the same centered place.
thanks for your explanation…this makes me think of the wellknown…
scale/resize function wich does the job perfectly…if there is someone out there who can implement this code into the kirupa xml gallery code…?..
scotty!!! and evereybody alse here invloved…
many thanks…your code works like a charme…
I knew you had the skills… I’ve checked severel other postings of you…
and your knowledge/dedication to this forum …is needed…and much respected…:thumb: