School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,149 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,708 people online right now. Registration is fast and FREE... Join Now!




Buttons

 
Reply to this topicStart new topic

> Buttons, Creating a button that links to another Frame.

Glorfindal
Group Icon



post 28 Jul, 2009 - 06:42 AM
Post #1


Requirements
Flash 8 or later
basic understanding of drawing in Flash
--------------------------------------------

Now let's get started:

Start by opening Flash and creating
a new document. Name it A_Button.
Now you should see a white blank rectangle.
First we have to do the background. We start by changing
the Background color for all our frames by going down
to the bottom of the screen where it says Background
then you hit the dropdown and select a color to be the Background
for the all of the current and future frames. I'll pick blue.

NOTE: This choice can be changed at any time by just picking a different Color.

Next draw a rectangle bottom left with the inside color whatever you want to it to be (I'll pick
green) change the thickness to of the outline to 3. And keep the Outline color Black. The Rectangle
will be your play button.


Attached Image

Next add text into the rectangle the using the Text tool. Color can be whatever you want it to be (i'll use black)
but size should be 37. You should now see something like this:

Attached Image

Right now that is just a rectangle with words in it now we need to give
it the actual Properties of a button. We do this y selecting the Background
the outline and the text all togethor and then right clicking on it.
So click the outline Hold shift down, and while holding shift select the color inside
the rectangle and keep shift held down now select the text. You should now have:

Attached Image

Right Click it and click convert to symbol...

Attached Image

Where it says Symbol 1 wirte My_First_button
and make sure button selected. Then hit Okay.

Note: When you click your rectangle(Now button) it should look like this:

Attached Image

Now insert a blank Key frame and draw some random image in it like this:
Attached Image

Next select and right click on the the button you just made:
And click Actions, then copy and paste this code in there:

button
on(press){
_root.gotoAndStop(2);
}


I will now explain what this code means:

CODE
on(press)


This means if the bottom is pressed do this:
CODE
gotoAndStop(2);

Which should be self explanatory:

The
CODE
_root.

Means that that frame is in this scene.

Now test the code by Control in the top right. Then click Test Movie.
I hope you enjoyed this tutorial!
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

BetaWar
Group Icon



post 5 Aug, 2009 - 10:42 PM
Post #2
Pretty nice, simple tutorial.

One more important thing to state is that it is using Actionscript 2, not Actionscript 3.
Go to the top of the page
+Quote Post

Glorfindal
Group Icon



post 6 Aug, 2009 - 07:36 AM
Post #3
Good idea. But it won't let me edit it for some reason. Could you rename it Buttons (Actionscript 2)?
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 11/21/09 04:22PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month