5 Replies Latest reply on Aug 30, 2007 5:25 AM by andyulrika_is_back

    Changing Sprite Color by Navigation

    andyulrika_is_back Level 1
      Can someone please enlighten me on the following:

      I have a glossary in my movie - A-Z. Each letter is a text member. What I am trying to achieve is this - If I click on A, I want the cursor to jump to my A marker and change the sprite color while currently looping on that marker, then to return to it's normal state when another letter is selected.

      Here's what I have so far: With the missing code of color changing.

      property pTargetMarker
      on getPropertyDescriptionList me
      return [#pTargetMarker: [#comment: "Target Marker:",\
      #format: #string, #default: "MarkerName?"]]
      end

      on beginSprite me

      sprite(me.spriteNum).cursor=0
      sprite(me.spriteNum).color=rgb (0,0,49)
      end

      on mouseEnter me
      sprite(me.spriteNum).color=rgb (214,89,24)
      sprite(me.spriteNum).cursor=280
      end

      on mouseLeave me
      sprite(me.spriteNum).color=rgb(0,0,49)
      sprite(me.spriteNum).cursor=0
      end

      on mouseDown me
      sprite(me.spriteNum).cursor=290
      end

      on mouseUp me
      go to frame pTargetMarker
      sprite(me.spriteNum).cursor=280
      end

      Any help much appreciated.

      Thanks

      Andy
        • 1. Re: Changing Sprite Color by Navigation
          Level 7
          Try this:


          ---
          property pTargetMarker
          property pLastClicked
          on getPropertyDescriptionList me
          return [#pTargetMarker: [#comment: "Target Marker:",\
          #format: #string, #default: "MarkerName?"]]
          end

          on beginSprite me
          pLastClicked=0
          sprite(me.spriteNum).cursor=0
          sprite(me.spriteNum).color=rgb (0,0,49)
          end

          on mouseEnter me
          if not pLastClicked then
          sprite(me.spriteNum).color=rgb (214,89,24)
          sprite(me.spriteNum).cursor=280
          end if
          end

          on mouseLeave me
          if not pLastClicked then
          sprite(me.spriteNum).color=rgb(0,0,49)
          sprite(me.spriteNum).cursor=0
          end if
          end

          on mouseDown me
          sprite(me.spriteNum).cursor=290
          end

          on mouseUp me
          go to frame pTargetMarker
          sprite(me.spriteNum).cursor=280
          sendAllSprites(#resetColor)
          pLastClicked=1
          sprite(me.spriteNum).color=rgb (255,0,0)
          end

          on resetColor me
          sprite(me.spriteNum).color=rgb (0,0,49)
          pLastClicked=0
          end

          • 2. Re: Changing Sprite Color by Navigation
            andyulrika_is_back Level 1
            Hi Mike

            Thanks for the behaviour! I couldn't get it to work though, dropped it onto my text sprite and it just displayed red with no hyperlink target facility or mouseover display.

            Any suggestions!

            Regards

            Andy

            • 3. Re: Changing Sprite Color by Navigation
              Level 7
              Hmm. It works for me. Do you have any other scripts on the text
              sprite? And did you set the GPDL to a valid frame label?
              • 4. Re: Changing Sprite Color by Navigation
                andyulrika_is_back Level 1
                Hi Mike

                Yes, it works now. I moved the market to another frame because the following code is now affecting the behaviour and sits on the same frame on another sprite:

                property pMakeInvisible1, pMakeInvisible2, pTargetMarker

                on getPropertyDescriptionList me
                list=[:]


                addProp list, #pMakeInvisible1,\
                [#comment: "Select Cast Member:", \
                #format: #integer, #default: VOID]

                addProp list, #pMakeInvisible2,\
                [#comment: "Select Cast Member:", \
                #format: #integer, #default: VOID]

                addProp list, #pTargetMarker, [#comment: "Target Marker:",\
                #format: #string, #default: "MarkerName?"]

                return list
                end

                on beginSprite me
                sprite(me.spriteNum).color=rgb (255,255,255)
                sprite(pMakeInvisible1).visible=false
                sprite(pMakeInvisible2).visible=false

                sprite(me.spriteNum).cursor=0
                end

                on mouseEnter me
                sprite(me.spriteNum).color=rgb (214,89,24)
                sprite(pMakeInvisible1).visible=true
                sprite(pMakeInvisible2).visible=true


                sprite(me.spriteNum).cursor=302
                end

                on mouseLeave me
                sprite(me.spriteNum).color=rgb (255,255,255)
                sprite(pMakeInvisible1).visible=false
                sprite(pMakeInvisible2).visible=false

                sprite(me.spriteNum).cursor=0
                end

                on endSprite me
                sprite(pMakeInvisible1).visible=true
                sprite(pMakeInvisible2).visible=true
                end

                on mouseUp me
                go to frame pTargetMarker
                sprite(me.spriteNum).cursor=280
                end



                I use this code to have a word in my glossary which makes a text sprite invisible when frame entered and make it appear when I mouse over the word, or sprite I attach it to. Although, I can't see how it would affect your behaviour.

                Regards

                Andy

                • 5. Re: Changing Sprite Color by Navigation
                  andyulrika_is_back Level 1
                  Hi Mike

                  Just to let you know that everthing is working fine now. I hadn't added your behaviour to any of the other text sprites so wasn't able to see the finished result.

                  Many thanks for your help.

                  Regards

                  Andy