1 Reply Latest reply on Apr 11, 2007 1:05 AM by wgb14

    Images in a list problem

    wgb14 Level 1
      Hi all,

      I wonder if you can help me with this:

      I have the following handler that is called once my user click on a particular button the application that i am building:

      global myobjectsA, myobjectsB
      on magnify

      --Location A, two objects to magnify: a) Wooden Wings of the gate b) Other entrance

      CASE TRUE OF
      (the text of member "current_script"= "LocA_q32_A.hap"):
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\woodenwings_full.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [LocA_q32_A.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]" --deactivates the current script
      sprite(2).Hypertext = "\translate [x= 92.400055 y= 1.958012 z= -72.092171]"
      tell controls to go to marker ("magnify_nav")
      dialogue.close() -- close dialogue window...
      myobjectsA=["otherentrance_full.jpg"]
      end case

      --Location B, two objects to magnify: a) Bust of the poet b) small road c)marble plaque

      (the text of member "current_script"= "LocB_q20_A.hap"):
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\poetbust_full.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [LocB_q20_A.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]" --deactivates the current script
      sprite(2).Hypertext = "\translate [x= 92.400055 y= 1.958012 z= -72.092171]"
      tell controls to go to marker ("magnify_nav")
      dialogue.close() -- close dialogue window...
      myobjectsB=["small_road.jpg","marble_plaque.jpg"]
      end case


      Once either of the above case statements is true then my 3D character engine (in sprite 2) is loading the particular background image and do some other stuff as well! For each case statement i am also creating a list with the other photogrpaphs that i would like to magnify once the particular case statement is true. To allow myuser to browse these photogrpahs i have the following:

      global myobjectsA, myobjectsB
      on mousedown

      CASE TRUE OF
      (the text of member "current_script"= "LocA_q32_A.hap"): -- if the particular condition is true then
      myClickCount = min(myClickCount + 1, count(myobjectsA))
      if myClickCount <> 0 then
      currentphoto=photoitems[myClickCount] -- current photo to display on next
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\"&currentphoto&"]]"
      end if
      end case

      case true of

      (the text of member "current_script"= "LocB_q20_A.hap"):
      myClickCount = min(myClickCount + 1, count(myobjectsB))
      if myClickCount <> 0 then
      currentphoto=photoitems[myClickCount] -- current photo to display on next
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\"&currentphoto&"]]"
      end if
      end case
      end

      Don't forget to say that I set myClickCount = 0 on startmovie. Now although the above approach seems to work, what i am interested to know, is if there is any way to do what i am doing with multiple lists with just one list that will include ALL images and will load once the magnify handler is called. Something like:

      on magnify

      myphotolist=["woodenwings_full.jpg","otherentrance_full.jpg","poetbust_full.jpg","small_ro ad.jpg","marble_plaque.jpg"]

      ...here the problem is that for each case statement i want to load specific list items. And this is what i simply don't know how to do. Also, if you have any other suggestions on how to write a cleaner version of the above codes, please let me know. Any help will be appriciated!

      Many thanks
        • 1. Images in a list problem
          wgb14 Level 1
          Hi

          Here is what I have finally done to solve my problem. If you have any suggestions on how to improve this please let me know!!!

          on magnify

          myobjectsA = ["woodenwings_full.jpg","otherentrance_full.jpg"]
          myobjectsB = ["bust_full.jpg","path_full.jpg","plaque_full.jpg"]
          myobjectsC = ["esp_full.jpg","lockeddoor_full.jpg"]

          CASE TRUE OF
          (the text of member "current_script"= "LocA_q32_A.hap"):
          sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\"&myobjectsA[1]&"]]" --load first item
          sprite(2).Hypertext = "\soundpause [file= [LocA_q32_A.ogg]]"
          sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]" --deactivates the current script
          sprite(2).Hypertext = "\translate [x= 92.400055 y= 1.958012 z= -72.092171]"
          tell controls to go to marker ("magnify_nav")
          dialogue.close() -- close dialogue window...
          end case
          end

          and so on.............

          And on the next button

          global myobjectsA,myobjectsB,myobjectsC,myclick,photoitems,controls

          on mousedown

          CASE TRUE OF
          (the text of member "current_script"= "LocA_q32_A.hap"):
          myClick = min(myClick + 1, count(myobjectsA))
          if myClick <> 0 then
          currentphoto=photoitems[myClick] -- current photo to display on next
          sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\"&currentphoto&"]]"
          end if
          end case

          and so on................