hi dailyunnnamed,
Pretty nice solution is to use image definitions aand adding an eventlistener to the swf files. For instance for each movieclip that is held in
infiniteGallery would be called by saying:
var speed:Number = 0;
//Add around this point
var stageImageHolder:MovieClip = new MovieClip();
infiniteGallery.movieClip1.name = “m1″
infiniteGallery.movieClip1.addEventListener(mouseEvent.CLICK, getTarget);
//then define the getTarget function with a loader for instance:
function getTarget(imgEvent:mouseEvent):void
{
var loader:Loader = new Loader();
stageImageHolder.addChild (loader);
loader.load (new URLRequest(“directory with images stored” + imgEvent.name + “.jpg”));
loader.contentLoaderInfo.addEventListener (Event.INIT, imageLoaded);
function imageLoaded (evt:Event):void
{
//loader.contentLoaderInfo.removeEventListener (Event.INIT,imageLoaded);
var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
var dispObj:DisplayObject = loaderInfo.content;
var thisWidth = dispObj.width;
var thisHeight = dispObj.height;
var maxW = 320;
var maxH = 240;
var _ratio = thisHeight / thisWidth;
if (thisWidth > maxW)
{
thisWidth = maxW;
thisHeight = Math.round(thisWidth * _ratio);
}
if (thisHeight > maxH)
{
thisHeight = maxH;
thisWidth = Math.round(thisHeight / _ratio);
}
dispObj.width = thisWidth;
dispObj.height = thisHeight;
dispObj.x=(maxW-dispObj.width)/2;
dispObj.y=(maxH-dispObj.height)/2;
}
}
This is a rough painting of a script you could look at…
happy coding!
inter-reality.com – the true art of coding