home *** CD-ROM | disk | FTP | other *** search
/ GU Photo: Background 3 / GU.iso / pc / browser_4m_ / browser_4m_.dxr / 00165_dragableObject.ls < prev    next >
Encoding:
Text File  |  1994-09-30  |  1.6 KB  |  72 lines

  1. property psaved, pSprite, pBaseCast
  2. global mostForeSp
  3.  
  4. on birth me, sp, bcast
  5.   set mostForeSp to 48
  6.   set the psaved of me to the puppet of sprite sp
  7.   set the pSprite of me to sp
  8.   set the pBaseCast of me to the number of cast bcast
  9.   puppetSprite(the pSprite of me, 1)
  10.   return me
  11. end
  12.  
  13. on destroy me
  14. end
  15.  
  16. on represent me
  17.   set the visible of sprite the pSprite of me to 1
  18. end
  19.  
  20. on hide me
  21.   set the visible of sprite the pSprite of me to 0
  22. end
  23.  
  24. on drag me
  25.   startdrag(me)
  26. end
  27.  
  28. on stepFrame me
  29.   traceDrag(me)
  30. end
  31.  
  32. on startdrag me
  33.   when mouseUp then  mouseUpEater
  34.   hide(me)
  35.   set the visible of sprite mostForeSp to 1
  36.   puppetSprite(mostForeSp, 1)
  37.   set the type of sprite mostForeSp to 1
  38.   set the visible of sprite mostForeSp to 1
  39.   set the locH of sprite mostForeSp to the mouseH
  40.   set the locV of sprite mostForeSp to the mouseV
  41.   set the castNum of sprite mostForeSp to the pBaseCast of me
  42.   set the visible of sprite mostForeSp to 1
  43.   appenddragedobject(me)
  44. end
  45.  
  46. on traceDrag me
  47.   if the stillDown then
  48.     set the locH of sprite mostForeSp to the mouseH
  49.     set the locV of sprite mostForeSp to the mouseV
  50.   else
  51.     erasedragedobject(me)
  52.   end if
  53. end
  54.  
  55. on enddrag me
  56.   global gfilelister, gdragitem, gdragfileicon
  57.   set the type of sprite mostForeSp to 0
  58.   set the locH of sprite mostForeSp to -10000
  59.   set the locV of sprite mostForeSp to -10000
  60.   set the visible of sprite mostForeSp to 1
  61.   puppetSprite(mostForeSp, 0)
  62.   if objectp(gfilelister) then
  63.     if objectp(gdragitem) then
  64.       iswithin(gfilelister, gdragitem)
  65.     end if
  66.     if objectp(gdragfileicon) then
  67.       iswithout(gfilelister, gdragfileicon)
  68.     end if
  69.   end if
  70.   represent(me)
  71. end
  72.