Groups | Blog | Home
all groups > flash actionscript > september 2004 >

flash actionscript : Image viewer for vertical and horizontal images



wsobreira
9/16/2004 10:20:06 PM
Hello all !!!
I've made an image viewer that loads the image inside a movie clip, but i need
it to identify if the image is horizontal or vertical and place it centered
inside the movie clip, other issue is that the images displayed must come
directly from a JPG file, so the owner of the site can update the pictures
himself.

My question is if anyone can help me with a "Dummy" way of doing it, since
I'am a "Dummy"! :-)

Thank you All
And best regards!!!
Leopold Hastreiter
9/16/2004 10:42:44 PM
Hi there,

Good news is that I am working on a similar project, bad news is that I'm a
dummy too. Try checking the
http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=288&thre
adid=892047 where I asked, it should answer some of your questions.

To center the images I would try some formular like this:

newLocX = (stageWidth / 2) - (imageWidth / 2)
newLocY = (stageHeight / 2) - (imageHeight / 2)

Good luck!
wsobreira
9/16/2004 10:54:15 PM
NSurveyor
9/16/2004 11:05:28 PM
First have an empty movieclip, on the main stage with the instance name
finalimage. Inside that movieclip insert a movieclip (with instance name
imageholder) and place it at 0,0 of finalimage.
Now on the main timeline add this on the first frame:

_root.imageholder.loadMovie("THENAMEOFTHEJPEG.jpg");
if (_root.finalimage.imageholder._width > _root.final.imageholder._height) {
//theimage is horizontal
} else if (_root.finalimage.imageholder._width <
_root.finalimage.imageholder._height) {
//theimage is verical
} else {
//the image is a square
}
_root.finalimage.imageholder._x = 0 - (_root.finalimage.imageholder._width/2);
_root.finalimage.imageholder._y = 0 - (_root.finalimage.imageholder._height/2);

AddThis Social Bookmark Button