|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
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); }; |
|
|
|
#3 (permalink) |
|
Messages: n/a
Hébergeur: |
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(); } |
|
![]() |
| Outils de la discussion | |
|
|