home *** CD-ROM | disk | FTP | other *** search
/ Encyklopedia Omnia / Planeta.iso / data / a_gen.dir / 00034_scrollingArray.ls < prev    next >
Encoding:
Text File  |  2000-11-14  |  2.4 KB  |  78 lines

  1. property numOfSlots, firstSlotNS, castName, scrollDir, voidCrop, numOfCrops
  2. global gCurrentStartCrop, gCropList, gCanClick
  3.  
  4. on beginSprite
  5.   set numOfCrops to the number of castMembers of castLib castName
  6.   if scrollDir = #left then
  7.     set gCropList to []
  8.     repeat with i = 1 to numOfCrops
  9.       add(gCropList, the name of member i of castLib castName)
  10.     end repeat
  11.     set gCurrentStartCrop to 1
  12.     aggiornaFreccie()
  13.   end if
  14. end
  15.  
  16. on mouseUp
  17.   if gCanClick then
  18.     if scrollDir = #right then
  19.       set gCurrentStartCrop to gCurrentStartCrop + 1
  20.     else
  21.       set gCurrentStartCrop to gCurrentStartCrop - 1
  22.     end if
  23.     updateCrops()
  24.     aggiornaFreccie()
  25.     updateStage()
  26.   end if
  27. end
  28.  
  29. on updateCrops
  30.   repeat with i = 1 to numOfSlots
  31.     set nm to getAt(gCropList, i + gCurrentStartCrop - 1)
  32.     if nm <> EMPTY then
  33.       set the member of sprite (firstSlotNS + i - 1) to member nm of castLib castName
  34.       set the moveableSprite of sprite (firstSlotNS + i - 1) to 1
  35.       next repeat
  36.     end if
  37.     set the member of sprite (firstSlotNS + i - 1) to member voidCrop
  38.     set the moveableSprite of sprite (firstSlotNS + i - 1) to 0
  39.   end repeat
  40. end
  41.  
  42. on aggiornaFreccie
  43.   set Ns to the currentSpriteNum
  44.   if scrollDir = #right then
  45.     if gCurrentStartCrop < (numOfCrops - numOfSlots + 1) then
  46.       set the visible of sprite Ns to 1
  47.     else
  48.       set the visible of sprite Ns to 0
  49.     end if
  50.     if gCurrentStartCrop > 1 then
  51.       set the visible of sprite (Ns - 1) to 1
  52.     else
  53.       set the visible of sprite (Ns - 1) to 0
  54.     end if
  55.   else
  56.     if gCurrentStartCrop > 1 then
  57.       set the visible of sprite Ns to 1
  58.     else
  59.       set the visible of sprite Ns to 0
  60.     end if
  61.     if gCurrentStartCrop < (numOfCrops - numOfSlots + 1) then
  62.       set the visible of sprite (Ns + 1) to 1
  63.     else
  64.       set the visible of sprite (Ns + 1) to 0
  65.     end if
  66.   end if
  67. end
  68.  
  69. on getPropertyDescriptionList
  70.   set d to [:]
  71.   addProp(d, #numOfSlots, [#default: 5, #format: #integer, #comment: "Numero di slots:"])
  72.   addProp(d, #firstSlotNS, [#default: 0, #format: #integer, #comment: "Numero canale primo slot:"])
  73.   addProp(d, #castName, [#default: EMPTY, #format: #string, #comment: "Nome del castLib:"])
  74.   addProp(d, #scrollDir, [#default: #left, #format: #symbol, #range: [#right, #left], #comment: "Direzione di scroll:"])
  75.   addProp(d, #voidCrop, [#default: "voidCrop", #format: #string, #comment: "Nome del crop fittizio:"])
  76.   return d
  77. end
  78.