Properties
Size and Position
Mostly you will refer to Movie Symbols in your code since Movie Symbols are elements that usually "doing" something on the screen. Most often changing properties are size and positioning. Let's create an illustrative example.- Create a new file. Set stage about 300X200 pixels
- Import an image to Flash. It can be a photo of decent quality and quite big size – for example 800*600 pixels.
- Transform the photo to Movie Symbol. Give it an instance name - for example photo .
- Make a mask. Mask itself may be a rectangle 180X120 px. All numbers are approximate.
- Your photo will be inside a masked layer
- Create 6 buttons which may look like for arrows pointing in different directions, zoom in and zoom out signs.
- Add the following code to the button pointing to the right
on(press) { photo._x += 10; } - Be sure that you refer to instance name of movie symbol, which includes your image. In our example it's "photo"
- Add similar code to other arrow button. Change += to -= for the left arrow button. Change _x to _y for up and down buttons.
- Add this code to the zoom in button
on (press) { photo._width *=1.1 photo._height *=1.1 } - Add similar code to zoom out button but change *= to /=
- Test your movie. When you click arrow buttons your image is moved up, down, left or right. When you click zooming buttons the picture is zooming in or out.
On this example you've referred to properties of the "photo" instance of Movie Symbol on the stage.
All Movie symbols are inherited from MovieClip Flash object. You may explore it's other property in Flash Help ActionScript Dictionary. Find out how to change the code for zooming buttons using _xscale and _uscale instead of _width and _height .