Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Set the location of Sprite
Hangman
Set BroadCast Property of a Flash Sprite
Director 8 and Lingo: Inside Macromedia Series
Inspect
Palindrome Check
Hold for X seconds if no input is given
Macromedia Flash 5 Authorized
CatFlip
Set Color properties of a vector cast member
MediaMacros Xtras Mall
 

 

 

Behavior Drag Sprite with Hotspot

Added on 9/23/2004

 

Compatibilities:
D9

This item has not yet been rated

Author: jayhilwig (website)

This adds the ability to drag a sprite with a FIXED hotspot defined. It is primairily intended for dragging windows from the top (folder windows, Explorer Windows etc...). It can be changed by altering "mouseH, mouseV" and sprite.top, sprite.right etc... You cannot define an irregular (non rectangular) hotspot with this behavior. Dont' know if this works in any version other than the MX(s).

property spriteNum, pMySpriteRef, topSpot

on getBehaviorDescription me
  return
    "how much from top?" & RETURN & RETURN &
    "PERMITTED MEMBER TYPES:" & RETURN &
    "Graphic" & RETURN & RETURN &
    "PARAMETERS:" & RETURN &
    "* pixels from top?"
end getBehaviorDescription

on getBehaviorTooltip me
  return
    "Drag a sprite with a hotspot defined. "
end getBehaviorTooltip

on isOKToAttach (me, aSpriteType, aSpriteNum)
  
  tIsOk = 0  
  if aSpriteType = #graphic then  
    tIsOK = 1
  end if
  
  return(tIsOK)  
end on

on getPropertyDescriptionList me
  return
[
#topSpot:
[
  #comment: "How many pixels from top of sprite?",
  #format:  #integer,
  #default:  33
]
]
end getPropertyDescriptionList

on beginSprite me
  pMySpriteRef = sprite(me.spriteNum)
  sprite(pMySpriteRef).moveableSprite = FALSE
end

on mouseDown me

  if ((the mouseH > pMySpriteRef.left) and (the mouseH < pMySpriteRef.right)) and ((the mouseV > pMySpriteRef.top) and (the mouseV < pMySpriteRef.top+topSpot)) then
    sprite(pMySpriteRef).moveableSprite = TRUE
  else
    sprite(pMySpriteRef).moveableSprite = FALSE
  end if
  
end

on getBehaviorTooltip me
  return
    "Drag a sprite with a hotspot defined. "
end getBehaviorTooltip


on isOKToAttach (me, aSpriteType, aSpriteNum)
  
  tIsOk = 0  
  if aSpriteType = #graphic then  
    tIsOK = 1
  end if
  
  return(tIsOK)  
end on


on getPropertyDescriptionList me
  return
[
#topSpot:
[
  #comment: "How many pixels from top of sprite?",
  #format:  #integer,
  #default:  33
]
]
end getPropertyDescriptionList


on beginSprite me
  pMySpriteRef = sprite(me.spriteNum)
  sprite(pMySpriteRef).moveableSprite = FALSE
end

on mouseDown me
  
  if ((the mouseH > pMySpriteRef.left) and (the mouseH < pMySpriteRef.right)) and ((the mouseV > pMySpriteRef.top) and (the mouseV < pMySpriteRef.top+topSpot)) then
    sprite(pMySpriteRef).moveableSprite = TRUE
  else
    sprite(pMySpriteRef).moveableSprite = FALSE
  end if
  
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail