The system.print is a good check for an endless loop like I had . I'll definitely use that more often to check things. I eliminated the scheduleAfter and came up with this script for the button. It still lacks the pep of the other script. Nothing will flick across the screen. You pretty much have to drag it.
// Place in button DRAG BACK size 240 x 960 centered on screen
var drag_back = widget ( "DRAG_BACK" ) ; //button with solid or Semi-transparent background var but_b = widget ( "BUT_B" ) ; // Buttons or Panels that move with drag_back var but_c = widget ( "BUT_C" ) ; // probably be about 20 in all. var but_d = widget ( "BUT_D" ) ; var but_e = widget ( "BUT_E" ) ; var but_f = widget ( "BUT_F" ) ; var but_g = widget ( "BUT_G" ) ;
var old_Y ; // initial position of top of Drag button var change_in_Y = 0 ; // change in position var happy = 1 ; // Couldn't think of a description // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function butAll ( ) { // the applied change drag_back.top = drag_back.top - change_in_Y ; // the one pressed but_b.top = but_b.top - change_in_Y; // Buttons that move with drag_back but_c.top = but_c.top - change_in_Y; // probably be about 20 buttons in all. but_d.top = but_d.top - change_in_Y; but_e.top = but_e.top - change_in_Y; but_f.top = but_f.top - change_in_Y; but_g.top = but_g.top - change_in_Y; } ; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function moveUp ( ) { butAll ( ) ; if ( drag_back.top >= 0) { // stop movement at top drag_back.top = 0; happy = 2 ; } ; } ; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function moveDown ( ) { butAll ( ) ; if (drag_back.top <= -640) { // stop movement at bottom drag_back.top = -640 ; happy = 3 ; } ; } ; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - drag_back.onPress = function ( x,y ) { //when you press the button old_Y = y ; } ; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - drag_back.onMove = function ( x,y ) { //when you move the button change_in_Y = old_Y - y ; if ( (change_in_Y < 0 ) && ( happy !== 2 ) ) { // moves in up direction moveUp ( ) ; }; if ( ( change_in_Y > 0 ) && ( happy !== 3 ) ) { // moves in down direction moveDown ( ) ; }; } ; // x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x END
I have found one Major drawback to Gestures in general. I am constantly cleaning my screen. :(
Project Boredom 2 is here. [Link: mediafire.com] ------------------------ Check Version 1 & 2 out in the files section.