PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Graphisme & Infographie > macromedia.flash > Can only set 1 variable--real weird, AS2.
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Can only set 1 variable--real weird, AS2.

Réponse
 
LinkBack Outils de la discussion
Vieux 06/04/2008, 07h07   #1 (permalink)
Tolouse
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Can only set 1 variable--real weird, AS2.

So I'm hoping this is a moment of idiocy that's easily remedied. I set
variables, one in the first frame of each slider:

Water slider: this.percwet=0 ;
Temp slider: this.perc=0 ;

And then there's a whole load of code that links the percent along the height
of the slider to a frame in its corresponding movieclip.

I can use either slider to control either clip, but only one at a time. It
will only let me set "perc" or "percwet," but not both at once. I tried
setting the variables using different scripts and with different variable
names. http://gryphus.googlepages.com/sliderfla.fla
Either I am missing something obvious, or my install is funky... this FLA is
the third time I rebuilt the movie.

  Réponse avec citation
Vieux 06/04/2008, 11h11   #2 (permalink)
rlc5611
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can only set 1 variable--real weird, AS2.

Your are placing an onEnterFrame function on "this" twice. The second one is
overwriting the first one.

Either combine all your script into one function, apply your onEnterFrame
functions to two different clips or use setIntervals.

Replace your two enterframe functions with this.

slider.onEnterFrame = function() {
this._parent.temp.gotoAndStop(this.perc);
};
sliderwet.onEnterFrame = function() {
this._parent.rain.gotoAndStop(11-this.percwet);
};

  Réponse avec citation
Vieux 06/04/2008, 12h32   #3 (permalink)
rlc5611
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can only set 1 variable--real weird, AS2.

Although the script in the previous post worker, I found a couple of other
issues inside the clips themselves. I recommend you edit each of the slider
clips and delete all the AS you have in those clips.

Next delete the AS you have in the two keyframes in the _root timeline.

The put the attached script in a keyframe in the main timeline. It will do all
you were doing before but it fixes two errors and it also stops running four
onEnterFrame functions when you are not moving the sliders so it will make your
SWF use less resources.

slider.handle.onPress=function(){
this.startDrag(true,0,this._parent.rail._height,0, 0);
this.onEnterFrame=function(){
this.perc=Math.round(this._y*10/this._parent.rail._height);
this._parent._parent.temp.gotoAndStop(this.perc);
}
}
slider.handle.onRelease = slider.handle.onReleaseOutside = function(){
delete this.onEnterFrame;
stopDrag();
}
sliderwet.handlewet.onPress=function(){
this.startDrag(true,0,this._parent.railwet._height ,0,0);
this.onEnterFrame=function(){
this.percwet=Math.round(this._y*10/this._parent.railwet._height);
//btw this seems backwards to me but it mimics what you had in your original
FLA
this._parent._parent.rain.gotoAndStop(11-this.percwet);
}
}
sliderwet.handlewet.onRelease = sliderwet.handlewet.onReleaseOutside =
function(){
delete this.onEnterFrame;
stopDrag();
}

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h38.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08390 seconds with 11 queries