Ver Mensaje Individual
  #7 (permalink)  
Antiguo 26/10/2007, 06:56
dualklip
 
Fecha de Ingreso: octubre-2007
Ubicación: Madrid, España
Mensajes: 221
Antigüedad: 16 años, 5 meses
Puntos: 5
Re: arrastrar movie clip con botones

Aquí lo tienes, pero lo he tenido que hacer muy rápido así que si miras un poco el código seguro que puedes depurarlo:

Código:
var oyenteDeRaton:Object = new Object();
oyenteDeRaton.onMouseDown = function() {
    ratonPulsado = true;
    margenX = mc._x - _xmouse;
    margenY = mc._y - _ymouse;
    desliz = 10;
    mc.onEnterFrame = function(){
        trace(movX + " - " + movY);
        if(ratonPulsado == true){
            movX = Math.round((this._x - _xmouse - margenX)/desliz);
            movY = Math.round((this._y - _ymouse - margenY)/desliz);
        } else {
            movX = Math.round((this._x - posRatonX - margenX)/desliz);
            movY = Math.round((this._y - posRatonY - margenY)/desliz);
        }
        if(this._x == Math.round(_xmouse - margenX) && this._y == Math.round(_ymouse - margenY)){
            this.onEnterFrame = Void;
        } else {
            this._x -= movX;
            this._y -= movY;
        }
    }
}
oyenteDeRaton.onMouseMove = function(){
    if(ratonPulsado == true){
        posRatonX = _xmouse;
        posRatonY = _ymouse;
    }
}
oyenteDeRaton.onMouseUp = function() {
    ratonPulsado = false;
}
Mouse.addListener(oyenteDeRaton);

mc.btn1.onRelease = function(){
    getURL("http://www.forosdelweb.com", "_blank", "GET");
}