3 Replies Latest reply on Mar 18, 2007 2:54 PM by rihaha

    help with functions, lists, calculations

    rihaha Level 1
      I have been trying for over a week now to write a lingo script for a project I am working on. It is a jewelry site that allows the user to create their own pieces. I want the user to be able to click on a bead and drag it to the chain. I've given the beads the move, rotate and scale behavior for this. Now I am trying to assign a value to each bead (a cost) and have it appear in a text window on the stage. I would then like the text window to display a total when the user clicks on another bead.
      Also, I would like another instance of the moved bead to appear where the first one was so the user can use a bead more than once.
      Here are several things I've tried:

      property pCost
      property pTotal


      on new me, beadCost, totalCost
      pCost = beadCost
      pTotal = totalCost
      return me

      myBeads = ["bead_1" : 6.00, "beads2" : 4.00, "beads3" : 5.00, "beads4" : 5.00, "beads6" : 5.00, "beads7" : 6.00, "beads8": 4.00, "beads9": 5.00, "beads10": 6.00, "beads11": 6.00]
      end


      Next I was trying to follow a tutorial so I started with this. I am unsure of how to implement my list in this so I tried creating 2 bead instances this way. I am wondering if this doesn't work because the member is set to text? I don't know how to output the info into the text field (named "result")
      property pCost
      property pTotal


      on new me, beadCost, totalCost
      pCost = beadCost
      pTotal = totalCost
      return me
      end

      on putInfo me
      member("bead_1").text = pCost
      member("result").text = pTotal


      bead1Obj= new(script "bead_1", "3.00")
      trace bead1Obj
      bead1Obj.PutInfo()

      bead2Obj= new(script "bead_2", "4.00")
      trace bead1Obj
      bead1Obj.PutInfo("result")
      end