Formule pour dézoomer

mikouRoux Messages postés 69 Date d'inscription jeudi 16 novembre 2006 Statut Membre Dernière intervention 6 octobre 2009 - 31 juil. 2007 à 14:56
mikouRoux Messages postés 69 Date d'inscription jeudi 16 novembre 2006 Statut Membre Dernière intervention 6 octobre 2009 - 31 juil. 2007 à 20:10
Salut,

Me revoilà avec un nouveau problème. Cette fois ci, c'est juste la façon de poser correctement une formule qui me pose problème

La fonction ci-dessous permet de zoomer sur une image en se référant à la position de la souris.
Le problème, c'est que je ne vois pas comment faire pour dézoomer.
Comment faire en sorte que la taille de l'image se divise par 2 tout en gardant une bonne position par rapport à la souris ??

    if(_global.zoomIn==true and count <= 2){
        mc_switch._width = (mc_switch._width*2);
        mc_switch._height = (mc_switch._height*2);
        mc_switch._x = (mc_switch._x + mc_switch._x - _xmouse);
        mc_switch._y = (mc_switch._y + mc_switch._y - _ymouse);
        count++;

Merci d'avance
++
MikouRoux

1 réponse

mikouRoux Messages postés 69 Date d'inscription jeudi 16 novembre 2006 Statut Membre Dernière intervention 6 octobre 2009
31 juil. 2007 à 20:10
C'est bon, j'ai trouvé la solution :

// pour zoomer
    if(_global.zoomIn==true and count <= 2){
        mc_switch._width = (mc_switch._width*2);
        mc_switch._height = (mc_switch._height*2);
        mc_switch._x = (mc_switch._x + mc_switch._x - _xmouse);
        mc_switch._y = (mc_switch._y + mc_switch._y - _ymouse);
        count++;

// pour dézoomer
    }else if(_global.zoomOut==true and count > 0){
        mc_switch._width = (mc_switch._width/2);
        mc_switch._height = (mc_switch._height/2);
        mc_switch._x = (mc_switch._x+_xmouse)/2;
        mc_switch._y = (mc_switch._y+_ymouse)/2;
        trace(mc_switch._x);
        count--;       
    }

Il suffisait d'inverser la formule pour zoomer

++
0
Rejoignez-nous