3 Replies Latest reply on May 3, 2008 11:48 AM by shariha

    Really Need Suggestions

    shariha Level 1
      Please look at my dir and let me know what you think. http://www.designneeds.net/PetIDomatic.dir

      1. I need the user to select a tag then a color then be able to put text on the tag. But I see the way I'm going with this is the wrong way and there are way to many situations that I would have to duplicate. I have heard about parent scripts I'm not sure how hard that is to write but is that what I need to do and if so can someone send me in the right direction.

      2. You can see I have buttons down at the bottom so when someone clicks on one thats how they will place info on the tag. Can someone put me in the right direction on how to do this.

      3. I really want to keep file size down. I heard there is away to call the images from an external document if you know how can you let me know

      Thank you all so much - I really need help so all suggestions will be great.
        • 1. Really Need Suggestions
          Chunick Level 3
          I had a look over your .dir file. In this case learning Director's Lingo scripting language will help immensely to fix your issues. With scripting you could reduce the number of cast members drastically and clean up the score.

          1. You need to understand that Lingo is event driven; with scripts we can cover pretty much all the possibilities a user will have when interacting with your program.
          2. Director uses sprites which are instances of a member on the stage. The member of a sprite can be swapped out easily enough.
          3. With some planning you can use one script to send a common message with the right information to change the state of a sprite on the stage.

          For example, you have 3 main sections to your program:
          1. Select Design
          2. Select Colour
          3. Add Description
          This would be a perfect use of the score and markers. I would figure out my basic layout for each section as you have done, but without any need to lay out all the possibilities - my scripting will handle all the user interaction and thus all the possibilities.

          the first frame add a frame label (or marker, it's called both in Director) and name it, say "Start" (without quotes)
          you can then add labels at, say, 40 frame intervals for each of your sections (see list above) and on the frame before each marker place your one frame script which has this code:

          on exitFrame me
          go the frame
          end

          there's no need to have a script in the cast for each frame - remember, behavior scripts are reusable. Members in the cast are assets ready to be used on the stage. You can place a single member multiple times in the frame, sound and sprite channels of the score and each time you create an instance of that member that exists only on the score.

          So, there's going to be a trick for the next sections and it's all about patterns. Let me explain; Before bringing the project into Director it looks like you planned the process nicely. Each step logically follows the other:
          1. First, pick which tag shape/design
          2. Then, select the colour for the tag
          3. Lastly, enter the text that will go on the tag

          At each section the number of possibilities increases exponentially, but scripting will help us fix that. How? By recognizing patterns. For instance, in each section we are building the tag:
          1. we start off with a tag.
          2. we pick a tag shape - the shapes are octagon, star, square, circle, bone and heart.
          3. we pick a colour - red, gray, orange, blue, black, green.
          4. lastly, on a larger image of the tag we enter the text.

          We can take advantage of member naming to help us out... sort of like batch processing... the objects are tags so we start with that, then the shape and colour, and lastly the size, like this:

          -- these member names would be for the members in the first section; selecting the shapes
          tag-octagon
          tag-circle
          -- these member names would be the member names in the next section; selecting the colours for the shapes
          tag-octagon-red
          tag-heart-blue
          -- these would be for the last section; setting the text description
          tag-bone-blue-large
          tag-star-orange-large

          so, go through and name your dog tag members like that... you can either use the "tag" at the start or not... it's up to you - but if you do change the naming convention then you need to modify the code too; keep that in mind... then you just keep a global variable in a moviescript or a few globals, each describing a part of the tag.

          global gShape
          global gColor

          when you click on a shape you can have a generic behavior script on the shape like this:

          -- behavior script for the 1st section - "Select Design"
          -- for selecting the shape just drop on each of the sprite
          -- tag shapes and select it's appropriate shape
          property pShape

          on getPropertyDescriptionList
          shapeList = ["octagon", "star", "square", "circle", "bone", "heart"]
          description = [:]
          description[#pShape] = \
          [#default: shapeList[1], \
          #format: #string, \
          #comment: "Select tag shape:", \
          #range: shapeList \
          ]
          return description
          end

          global gShape

          on mouseUp me
          gShape = pShape
          go to frame "Select Color" -- earlier, I used these names for the sections
          end

          -- behavior script for the 2nd section - "Select Color"
          -- for selecting the color just drop on each of the sprite
          -- color swatches and select it's appropriate color
          property pColor

          on getPropertyDescriptionList
          colorList = ["red", "gray", "orange", "blue", "black", "green"]
          description = [:]
          description[#pColor] = \
          [#default: colorList[1], \
          #format: #string, \
          #comment: "Select tag color:", \
          #range: colorList \
          ]
          return description
          end

          global gColor

          -- in the Property Inspector you can give the sprite a name, but
          -- only in MX2004. It's better to reference by name than number
          -- because if you move the sprite from say, channel 2 to 4 then
          -- your code breaks. Either way is acceptable in MX2004, otherwise
          -- you can only reference by number in earlier versions.
          on beginSprite me
          sprite("tag").member = "tag-" & gShape
          end

          on mouseUp me
          gColor = pColor
          -- I'm not sure here if you want to jump
          -- to the next section or want to switch
          -- the tag colors
          go to frame "Add Description"
          -- or use this script and remove/comment out the above line
          sprite("tag").member = "tag-" & gShape & "-" & gColor
          end


          -- script for the last section - "Add Description"
          -- attach as a behavior on the placeholder large shape
          global gShape
          global gColor

          on beginSprite me
          sprite(me.spriteNum).member = "tag-" & gShape & "-" & gColor & "-large"
          end

          Global variables can be accessed anywhere in your movie, so take advantage of that fact when you start learning scripting... eventually you'll see the benefit of creating parent scripts, but that's a more advanced concept.

          so, by having the two global variables, when we need to decide at each point what feature to choose we can get the previous choice and we're using that string value to build our member name that corresponds to the appropriate member.

          The last section of typing the description is a bit tricky for two reasons:
          1) You need to adjust the text area for the shape - you may want to set markers for each shape and jump approprately as it would be the easiest solution - this will require modifying the part of the last script I wrote as an example, but I'll leave it up to you...
          2) You need to set your keyboard to type the appropriate text in the text area... Again, I would use a generic script, make each button a separate graphic and name the button it's appropriate letter, eg. the 'A' button member would be named "A" (without quotes), 'B' button member would be named "B", and so on... then I would use a generic script, something like this to attach to the buttons:

          on keyUp me
          -- assuming the text member where the description is typed
          -- is named "description"
          letter = sprite(me.spriteNum).member.name
          member("description").setContentsAfter(letter)
          end

          Note: that you may want to make a button and script for backspacing just in case someone makes a mistake:
          on keyUp me
          lastCharacter = member("description").char.count
          member("description").char[lastCharacter].delete()
          end

          the above code for the description assumes you are specifically using a Director text member and NOT a field member or the Flash Text components.

          I will leave the code for cycling through your 0-9 numbers button up to you.

          Good luck on the project, it's visually looking very good.
          • 2. Re: Really Need Suggestions
            shariha Level 1
            http://www.designneeds.net/PetIDomatic2.dir

            Welll here is the new file. I placed the code where you adviced. Thank you very much by the way. But I must be missing something. Can you look it over and let me know what I am missing.

            I really need help so I hope to hear from you
            • 3. Re: Really Need Suggestions
              shariha Level 1
              Guess what I got it. I understand a lot more now. I was putting the script on every sprite that was wrong I got it now but I still am having problems with a few things.

              Getting closer hoping someone will show pitty on me and help

              http://www.designneeds.net/PetIDomatic2.dir