¿Cómo puedo bloquear una imagen y que el usuario no pueda sacarla del stage con Macromedia Director?

Hola compañero:
Estoy trabajando en un proyecto multimedia y ahora tengo un pequeño problema, y es que necesito mover una imagen al entrar el ratón sobre ella y que al llegar al final se pare, de manera que el usuario no la pueda sacar del stage
A ver si me pudieras ayudar

1 Respuesta

Respuesta
1
Copia esto en la ventana script y solucionar tu problema (¿sabes qué es un comportamiento, no?)
property p_mover, p_desfase, p_parar, p_rect
on getBehaviorTooltip me
return \
"este comportamiento sirve para desplazar imágenes \
Dentro de un rectángulo, debes colocarlo sobre el miembro \
Que deseas desplazar"
end getBehaviorTooltip
on getPropertyDescriptionList me
return \
[ \
#p_rect: \
[ \
#comment: "indica las cordenadas del rectangulo que delimitará el movimiento", \
#format: #rect, \
#default: rect(0,0,100,100)\
] \
]
end getPropertyDescriptionList
on beginSprite me
p_mover = FALSE
miem = sprite(me.spriteNum).member
p_parar = rect(0,0,0,0)
p_parar.left = p_rect.right - miem.width + miem.regPoint.locH
p_parar.right = p_rect.left + miem.regPoint.locH
p_parar.top = p_rect.bottom - miem.height +miem.regPoint.locV
p_parar.bottom = p_rect.top + miem.regPoint.locV
end
on mouseDown me
p_mover = TRUE
p_desfase = the clickLoc - sprite(me.spriteNum).loc
end
on mouseWithin me
if the rollover = me.spriteNum then
if p_mover = TRUE then
cambiarcursor(me,290)
else
cambiarcursor(me,260)
end if
else
cambiarcursor(me,0)
end if
end
on mouseLeave me
cambiarcursor(me,0)
end
on cambiarcursor me, numero
cursor(numero)
end if
end
on mouseUp me
p_mover = FALSE
end
on mouseUpOutside me
p_mover = FALSE
end
on exitFrame me
if p_mover then
nueva_localizacion= the mouseLoc - p_desfase
if nueva_localizacion.locH < p_parar.left then nueva_localizacion.locH = p_parar.left
if nueva_localizacion.locH > p_parar.right then nueva_localizacion.locH = p_parar.right
if nueva_localizacion.locV < p_parar.top then nueva_localizacion.locV = p_parar.top
if nueva_localizacion.locV > p_parar.bottom then nueva_localizacion.locV = p_parar.bottom
sprite(me.spriteNum).loc = nueva_localizacion
end if
end

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas