• home
  • forum
  • my
  • kt
  • download
  • Zoom in Zoom out using the + and - buttons

    Author: 2009-07-12 09:10:28 From:

    Using this thoroughly explained, detailed flash lesson, I will explain to you how to zoom in, zoom out any object, image, movie... using the + and - buttons and a little action script code. Using this lesson, you will also learn how to import any object into a flash stage, how to convert it into a Movie Clip Symbol, how to apply action script code on button and much, much more! Let's start!

    Example:

    Step 1

    First, find any image, object which you like to use for this lesson.

    Step 2

    Create a new flash document. Choose now File > Import > Import to stage (Ctrl+R) and import any image, or object into a flash stage.

    Step 3

    While the image, object is still selected, press F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol.

    Step 4

    While the new made Movie Clip is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Movie Clip "image_mc". See the picture below!



    Step 5

    It's time for buttons, so, create two buttons (plus and minus) like it is shown on the picture below!



    Step 6

    Select now the Selection Tool (V) and select only plus button. After that go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this button "PlusButton". See the picture below!



    Step 7

    Select now only minu button and go again to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this button "MinusButton". See the picture below!



    Step 8

    Create now a new layer above the layer 1 and name it action.

    Step 9

    Select the first frame of layer action and go to the Action Script Panel (F9). Then, enter this code inside the actions panel:

    PlusButton.onRelease = function() {
    if (image_mc._xscale == 169 && image_mc._yscale ==270) {
    image_mc.enabled = false;
    }
    else {
    image_mc._xscale += 20;
    image_mc._yscale += 20;
    }
    };
    MinusButton.onRelease = function() {
    if (image_mc._xscale == 10 && image_mc._yscale == 10) {
    image_mc.enabled = false;
    } else {
    image_mc._xscale -= 10;
    image_mc._yscale -= 10;
    }
    };

    We're done now!

    Test your Movie and enjoy!

    Download source file (.fla)

    discuss this topic to forum

    relation tutorial

    No information

    Category

      3D (36)
      Math Physics (18)
      3rd Party (10)
      Navigation (70)
      Actionscripting (235)
      Optimization (17)
      Animation (185)
      Projector (11)
      Audio (54)
      Special Effects (173)
      Backend (26)
      Text Effects (93)
      Drawing (34)
      Tips and Techniques (58)
      Dynamic Content (38)
      Tricks (8)
      Games (114)
      Utilities (24)
      Getting Started (99)
      Video (59)
      Interactivity (48)
      Web Design (37)

    New

    Hot