enjoy!
Tyler
// modified code snippet from my scroll class
scrollPause = Delegate.create(this, scrollPause);
upArrow.onPress = Delegate.create(this, upArrowPress);
upArrow.onRelease = upArrow.onReleaseOutside = Delegate.create(this,
arrowRelease);
private function scrollUp():Void
{
scrollPosition -= lineScrollSize;
}
private function upArrowPress():Void
{
scrollUp();
scrollInterval = setInterval(scrollPause, 300, scrollUp);
}
// these two methods are shared between arrowUp and arrowDown
private function scrollPause(scrollMethod:Function):Void
{
clearInterval(scrollInterval);
scrollInterval = setInterval(scrollMethod, 30);
}
private function arrowRelease():Void
{
clearInterval(scrollInterval);
}
On 4/25/06, eric dolecki <[EMAIL PROTECTED]> wrote:
>
> What I am currently doing: ( works, just doesn't seem like the right thing
> to do )
>
> var nScrollIntervalMS :Number = 70;
> some_mc.onPress = function(}{
> clearInterval( foobar );
> delete foobar;
> someFunction();
> var nTime = 0;
> // Repeat if held down
> this.onEnterFrame = function(){
> nTime++;
> // Click and Hold detected
> if( nTime > 20 ){
> foobar = setInterval( stationUp, nScrollIntervalMS );
> this.onEnterFrame = null;
> }
> };
> };
> some_mc.onRelease = function(}{
> this.onEnterFrame = null;
> clearInterval( foobar );
> delete foobar;
> }
>
>
> On 4/25/06, Lee McColl-Sylvester <[EMAIL PROTECTED]> wrote:
> >
> > I have one that sets a date onPress and a date onRelease, then compares
> > the date's getTime() to see how long it was pressed. Works for me,
> > though if you want to set a time during the press, an interval is
> > required.
> >
> > Lee
> >
> >
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of eric
> > dolecki
> > Sent: 25 April 2006 13:55
> > To: Flashcoders mailing list
> > Subject: [Flashcoders] press & hold
> >
> > wondered if anyone had an elegant press & hold function before I wrote
> > one
> > using enterFrame/interval stuff.
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com