Flash Simple Button load/unload Tutorial

1 post Page 1 of 1
Contributors
User avatar
hungryhounduk
VIP - Site Partner
VIP - Site Partner
Posts: 2870
Joined: Mon Jul 27, 2009 11:58 am

Hi All
Here is a very simple Button Tutorial in Flash

* What we are covering here is Creating Buttons and then Unloading and Loading MOVIE CLIPS ( ie: the .swf files)

1. Start Flash and when you are presented with the Flash Stage with an empty Document, Go to FILE >IMPORT TO LIBRARY and pic an Image and Click ok to add it to the Flash Library.

*This is the Image i am using to show you how this is all done
Image

2. Drag the Image onto the BLANK Flash Stage from the Library and Center it HORIZONTAL AND VERTICAL

3. Click on the Image on the Stage to SELECT IT and Press F8 ( to Convert it into a Button )and in the Dialog Box that appears choose BUTTON and Give it a NAME And Click OK.

4. Your Image has now been CONVERTED TO A BUTTON

5. You can now DELETE the Button on the Stage as It is in the Library and DELETING the one on the stage wont effect the Library one.

6. Drag the BUTTON from the Library onto the Stage and click it ONCE To SELECT IT

7. Press F9 to OPEN the Action Panel so we can add our CODE to the Button


Image

Image


If you look at the Image above, This is the Actions Panel Open for our Button, On the Left Hand side you will see all the Actions that can be added..

8. Double click the 'ON' icon Under 'GetProperty' in the Actions List

*As you can see from the Images above when the actions panel is open and you click on an Action Like:

'On' and then Tick the Checkbox for which action you want to asign, I have choosen (Release) which tells flash that when my Buttons Pressed and Realeased it will carry out the following action.

*You will see all the EVENTS that can be added to the Button and From the Code it tells us that:

On Release of the mouse Button Flash will Unload the Movie (click 1.swf) from Level '0' that is Visible (Which is the Picture with Click me on it ) and then Flash will Load the New MovieClip called 'Click 2.swf'

It will Load the clip ( Click 2.swf ) into the same movie clip Because we have said that we want to load Click 2.swf into Level '0' ( as this was where the First Movie Clip Resided )

Image

* This is the Beauty of Flash, You can create Lots of .SWF Files all linking to each other and if you are say designing a WEBSITE in Flash It keeps the Filesize really small and is a must if you have a Large site..

* I created before Xmas a Website for my M8 who is a Karate Instructor and his site involved about over 100 different .swf files and because i did it in flash it kept the filesize really low as everytime you clicked on any Link or Button or Image on the site it Un-loaded and re-Loaded new .swf files each time.

This Image below is the 2nd Movie Clip that is Loaded by Flash ( called click 2.swf )

Image

So if you have followed this so far and have completed your first Movie Clip as above

SAVE IT with the filename of your choice and then ( PRESS CTRL+ENTER to Publish the .swf file) and then just make a new Movie clip in the same way linking back to the first Movie Clip, and then save it and PUBLISH it in the same way.

You should now have 2 .swf files that link to each other

Download the Attachment below and test out the 2 files to see how easy it is .

I hope you have enjoyed this simple tutorial

More to come cooll;

Chris
You do not have the required permissions to view the files attached to this post.
Image
1 post Page 1 of 1
Return to “Tutorials”