All pastes #792392 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-21 10:42 UTC
rendered paste body
import mx.transitions.Tween;
import mx.transitions.easing.*;

MovieClip.prototype.fadeIn = function(){
	this.onEnterFrame = function(){
		if(this._alpha <100){
			this._alpha +=10;
		}
		else{
			delete this.onEnterFrame;
		}
	}
}

MovieClip.prototype.fadeOut = function(unloadOnFinish:Boolean){
        this.onEnterFrame = function(){
                if(this._alpha >0){
                        this._alpha -=10;
                }
                else {
                        delete this.onEnterFrame;
                        if(unloadOnFinish == true) { 
                                unloadMovie(this); 
                        }
                }
        }
}

var mc:MovieClipLoader = new MovieClipLoader();
var preload:Object = new Object();

preload.onLoadStart = function(targetMC){
	targetMC._parent.thumb_mc._alpha = 0;
	targetMC._parent.back_mc._alpha = 0;
}

preload.onLoadProgress = function(targetMC, loadedBytes, totalBytes){
	targetMC._parent.preload.text = Math.round((loadedBytes/totalBytes)*100)+ "%";
	targetMC._parent.bar._width = Math.round((loadedBytes/totalBytes)*100);
	
}

preload.onLoadComplete = function(targetMC){
	targetMC._parent.bar._visible = false;
	targetMC._parent.preload._visible = false;
	targetMC._parent.thumb_mc.fadeIn();
	targetMC._parent.back_mc.fadeIn();
	targetMC._parent.onRelease = Release;
	targetMC._parent.onRollOver = Rollover;
	targetMC._parent.onRollOut = Rollout;
}

function Release(){
	trace("You press " + this);
}

function Rollover(){
	var tween1 : Tween = new Tween(this, "_alpha", Strong.easeOut, this._alpha, 50, 10, false);
}

function Rollout(){
	var tween2 : Tween = new Tween(this, "_alpha", Strong.easeOut, this._alpha, 100, 30, false);
}
	
	
function allFadeout(){
        for(i = 0; i<=12; i++){
                this["image"+i].fadeOut(true);
        }
}


function init(){
	var spacing = 20;
	var countlines = 0;
	var rows = -1;
	for(i = 0; i<12; i++){
		if(i%4!=0){
			countlines++;
		}
		else{
			countlines = 0;
			rows++;
		}
		sleep();
		var pop = this.attachMovie("image", "image" + i, i, {_x:(130*countlines) + spacing, _y:130*rows+spacing});
		mc.loadClip("image" + (i+1) + ".jpg", this["image"+i].thumb_mc);
	}
}
mc.addListener(preload);
init();
button.onRelease = function(){
	allFadeout();
	
}