Comment réaliser un "smooth drag"

cs_biloul04 Messages postés 4 Date d'inscription samedi 26 juin 2004 Statut Membre Dernière intervention 23 juin 2009 - 8 mars 2009 à 00:43
cs_biloul04 Messages postés 4 Date d'inscription samedi 26 juin 2004 Statut Membre Dernière intervention 23 juin 2009 - 10 mars 2009 à 19:10
bonjour,
 j'aimerais réaliser un smooth drag d'un objet. mais je ne sais
pas comment faire sous flash mx 2004.
j'ai commencer comme cela :

slide.onPress=function() {
startDrag("slide",false,8,10,177,10);
}
slide.onRelease =function() {
    stopDrag()
   slide._x=8
}

slide est mon movie clip, sa position initial est slide._x=8

j'ai pas AS3. voici un tuto pour
AS3 , le rendu que je veux est le même que sur ce site .http://www.getw3help.com/2008/10/smo...g-tweener.html  c'est a dire une possibilité de déplacer mon movie clip avec un effet smooth

merci .
 

3 réponses

cs_bali_balo Messages postés 1378 Date d'inscription samedi 9 octobre 2004 Statut Membre Dernière intervention 1 novembre 2010 1
9 mars 2009 à 12:16
Salut,
ton bonheur, tu le trouveras ici : http://www.zoneflash.net/tutoriaux/t029.php

bali_balo....=]
0
cs_biloul04 Messages postés 4 Date d'inscription samedi 26 juin 2004 Statut Membre Dernière intervention 23 juin 2009
10 mars 2009 à 18:42
merci pour ton site j'ai trouver ce code bien intéressant :
onEnterFrame = function(){
var dx = _xmouse - cercle_mc._x;
var dy = _ymouse - cercle_mc._y;
cercle_mc._x += 0.25*dx;
cercle_mc._y += 0.25*dy;
}

il fait bouger un movie clip par rapport a la position de
la souris.
j'aimerai pouvoir faire sa mais seulement quand je clique
sur le movie clip (=un drag) j'ai donc remplacer

onEnterFrame par onPress

mais sa marche pas

peut tu m'aider

merci

 
0
cs_biloul04 Messages postés 4 Date d'inscription samedi 26 juin 2004 Statut Membre Dernière intervention 23 juin 2009
10 mars 2009 à 19:10
non 'est bon j'ai réussis grace a un autre site voici le code

_root.myMC.ease = 2;
_root.myMC.targX = _root.myMC._x;
_root.myMC.targY = _root.myMC._y
_root.myMC.onPress = function(){
    this.drag = true;
};
_root.myMC.onEnterFrame = function(){
    if(this.drag == true){
        this.targX = _root._xmouse;
        this.targY = _root._ymouse;
    }
    if(this._x != this.targX | this._y != this.targY){
        this._x += (this.targX-this._x)/this.ease;
        this._y += (this.targY-this._y)/this.ease;
    }
};
_root.myMC.onMouseUp = function(){
    this.drag = false;
};

0
Rejoignez-nous