3 Replies Latest reply on Jan 17, 2007 8:14 AM by Ex Malterra

    get the model number

    otterman Level 1
      How do you get hold of the model number ive clicked on- heres the code ive worked on so far- just got the last part to figure out. Got a feeling this one is obvious and staring me in the face.
        • 1. Re: get the model number
          Ex Malterra Level 1
          the model's index number isn't a property of the model itself. the w3d member has an array of models that can be accessed either by name or index. using name is better because adding or deleting models will change the index number of all models. just because the model you click on is index number 4 at the time doesn't mean it will always be. but, if you really need the number you could loop through the models and see which index number is the one with the name of the clicked model. i use javaScript now so my lingo's rusty, but it would be something like:

          ------ calculate the click location
          upperLeft = point(sprite(1).left, sprite(1).top)
          clickLocation = the mouseLoc - upperLeft

          ------ get the model there
          if sprite(1).camera.modelUnderLoc(clickLocation) = false then
          nothing
          else
          model = sprite(1).camera.modelUnderLoc(clickLocation)

          repeat with n = 1 to sprite(1).member.model.count
          if sprite(1).member.model[n].name = model.name then
          ------ send to message window (THE MODEL NUMBER)
          put n
          end if
          end repeat

          • 2. Re: get the model number
            otterman Level 1
            Hey, thats bang on! works a treat!

            Your lingos alot more adapt than mine. I too abandoned Director for a while fearing its gonna go the way of the dodoo!
            Thanks for you solution to my very niggling problem.

            Ta
            • 3. Re: get the model number
              Ex Malterra Level 1
              glad that helped.

              i meant that i use javascript syntax instead of lingo in director by the way, not javascript instead of director.