Hi All,
Relatively new to Flash, looking to understand some details about button
events.
Here is the relevant code:
I have a horizontally scrolling MC (thumbnail_mc) containing all my thumbnails
for a gallery. I've also got 2 buttons to move the clip, right_btn and left_btn.
To stop the thumbnail clip from moving beyond the limits of the scroller, I've
added two boundary MC's, hit_right and hit_left, to use for hitTest.
Presently this code works fine, except that I have to click the button to move
each distance of ten pixels, rather than being able to hold down the button and
continue scrolling...is there a way to perform this? Is there a method that
returns a buttons state, so that I can determine if the button is still down,
rather than using onPress?
Any help is appreciated, let me know if I've been unclear!
Thanks
function thumbNailScroller() {
scroll_speed = 10;
right_btn.onPress = function() {
if (thumbnail_mc.hitTest(hit_right)){
thumbnail_mc._x -= scroll_speed;
}
}
left_btn.onPress = function(){
if (thumbnail_mc.hitTest(hit_left)){
thumbnail_mc._x += scroll_speed;
}
}
}
Devendran - 07 Oct 2008 06:51 GMT
Are you using a Mask To hide the unwanted List item?
if you are using that, Just compare the position of the Thumbcontent X
Position with the mask.
Like The _x should not be greater than the Starting X of the Mask
and the (ContentX + ContentWidth) Should not Less than the (Mask StartX + Mask
Width) Value.
So just compare this for the restriction
lkin3 - 07 Oct 2008 15:33 GMT
Yeah, I realized I could do that, but I don't think it will help my scrolling problem will it?
I want to be able to hold down my scroll buttons and have the content continuously move.
DMennenoh **AdobeCommunityExpert** - 08 Oct 2008 17:17 GMT
In your onPress set a flag variable to true, and onRelease set it to false.
In an onEnterFrame check the flag - if it's true scroll, if it's not stop.

Signature
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/