////////////////////////////////////////////////////
//
// //CMAX --------- 18/2/2007 ---------- 02:48
//
////////////////////////////////////////////////////
import flash.geom.Rectangle;
import flash.geom.Point;
var __img:MovieClip;
var __trg:MovieClip;
var __mcl:MovieClipLoader;
function VirtualTour (__mc:MovieClip, file:String)
{
__img = __mc.createEmptyMovieClip ("__img", 1);
__img._x = 20;
__img._y = 20;
__img.cacheAsBitmap = true;
__trg = __mc;
rect = new Rectangle (0, 0, 450, 250);
__mc.createEmptyMovieClip ('str', __mc.getNextHighestDepth ());
__mc.str.lineStyle (1, 0x000000);
__mc.str.moveTo (20, 20);
__mc.str.lineTo (470, 20);
__mc.str.lineTo (470, 270);
__mc.str.lineTo (20, 270);
__mc.str.lineTo (20, 20);
mouse = new Point (0, 0);
x_pos = 0;
y_pos = 0;
__mcl = new MovieClipLoader ();
__mcl.addListener (this);
__mcl.loadClip (file, __img);
}
function onLoadInit (tg:MovieClip):Void
{
r_img = new Rectangle (0, 0, __img._width, __img._height);
r_mask = new Rectangle (__img._x, __img._y, rect.width, rect.height);
start ();
}
function start ():Void
{
__img.scrollRect = rect;
__img.onEnterFrame = function ()
{
mouse.x = __trg._xmouse;
mouse.y = __trg._ymouse;
if (r_mask.containsPoint (mouse))
{
y_pos = ((Math.abs (__img._y - mouse.y) / rect.height) * (r_img.height - rect.height));
x_pos = ((Math.abs (__img._x - mouse.x) / rect.width) * (r_img.width - rect.width));
}
rect.x += (x_pos - rect.x) / 8;
rect.y += (y_pos - rect.y) / 8;
__img.scrollRect = rect;
};
}
VirtualTour (this, 'image.jpg');
//////
////////////////////////////////Have Good Time /////////////////////////////
//CMAX ---------- 18/2/2007 ------------------- 02:48