Menu vertical elastique fluide

Description

Simple menu vertical, non dynamique, élastique et facilement paramétrable dans Flash.

Version du Flash : 8

Je partage cette source avec vous, ça ne vient pas de moi, ce n'est pas moi qui l'a codée, on m'a offert le code, j'ai retravaillé le tout et je vous donne ma source telle que je l'ai utilisée.

Source / Exemple :


_global.menuNum = 5
_global.spd = 4
for ( i=1 ; i<=menuNum ; i++ ) {
	inNum = 1
	while ( inNum > maxNum ) {
		if ( this['sub'+i+inNum] == undefined ) {
			maxNum = inNum+1
		}
		this['sub'+i+inNum]._alpha = 0
		this['sub'+i+inNum]._y = - 200
		inNum++
	}
	this['subNum'+i] = inNum - 2
	this['subHei'+i] = this['subNum'+i] * 15 + 34
	maxNum = 0
}

this.onEnterFrame = function() {
	for ( i=1 ; i<=menuNum ; i++ ) {
		if ( name ) {
			if ( name == i ) {
				this['line'+i]._y += (this['line'+(i-1)]._y + this['subHei'+i] - this['line'+i]._y )/spd
				this['btn'+i]._height = this['subHei'+i]
				this['mtx'+i]._y += ( this['line'+(i-1)]._y - 0 - this['mtx'+i]._y )/spd
				dn = 20
				for ( n=1 ; n<=this['subNum'+i] ; n++ ) {
					dn += 15
					this['sub'+i+n]._alpha += ( 100 - this['sub'+i+n]._alpha)/spd
					this['sub'+i+n]._y = Math.round(this['mtx'+i]._y + dn)
				}
				dn = 0
			} else {
				this['line'+i]._y += (this['line'+(i-1)]._y + 30 - this['line'+i]._y )/spd
				this['btn'+i]._height = 30
				this['mtx'+i]._y += ( this['line'+(i-1)]._y + 26 - this['mtx'+i]._y )/spd
				for ( n=1 ; n<=this['subNum'+i] ; n++ ) {
					this['sub'+i+n]._alpha = 0
					this['sub'+i+n]._y = -200
				}
			}
		} else {
			this['line'+i]._y += (this['line'+(i-1)]._y + 30 - this['line'+i]._y )/spd
			this['btn'+i]._height = 30
			this['mtx'+i]._y += ( this['line'+(i-1)]._y + 26 - this['mtx'+i]._y )/spd
			for ( n=1 ; n<=this['subNum'+i] ; n++ ) {
				this['sub'+i+n]._alpha = 0
				this['sub'+i+n]._y = -200
			}
		}
		this['mask'+i]._y += (this['line'+(i-1)]._y - this['mask'+i]._y)/spd
		this['btn'+i]._y = this['line'+(i-1)]._y
	}
}

for( i=1 ; i<=menuNum ; i++ ) {
	this['btn'+i].onRollOver = function() {
		name = this._name.substring(3,4)
	}
	this['btn'+i].onRollOut = function() {
		name = undefined
		if ( _root.page ) {
			name = _root.page	
		}		
	}
	this['btn'+i].onRelease = function() {
		name = this._name.substring(3,4)	
		getURL(_root['connURL'+name+'0'])
	}
	for ( n=1 ; n<=menuNum ; n++ ) {
		this['sub'+i+n].onRollOver = function() {
			name = this._name.substring(3,4)
		}
		this['sub'+i+n].onRollOut = function() {
			name = undefined
			if ( _root.page ) {
				name = _root.page	
			}			
		}
		this['sub'+i+n].onRelease = function() {
			name = this._name.substring(3,5)
			getURL(_root['connURL'+name])
		}
	}
}
if ( _root.page ) {
	name = _root.page	
}

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.