You are on page 1of 1

Actionscript dynamic load image into flash

In this Macromedia Flash tutorial I will show you how to load in a image into fl
ash dynamically through actionscripting
1.
First of make a button, just make some graphic, right click and convert it to a
button.
2.
Now we need to make a movieclip to contain the image, so draw a rectangle on the
stage, right click and convert it to a movie clip, in the properties panel name
the movie clip "img_container".
Photoshop Tutorial thumb picture
3.
Select the button we made before, and go to the actionscript panel and type in t
he following code.
on (release) {
loadMovie("1.jpg", "img_container");
_root.img_container._xscale = 40
_root.img_container._yscale = 40
}
The first line tells flash that the code inside it will happen when the button i
s clicked.
the second line is loading the image into the movie clip img_container (remember
to place the image file in the same place as the flash file.
The last two lines is to resize the movie clip (you may want to do something wit
h a procentage scaling instead of just 40 by 40 px.)
Photoshop Tutorial thumb picture

You might also like