:: matrix, fausse 3d, profondeur. utilisation des object et des protos.

Description

utilisation des protos, des objects, des duplicatemovie, etc...
simulation d'un deplacement de camera.

Source / Exemple :


matrix = new Object();
matrix = {clip:_root.matrice, screenLimit:40, chrMap:chrlist, chrLimit:8, speed:10};
chrlist = "abcdefghijklmnopqrstuvwxyz";
scaleFactor = 50/matrix.screenLimit;
m = 0;
function num2hex(num) {
	switch (num) {
	case 10 :
		return "A";
		break;
	case 11 :
		return "B";
		break;
	case 12 :
		return "C";
		break;
	case 13 :
		return "D";
		break;
	case 14 :
		return "E";
		break;
	case 15 :
		return "F";
		break;
	default :
		return num;
		break;
	}
}
this.cursor_new_x = 450;
MovieClip.prototype.get_cursor_vx = function() {
	this.cursor_old_x = this.cursor_new_x;
	this.cursor_new_x = int(_xmouse);
	this.cursor_distance_x = this.cursor_new_x-this.cursor_old_x;
	return this.cursor_distance_x;
};
MovieClip.prototype.createNew = function() {
	i++;
	this.item.duplicateMovieClip("item"+i, i);
	this["item"+i]._alpha = i*_root.scaleFactor;
	this["item"+i]._xscale = this["item"+i]._yscale=i*_root.scaleFactor;
	this["item"+i]._x += Math.random()*450;
	this["item"+i]._y = Math.random()*600-360;
	this["item"+i].speed = matrix.speed*i/32;
	this["item"+i].factor = i*_root.scaleFactor;
	for (j=0; j<matrix.chrLimit; j++) {
		this["tf"+j] = new TextFormat();
		this["tf"+j].color = "0xFFFFFF";
		this["item"+i].matrice.text += chrlist.substr(Math.floor(Math.random()*length(chrlist)), 1)+"\n";
		Selection.setFocus(this["item"+i].matrice);
		Selection.setSelection(j, j+2);
		_root.debut = Selection.getBeginIndex(this["item"+i].matrice);
		_root.fin = Selection.getEndIndex(this["item"+i].matrice);
		this["item"+i].matrice.setTextFormat(_root.debut, _root.fin, this["tf"+j]);
	}
	this["item"+i].matrice.autoSize = true;
};
function launch() {
	for (k=1; k<matrix.screenLimit; k++) {
		matrix.clip.createNew();
	}
}
MovieClip.prototype.speed = function() {
	for (k=0; k<matrix.screenLimit; k++) {
		this["item"+k].xspeed = (_root.xspeed*this["item"+k].factor)/50;
	}
};
var itv = setInterval(function () { updateAfterEvent();}, 1);
launch();
_root.onEnterFrame = function() {
	_root.xspeed = -get_cursor_vx();
	matrix.clip.speed();
};
fscommand("fullscreen", "true");

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.