// image should be in container_mc.blank_mc movie_mask_mc.onMouseMove = function():Void { // absolute position of mask on root level var posOnRootLeft:Number = _parent._x + this._x; var posOnRootTop:Number = _parent._y + this._y; // are we inside of mask? if (_xmouse >= posOnRootLeft && _xmouse <= this._width - posOnRootLeft && _ymouse >= posOnRootTop && _ymouse <= this._height - posOnRootTop) { delete container_mc.blank_mc.onEnterFrame; // position of mouse relative to mask var mouseLeft:Number = _xmouse - posOnRootLeft; var mouseTop:Number = _ymouse - posOnRootTop; // 1 percent relatively to width and height of content var mw:Number = (container_mc.blank_mc._width - this._width) / 100; var mh:Number = (container_mc.blank_mc._height - this._height) / 100; // position in percent var xPerc:Number = (mouseLeft / this._width) * 100; var yPerc:Number = (mouseTop / this._height) * 100; container_mc.blank_mc._x = mw * -xPerc; container_mc.blank_mc._y = mh * -yPerc; } else { container_mc.blank_mc.onEnterFrame = function():Void { var step:Number = 30; if (this._x < step && this._x > -step && this._y < step && this._y > -step) { this._x = 0; this._y = 0; delete this.onEnterFrame; } else { if (this._x > step || this._x < -step) { this._x += this._x > 0 ? -step : step; //trace('x: ' + this._x); } if (this._y > step || this._y < -step) { this._y += this._y > 0 ? -step : step; //trace('y: ' + this._y); } } }; } };