All pastes #205344 Raw Edit

Untitled

public text v1 · immutable
#205344 ·published 2006-10-16 19:00 UTC
rendered paste body
evt.onPress = function() {
		// start dragging the current clip.
		this.startDrag();
		/* set the _xscale and _yscale properties back to 100% so the image appears full sized. 
		   You're also storing the original X and Y coordinates so you can return the image where you found it. */
		this._xscale = 100;
		this._yscale = 100;
		this.origX = this._x;
		this.origY = this._y;
		// find the depth of the current movie clip, and store it within the movie clip.
		this.origDepth = this.getDepth();
		/* :TRICKY: swap the depth of the current movie clip, with the next highest movie clip of the _parent. 
		   Effectively this makes the current movie clip the top of the "stack". */
		this.swapDepths(this._parent.getNextHighestDepth());
		// try and center the current movie clip on the Stage.
		this._x = (_global.stageWidth-evt._width+30)/2;
		this._y = (_global.stageHeight-evt._height+30)/2;
		// apply a transition to the movie clip which makes the movie clip flicker for a split second.
		mx.transitions.TransitionManager.start(this, {type:mx.transitions.Photo, direction:0, duration:1, easing:mx.transitions.easing.Strong.easeOut, param1:empty, param2:empty});
	};
	/* when the movie clip instance is released, stop dragging the movie clip. 
	   Reset the _xscale and _yscale properties as well as the _x and _y coordinates. */
	evt.onRelease = function() {
		this.stopDrag();
		this._xscale = this.scale;
		this._yscale = this.scale;
		this._x = this.origX;
		this._y = this.origY;
	};