12 Replies Latest reply on Aug 2, 2007 12:40 PM by wgb14

    A list problem:(pick items backwards&randomly)

    wgb14 Level 1
      Hi all,

      I have a list problem that i need your help. Here is my code:

      accesorie list is loaded with the following items: [1,2,3,4]
      on whichaccessoryload

      tPos = accessoriesList.getPos(linetext)
      n = accessoriesList.count()

      if tPos = 1 then
      window("Haptek_player").movie.sprite(1).Hypertext = "\load [file= ["&accessoriesPath&""&accessoriesList[1]&"]]"
      -- load the first item in the list (i.e., number 1)
      else
      if tPos <= n then
      whattodelete = accessoriesList[tPos - 1]
      window("Haptek_player").movie.sprite(1).Hypertext ="\delperson[figure= "&whattodelete&"]"
      -- delete the previous loaded item (i.e., number 1)
      window("Haptek_player").movie.sprite(1).Hypertext = "\load [file= ["&accessoriesPath&""&linetext&"]]"
      -- load a new item from the list (i.e.., number 2)

      Every time that this handler is called it: given a list with 4 numbers [1,2,3,4], checks whether the position of the linetext value is 1st in the list, and if true loads this value (number1) in the 3D engine.... else it deletes the previous value (in our example number 1) and loads a new value in its place (number 2)... then deletes number 2 and loads the next item (number 3) and so on.... The above code works 100% if my user selects the items from the list sequencially (1,2,3,4).

      Now.. what I would like to add, is the ability to select the items backwards (4,3,2,1) but also randomly (e.g., from 4, if you select item 2 delete 4 and load 2 in the engine, or from 3 if you select 1 delete 3 and load 1 in the engine..). I hope that it is clear what I am asking... Any help will be greatly appreciated..