How to stop Scrolling Thumbnails
#1
Posted 13 June 2007 - 03:13 AM
I can't seem to figure out how I am going to code the thumbnails to stop scrolling when the mouse is rollover over the icons.
Each thumbnail is a movieclip of an image and on each of the thumbnails the code below has been assigned to it:
onClipEvent(enterFrame) {
_x=_x+4;
if(_x>=657.3){
_x=-55;
}
}
Does anyone know how I can get the thumbnails to stop scrolling when the mouse is rolled over one of the thumbnails?
#2
Posted 13 June 2007 - 09:08 AM
this.onEnterFrame = function(){ move(); } this.onRollOver = function(){ delete this.onEnterFrame; } this.onRollOut = this.onReleaseOutside = function(){ this.onEnterFrame = function(){ move(); } } function move(){ _x=_x+4; if(_x>=657.3){ _x=-55; }
That should take care of it.
#3
Posted 13 June 2007 - 09:35 AM
**Error** Symbol=panel, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler
Edited by Jas, 13 June 2007 - 09:37 AM.
#4
Posted 13 June 2007 - 11:20 AM
Just make a new layer inside your mc and put the code of hte first keyframe of this layer.
#5
Posted 14 June 2007 - 02:44 AM
#6
Posted 14 June 2007 - 10:36 AM
if(_parent.btnArr == undefined){ _parent.btnArr = new Array(); } _parent.btnArr.push(this); this.onEnterFrame = function(){ move(); } this.onRollOver = function(){ for(var ii:Number = 0; ii < _parent.btnArr.length; ii++){ delete _parent.btnArr[ii].onEnterFrame; } } this.onRollOut = this.onReleaseOutside = function(){ for(var ii:Number = 0; ii < _parent.btnArr.length; ii++){ _parent.btnArr[ii].onEnterFrame = function(){ move(); } } } function move(){ _x=_x+4; if(_x>=657.3){ _x=-55; }
This code will add each button into an array, then on rollover loop through the array and apply the same code to each button. On rollout it will do the same. I didn't test the code at all, but it should work. Let me know how it goes.
#7
Posted 14 June 2007 - 11:04 AM
Edited by Jas, 14 June 2007 - 11:07 AM.
#8
Posted 14 June 2007 - 11:10 AM
Didnt close the move function, so it produced an error, and I forgot the move is a reserved word in flash, so I changed it to animate.
if(_parent.btnArr == undefined){ _parent.btnArr = new Array(); } _parent.btnArr.push(this); this.onEnterFrame = function(){ animate(); } this.onRollOver = function(){ for(var ii:Number = 0; ii < _parent.btnArr.length; ii++){ delete _parent.btnArr[ii].onEnterFrame; } } this.onRollOut = this.onReleaseOutside = function(){ for(var ii:Number = 0; ii < _parent.btnArr.length; ii++){ _parent.btnArr[ii].onEnterFrame = function(){ this.animate(); } } } function animate(){ _x=_x+4; if(_x>=657.3){ _x=-55; } }
#9
Posted 15 June 2007 - 02:46 AM
#10
Posted 15 June 2007 - 07:55 AM
#11
Posted 15 June 2007 - 08:39 AM
#12
Posted 15 June 2007 - 09:36 AM
Attached Files
#13
Posted 15 June 2007 - 10:04 AM
#14
Posted 15 June 2007 - 11:07 AM
#15
Posted 18 June 2007 - 03:30 AM
Thanks for your help. Much appreciated!
#16
Posted 18 June 2007 - 08:22 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users