2 Replies Latest reply on Dec 26, 2006 4:25 AM by chris23z436

    creating buttons with lingo

    chris23z436
      hi there,

      please help me, i´m about to loose my last nerves! :(

      i want to create several buttons in my director-movie. how hard can it be?!


      - first i thought, it would be a good idea, to create a separate shape- and text-member for my buttons. i intended to group them, because i wanted to move them together later. but grouping, or putting multiple members into one sprite was not possible. i didn´t know how to write a script to put the sprites into individual, empty score-channels, so i gave up somewhen. - that was my script back then:



      repeat with vFolderName in gFolderList
      -- create button-shapes
      vButtonShapeMember = new(#shape)
      vButtonShapeMember.shapeType = #rect
      vButtonShapeMember.name = vFolderName & "_buttonShapeMember"
      vButtonTextMember = new(#text) -- create new field
      vButtonTextMember.name = vFolderName & "_buttonTextMember" -- give field same name as the folder has
      vString = ""
      put RETURN & vFolderName after vString
      delete char 1 of vString -- initial RETURN
      vButtonTextMember.text = vString -- put name of the field/folder into field
      vSprite = new(#sprite) -- create new sprite (necessary for displaying on stage)
      sprite(vSprite).member = member(vButtonTextMember) -- fill sprites with text-members
      actPos = gFolderList.getPos(vFolderName) -- temp. shortening of that listPos-thing
      -- !!!! here was my problem - to give them an individual channel in the score:
      channel(actPos).makeScriptedSprite(member(vFolderName & "_buttonTextMember"), gFolderPosList.getAt(actPos)) --
      put sprites in channels, reserve channels for use with lingo and position sprites with point(x,y) values from the list
      end repeat



      then i thought: ok, why not use the predefined button-members of director. they have graphic- (.icon) and text- (.label) properties, so i have my grouped button, as i wanted it for later moving. but the .label-property is not functioning. lingo keeps telling me "property not found". - that was my script:





      repeat with vFolderName in gFolderList
      -- create buttons
      vButtonMember = new(#button)
      vButtonMember.name = vFolderName & "_buttonMember"
      --vButtonMember.buttonType = #pushButton
      vString = ""
      put RETURN & vFolderName after vString
      delete char 1 of vString -- initial RETURN
      -- !!! here was my problem - to set the label-property
      vButtonMember.label = vString -- put name of the folder into button-text-field
      vButtonSprite = new(#sprite) -- create new sprite (necessary for displaying object on stage)
      sprite(vButtonSprite).member = member(vButtonMember) -- fill sprites with button-member
      actPos = gFolderList.getPos(vFolderName) -- temp. shortening of that listPos-thing
      channel(actPos).makeScriptedSprite(member(vFolderName & "_buttonMember"), gFolderPosList.getAt(actPos)) -- put
      sprites in channels, reserve channels for use with lingo and position sprites with point(x,y) values from the list
      end repeat
      end repeat




      i´m tired of that bull****. the help-files of director are very basic, no help at all! i´ve spent hours on finding a solution... :(
      please tell me, whether it is best to use the button-members of director, or to use separate graphic- and text-members. and please show me the suitable solution to your offer. please consider that i want the keep the possibility to use flash-movies, or bitmaps as button-states, instead of just plain surfaces. maybe i want to change that later... thank you very much in advance!


      greetings


      chris


      ps: i almost forgot over my stress here: happy christmas, folks! ;)
        • 1. Re: creating buttons with lingo
          neekss
          calm down dude.
          The kind of buttons you require here depends on the kind of editability you want.
          if you want to be able to change the button captions dynamically then you have to keep them separate or use the button members.
          second criteria is the button position. If all the buttons are going to be on a fixed position then you can group the buttons in photoshop and bring it as a single sprite and then you can place different text sprites on top of it.

          you can change the button captions of the default button members at runtime, so if btn look is not a big deal then i suggest you use those. lightweight , easy to handle, and script accessible.

          or if they are all fixed btns like normally we dont have, then create them in photoshop along with the labels and then bring it in Director.
          • 2. creating buttons with lingo
            chris23z436 Level 1
            thank you for your answer! i´m sure it´s no big deal, i´m more calm today.... ;) you gave me a general answer, but what about my two concret problems (put sprites in channels and .label - plz look above)? - can you help me with them as well? that would be great...