choinet
Messages postés89Date d'inscriptionmardi 8 février 2005StatutMembreDernière intervention 3 novembre 2008 29 oct. 2007 à 15:16
très bien
pour la note c'est pas flateur mais au moins j'aurais appris quelque chose.
top30
Messages postés1158Date d'inscriptionvendredi 21 février 2003StatutMembreDernière intervention 6 août 2010 26 oct. 2007 à 22:49
/**
* A coller dans la première frame dans document Flash de 300x250, fond noir, 25 FPS minimun...
* Au click down, les barres s'écartent, au click up, chacunne revienn à sa position d'origine.
**/
var barList : Array = [];
var barMax : Number = 30;
//
//
var i : Number = - 1;
while ( ++ i < barMax) barList.push (getBar (this, 'bar' + i, 1, 20));
//
//
this.onMouseDown = function () : Void
{
for (var i in barList) barList [i].go ();
};
this.onMouseUp = function () : Void
{
for (var i in barList) barList [i].back ();
};
//
//
function getBar (target : MovieClip, name : String, min : Number, max : Number) : MovieClip
{
var bar : MovieClip = target.createEmptyMovieClip (name, target.getNextHighestDepth ());
bar._x = (Math.random () * 320) - 10;
bar._n = bar._x;
//
var width : Number = min + (Math.random () * (max - min));
bar.beginFill (0xFFFFFF, (Math.random () * 90) + 10);
bar.lineTo (width, 0);
bar.lineTo (width, 200);
bar.lineTo (0, 200);
bar.lineTo (0, 0);
//
//
bar.go = function () : Void
{
var end : Number = 350;
if (_root._xmouse > (this._x+this._width/2)) end = - 50;
//
this.onEnterFrame = function () : Void
{
this._x += (end - this._x) / 3;
if (Math.round (this._x) == Math.round (end)) delete this.onEnterFrame;
};
};
bar.back = function () : Void
{
this.onEnterFrame = function () : Void
{
this._x += (this._n - this._x) / 6;
if (Math.round (this._x) == Math.round (this._n)) delete this.onEnterFrame;
};
};
return bar;
}
Désolé...
3/10, le 3 c'est pour l'idée !
choinet
Messages postés89Date d'inscriptionmardi 8 février 2005StatutMembreDernière intervention 3 novembre 2008 26 oct. 2007 à 10:53
OK
j'ai un vrai problème avec l'envoi des sources : erreur de je sais pas quoi. Le message me dit que Nix est au courant...en attendant, je met la source en ligne à cette adresse :
http://www.ze-group.com/telechargement/ecarteur.zip
Bon flash à tous
choinet
Messages postés89Date d'inscriptionmardi 8 février 2005StatutMembreDernière intervention 3 novembre 2008 26 oct. 2007 à 10:42
Merci pour l'info, je ne connaissais pas cette manière de faire
Je vais essayer de l'améliorer et la reposter plus tard.
Je ne pensais pas que ma sources était passée...il y a eu beaucoup de bugs sur flashkod ces temps ci non?
top30
Messages postés1158Date d'inscriptionvendredi 21 février 2003StatutMembreDernière intervention 6 août 2010 24 oct. 2007 à 09:36
Y a pas de source !!!!!
Facon c'est mal 'encodé". Exemple, tu reboucles à "i" sas arret.
Autant faire....
// STOCKAGE TRAITS ET MEMORISATION
_traitsList= [] ;
for (i=1; i<=10; i++) {
var trait = this["trait"+i] ;
//
trait.origineX= trait._x ;
_traitsList.push(trait) ;
}
// CHAQUE FOIS QUE TU VEUX FAIRE UN "TRUC" SUR TOUT LES TRAITS
for( var i in _traitsList ){
var traitActuel= _traitsList[i] ;
etc....
}
// PAR EMPLE :
function barrezvous() {
temporisationretour = 1;
difflargeur = (maxilargeurbase-maxilargeur)/2;
for( var i in _traitsList {
var trait= _traitsList[i] ;
//
// NULL ! Pourquoi encombré le clip de variable porpre au "trait:
// this["aleat"+i] = random(50);
trait.random= Math.round( Math.random()*50) ;
//DEFINITION DU BUT A ATTEINDRE
//CONDITION SI LE TRAIT EST A GAUCHE OU A DROITE DU CLIC
var clickGauche = (clicx<= trait._x) ;
trait.but= (trait.random+difflargeur)-(clickGauche? maxilargeur : 0 );
}
etc...
29 oct. 2007 à 15:16
pour la note c'est pas flateur mais au moins j'aurais appris quelque chose.
26 oct. 2007 à 22:49
* A coller dans la première frame dans document Flash de 300x250, fond noir, 25 FPS minimun...
* Au click down, les barres s'écartent, au click up, chacunne revienn à sa position d'origine.
**/
var barList : Array = [];
var barMax : Number = 30;
//
//
var i : Number = - 1;
while ( ++ i < barMax) barList.push (getBar (this, 'bar' + i, 1, 20));
//
//
this.onMouseDown = function () : Void
{
for (var i in barList) barList [i].go ();
};
this.onMouseUp = function () : Void
{
for (var i in barList) barList [i].back ();
};
//
//
function getBar (target : MovieClip, name : String, min : Number, max : Number) : MovieClip
{
var bar : MovieClip = target.createEmptyMovieClip (name, target.getNextHighestDepth ());
bar._x = (Math.random () * 320) - 10;
bar._n = bar._x;
//
var width : Number = min + (Math.random () * (max - min));
bar.beginFill (0xFFFFFF, (Math.random () * 90) + 10);
bar.lineTo (width, 0);
bar.lineTo (width, 200);
bar.lineTo (0, 200);
bar.lineTo (0, 0);
//
//
bar.go = function () : Void
{
var end : Number = 350;
if (_root._xmouse > (this._x+this._width/2)) end = - 50;
//
this.onEnterFrame = function () : Void
{
this._x += (end - this._x) / 3;
if (Math.round (this._x) == Math.round (end)) delete this.onEnterFrame;
};
};
bar.back = function () : Void
{
this.onEnterFrame = function () : Void
{
this._x += (this._n - this._x) / 6;
if (Math.round (this._x) == Math.round (this._n)) delete this.onEnterFrame;
};
};
return bar;
}
Désolé...
3/10, le 3 c'est pour l'idée !
26 oct. 2007 à 10:53
j'ai un vrai problème avec l'envoi des sources : erreur de je sais pas quoi. Le message me dit que Nix est au courant...en attendant, je met la source en ligne à cette adresse :
http://www.ze-group.com/telechargement/ecarteur.zip
Bon flash à tous
26 oct. 2007 à 10:42
Je vais essayer de l'améliorer et la reposter plus tard.
Je ne pensais pas que ma sources était passée...il y a eu beaucoup de bugs sur flashkod ces temps ci non?
24 oct. 2007 à 09:36
Facon c'est mal 'encodé". Exemple, tu reboucles à "i" sas arret.
Autant faire....
// STOCKAGE TRAITS ET MEMORISATION
_traitsList= [] ;
for (i=1; i<=10; i++) {
var trait = this["trait"+i] ;
//
trait.origineX= trait._x ;
_traitsList.push(trait) ;
}
// CHAQUE FOIS QUE TU VEUX FAIRE UN "TRUC" SUR TOUT LES TRAITS
for( var i in _traitsList ){
var traitActuel= _traitsList[i] ;
etc....
}
// PAR EMPLE :
function barrezvous() {
temporisationretour = 1;
difflargeur = (maxilargeurbase-maxilargeur)/2;
for( var i in _traitsList {
var trait= _traitsList[i] ;
//
// NULL ! Pourquoi encombré le clip de variable porpre au "trait:
// this["aleat"+i] = random(50);
trait.random= Math.round( Math.random()*50) ;
//DEFINITION DU BUT A ATTEINDRE
//CONDITION SI LE TRAIT EST A GAUCHE OU A DROITE DU CLIC
var clickGauche = (clicx<= trait._x) ;
trait.but= (trait.random+difflargeur)-(clickGauche? maxilargeur : 0 );
}
etc...
J'attend la source pour mettre note....