Welcome, Guest
  • Author Topic: zoom wont stop when i press the button...  (Read 2415 times)

    -shamarque-

    • Jr. Programmer
    • **
    • Posts: 53
      • MSN Messenger - shamarque@hotmail.com
      • AOL Instant Messenger - shamarque
      • Yahoo Instant Messenger - shamarque@yahoo.com
      • View Profile
      • Sesama Open Learning Sdn Bhd
      • Email
    zoom wont stop when i press the button...
    « on: 01/15/06, 21:33 »
    hi..

    i hav a problem.. i try to make a button where when user press it, it will zoom an image 50% from its original size... but, my problem is... when user press it... it wont stop.. can anyone help me out..

    here is the full code of my button.. where i should repair just to make sure that it only zoom 50% and stop?

    Code: [Select]
    on (press) {
    zoom("start", "plus", "image_mc", 50);
    }
    on (release) {
    btn4x.enabled = false,
    mc_4x._alpha = 25;
    btn8x.enabled = false,
    mc_8x._alpha = 25;
    zoom("stop", null, "image_mc", null);
    tip("");
    }
    on (rollOver) {
    tip("4x");
    }
    on (rollOut) {
    tip("");
    }

    thanks in advance...
    « Last Edit: 01/15/06, 22:00 by shamarque »
    -Success Is A Ladder That Cannot Be Climbed With Your Hands In Your Pocket-

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: zoom wont stop when i press the button...
    « Reply #1 on: 01/16/06, 14:41 »
    Post the zoom function

    Jorge

    -shamarque-

    • Jr. Programmer
    • **
    • Posts: 53
      • MSN Messenger - shamarque@hotmail.com
      • AOL Instant Messenger - shamarque
      • Yahoo Instant Messenger - shamarque@yahoo.com
      • View Profile
      • Sesama Open Learning Sdn Bhd
      • Email
    Re: zoom wont stop when i press the button...
    « Reply #2 on: 01/17/06, 01:12 »
    Dear jorge,

    my image viewer have 5 button, [zoom in] [zoom out] [reset to original position] [zoom 4x] [zoom 8x].

    actually i'm doing a medical image viewer. so its need a function like microscope.. zoom 4 time & 8 times.


    on the keyframe, here is my zoom function.

    //zoom
    zoom = function( action, type, soul, factor){
       if(action == "start"){
          if(type == "plus"){
             this[soul].onEnterFrame = function(){         
                with(this){
                   _xscale += factor;
                   _yscale += factor;               
                }
             }
          }
          if(type == "minus"){
             this[soul].onEnterFrame = function(){
                if(this._xscale>101){
                   with(this){
                      _xscale += factor;
                      _yscale += factor;               
                   }
                }
             }
          }      
       }else{
          delete this[soul].onEnterFrame;
       }
    }



    for my [zoom in]

    //zoom in
    on (press) {
       zoom("start", "plus", "image_mc", 5);
    }
    on (release) {
       btn4x.enabled = false,
       mc_4x._alpha = 25;
       btn8x.enabled = false,
       mc_8x._alpha = 25;
       zoom("stop", null, "image_mc", null);
       tip("");   
    }
    on (rollOver) {
       tip("Zoom in");
    }
    on (rollOut) {
       tip("");
    }


    for my [zoom 8x]

    //zoom 8x
    on (press) {
       zoom("start", "plus", "image_mc", 100);
    }
    on (release) {
       btn8x.enabled = false,
       mc_8x._alpha = 25;
       btn4x.enabled = false,
       mc_4x._alpha = 25;
       zoom("stop", null, "image_mc", null);
       tip("");   
    }
    on (rollOver) {
       tip("8x");
    }
    on (rollOut) {
       tip("");
    }


    hopefully i giv u a right info... plz advise me...

    thank you in advance....
    -Success Is A Ladder That Cannot Be Climbed With Your Hands In Your Pocket-

    -shamarque-

    • Jr. Programmer
    • **
    • Posts: 53
      • MSN Messenger - shamarque@hotmail.com
      • AOL Instant Messenger - shamarque
      • Yahoo Instant Messenger - shamarque@yahoo.com
      • View Profile
      • Sesama Open Learning Sdn Bhd
      • Email
    Re: zoom wont stop when i press the button...
    « Reply #3 on: 01/17/06, 02:02 »
    basically.. my problem is.. when user press the [zoom 4x] button, it will zoom 50% from its original image. Then it will stop.

    Wut i having here.. if user press the key for too long.. it will multiply the zoom ratio.

    hope u understand wut i mean.

    thanks...

    p/s : i know dat my question sound stupid.. and i think the was and easy solution but my newbie brain cant think the solution of it..
    -Success Is A Ladder That Cannot Be Climbed With Your Hands In Your Pocket-

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: zoom wont stop when i press the button...
    « Reply #4 on: 01/18/06, 16:04 »
    Add a fith parameter, the maximun :

    zoom = function(action, type, soul, factor, max){

    and add an if to limit the zoom


     
    ...
     
    this[soul].onEnterFrame = function(){         
                
    with(this){
                   
    _xscale += factor;
                   
    _yscale += factor;               
                }
     }
     if(
    _xscale>=maxdelete this[soul].onEnterFrame 
     
    ...


    Jorge

    -shamarque-

    • Jr. Programmer
    • **
    • Posts: 53
      • MSN Messenger - shamarque@hotmail.com
      • AOL Instant Messenger - shamarque
      • Yahoo Instant Messenger - shamarque@yahoo.com
      • View Profile
      • Sesama Open Learning Sdn Bhd
      • Email
    Re: zoom wont stop when i press the button...
    « Reply #5 on: 01/19/06, 00:14 »
    thanks jorge..

     i'll try it 1st...
    -Success Is A Ladder That Cannot Be Climbed With Your Hands In Your Pocket-