2 Replies Latest reply on Oct 7, 2009 12:57 AM by andyulrika_is_back

    Why is behaviour not displaying mouse over or cursor?

    andyulrika_is_back

      I want to add this behaviour to a  graphic (graphic 1) which, when clicked on displays another graphic (graphic 2),  it will also play a sound. When the sound stops graphic 2 disappears. This currently happens except when I mouseover graphic 1 - it should display graphic 2 through a blend=100 and also a cursor change. I can't understand why it doesn't do that.

       

      Here's what I currently have in the code:

       

      Any help much appreciated.

       

      Andy

      property
      
       pTargetSound, pBitmap
      
      
      on
      
       getPropertyDescriptionList me  
      
        list
      
       = []  
      
        addProp list
      
      , #pTargetSound,\    [
      
      #comment "Sound to Play", #format #sound, #default ""]
      
        addProp list
      
      , #pBitmap, [#comment "Member to Display",\  #format #bitmap
      
      
      , #default "bitmap?"]
      
        return
      
       list
      
      end
      
      on
      
       beginSprite me
      
        sprite
      
      (88).blend=0
      
        sprite
      
      (me.SpriteNum).color=rgb("2876CE")
      
        
      
      on
      
       mouseEnter me
      
        cursor
      
       280
      
        sprite
      
      (88).member = member(pBitmap)
      
        sprite
      
      (88).blend=100
      
        sprite
      
      (me.SpriteNum).color=rgb("000000")
      
      end
      
      on
      
       mouseLeave me
      
          cursor
      
       -1
      
      end
      
      on
      
       exitFrame me
      
        cursor
      
       -1
      
        if
      
       not sound(3).isBusy() then
      
          sprite
      
      (88).blend = 0
      
          sprite
      
      (me.SpriteNum).color=rgb("2876CE")
      
        end if
      
      
      
      on
      
       mouseUp me
      
      
        sound
      
      (3).play(member(pTargetSound))
      
        if
      
       sound(3). isBusy () then
      
          sprite
      
      (88).blend=100
      
          sprite
      
      (me.SpriteNum).color=rgb("ffffff")
      
        else if
      
       not sound(3).isBusy() then
      
          sprite
      
      (88).blend=0
      
        end if
      end if
      
      
      
      
        • 1. Re: Why is behaviour not displaying mouse over or cursor?
          Sean_Wilson Adobe Community Professional

          I can't imagine how you managed to srew up the formatting of the code you pasted, with unintentional line breaks all over the place. I also suggest you finish all your handlers with the 'end' keyword instead of relying on the next handler definition to do so implicitly.

           

          I suspect your cursor change isn't showing because you reset it every time the exitFrame handler runs:

          property pTargetSound, pBitmap
          
          on getPropertyDescriptionList me
            list = []
            addProp list, #pTargetSound, [#comment: "Sound to Play", #format: #sound, #default: ""]
            addProp list, #pBitmap, [#comment: "Member to Display", #format: #bitmap, #default: "bitmap?"]
            return list
          end
          
          on beginSprite me
            sprite(88).blend = 0
            sprite(me.spriteNum).color = rgb("2876CE")
          end
          
          on mouseEnter me
            cursor 280
            sprite(88).member = member(pBitmap)
            sprite(88).blend = 100
            sprite(me.spriteNum).color = rgb("000000")
          end
          
          on mouseLeave me
            cursor -1
          end
          
          on exitFrame me
            --  cursor -1
            if not sound(3).isBusy() then
              sprite(88).blend = 0
              sprite(me.spriteNum).color = rgb("2876CE")
            end if
          end
          
          on mouseUp me
            sound(3).play(member(pTargetSound))
            if sound(3).isBusy() then
              sprite(88).blend = 100
              sprite(me.spriteNum).color = rgb("ffffff")
            else --if not sound(3).isBusy() then
              sprite(88).blend = 0
            end if
          end
          
          • 2. Re: Why is behaviour not displaying mouse over or cursor?
            andyulrika_is_back Level 1

            Thanks Sean

             

            Yes, the code was pretty screwed up when I pasted it in...I used the Insert / Syntax Highlighting / Plain on the forum!

             

            Anyway, thanks for fixing my cursor problem. Although I still haven't managed to work out why the on mouseEnter handler is not displaying my sprite in channel 88.

             

            Is it something to do with the exitframe handler?

             

            Regards

             

            Andy