Buttons o.O

+4
Patt
Leo
Peter95240
SoarKrieg
8 posters
Go down
SoarKrieg
SoarKrieg
Spritan
Spritan
Age : 27
Number of posts : 1447
Registration date : 2010-05-11
Location : Pittsburgh

Buttons o.O Empty Buttons o.O

6/14/2010, 12:34 pm
Buttons are very useful in Flash movies. They can be used to send you to certain points, make scene selections, etc. But a lotta people dunno how they work, so allow me to help out. P.S. This is AS2!!!

First of all, to make a button, draw a white rectangle(I always pick white o_O) that you can be boardered around the text of your button. Then make the white rectangle's "Alpha" 0 instead of 100. That takes away its transparency. :O

Okay, next, are some basic codes.
play(); - Makes the movie play
stop(); - Makes the movie stop
nextFrame(); - Goes to the next frame
prevFrame(); - Goes to the previous frame

gotoAndPlay(); - Tells Flash to go to and play the movie from whatever frame number is within the parentheses
gotoAndStop(); - Tells Flash to go to and stop the movie on whatever frame number is within the parentheses

A side note of those codes is whenever you give a certain frame a name, such as "dis frame", you can tell Flash to go to the frame based on its name, by adding the frame's name in quotation marks within the parentheses instead of a number. This is VERY handy. Ex: gotoAndPlay("dis frame")

if() - Makes an if statement in the parentheses that makes Flash do something if whatever is written in the parentheses is true
var - Creates new variables
_root. - Identifies an instance name variable
hitTest - Tells Flash to make something happen if two indicated things hit/touch each other

Those codes are EXTREMELY useful if you want to make a game or something interactive.

Hope this was of some use! Hit me up if you've got any questions or requests! But remember, this is AS2! Not AS3!


Last edited by SoarKrieg on 6/14/2010, 2:21 pm; edited 1 time in total
Peter95240
Peter95240
Spritan
Spritan
Age : 25
Number of posts : 615
Registration date : 2009-10-07
Location : United Kingdom
https://twitter.com/@ptr_01

Buttons o.O Empty Re: Buttons o.O

6/14/2010, 1:13 pm
well, i think this is awkward, since its in the balance of actionscripting and tutorials...
anyways, pretty good. :)

___________________________________________________________________________________________

 Mad 
- Twitter
- Gaming YouTube Channel [ChillaxersPlay]
- Personal Gaming Channel + Animations [PTR]
Leo
Leo
Administrator
Administrator
Age : 23
Number of posts : 9201
Registration date : 2009-05-23
Location : Brazil

Buttons o.O Empty Re: Buttons o.O

6/14/2010, 4:05 pm
uh...

Tutorials are meant for the tutorials section. Here's the place for posting things that you programmed. Anyone just move this to the right section.
avatar
Patt
Administrator
Administrator
Age : 26
Number of posts : 13142
Registration date : 2009-03-28

Buttons o.O Empty Re: Buttons o.O

6/14/2010, 7:50 pm
AS2 code for a simple button.

Code:
on (release) {
    gotoAndPlay (3);
}

What this means is...when you release the left clicking...thing... when clicking on a button, do something. you can also change (release) to (press), so that when you press it, it will go to the desired frame. This "something" is categorized within the curly brackets. So, this says, go to somewhere, and play frame 3. You can modify the frame number to fit your situation. You can alter the code for it to say; gotoAndStop, which would make it go somewhere, and, stop. Also, a semi-colon isn't always necessary, it's just often used for people to get used to it if they were interested in coding using C++ or other programming programs.

Also, whenever you want something to happen, be sure to have an open curly bracket and a closing bracket. Without those, Flash will not know what's going on. Opening up a window with an error saying some random stuff. The window will tell you the exact line that it found an error, and tell you what is wrong with it. If you do have some knowledge in this coding, or understand it, you should be able to solve the problem.


Last edited by Pattiasina24 on 6/15/2010, 7:27 pm; edited 1 time in total
Granadico
Granadico
Administrator
Administrator
Age : 25
Number of posts : 12958
Registration date : 2008-11-18
Location : On the computer
https://www.youtube.com/user/Granadicohttps://www.twitch.tv/granadico/profile

Buttons o.O Empty Re: Buttons o.O

6/14/2010, 8:21 pm
Pattiasina24 wrote:AS2 code for a simple button.

Spoiler:
on (release) {
gotoAndPlay (3);
}

What this means is...when you release the left clicking...thing... when clicking on a button, do something. you can also change (release) to (press), so that when you press it, it will go to the desired frame. This "something" is categorized within the curly brackets. So, this says, go to somewhere, and play frame 3. You can modify the frame number to fit your situation. You can alter the code for it to say; gotoAndStop, which would make it go somewhere, and, stop. Also, a semi-colon isn't always necessary, it's just often used for people to get used to it if they were interested in coding using C++ or other programming programs.

Also, whenever you want something to happen, be sure to have an open curly bracket and a closing bracket. Without those, Flash will not know what's going on. Opening up a window with an error saying some random stuff. The window will tell you the exact line that it found an error, and tell you what is wrong with it. If you do have some knowledge in this coding, or understand it, you should be able to solve the problem.

why would that need to be a spoiler?

___________________________________________________________________________________________

Buttons o.O Granadico made by Knux184

We can learn from the past
But those days are gone
We can hope for the future
But there may not be one
-Mike Portnoy "A Change of Seasons"
avatar
Patt
Administrator
Administrator
Age : 26
Number of posts : 13142
Registration date : 2009-03-28

Buttons o.O Empty Re: Buttons o.O

6/14/2010, 8:37 pm
@Granadico wrote:

why would that need to be a spoiler?
It's a code. I don't promote copypasta for learners. So I put the code and what things meant. Each thing is described underneath the code.
DarkZeroXP
DarkZeroXP
Spritan
Spritan
Age : 27
Number of posts : 401
Registration date : 2010-03-21
Location : Florida

Buttons o.O Empty Re: Buttons o.O

6/14/2010, 8:47 pm
Yeah.. well I still don't know... I think this should go on the tutorials section, and leave this action scripting thing, for questions people have about action scripting I guess

___________________________________________________________________________________________

Buttons o.O Signaturevs
This our website! There are many like it, but this one is ours! Without us, The Spritas is nothing! Without The Spritas, I am nothing!
DarkZeroXP
DarkZeroXP
Spritan
Spritan
Age : 27
Number of posts : 401
Registration date : 2010-03-21
Location : Florida

Buttons o.O Empty Re: Buttons o.O

6/14/2010, 8:49 pm
Pattiasina24 wrote:
@Granadico wrote:

why would that need to be a spoiler?
It's a code. I don't promote copypasta for learners. So I put the code and what things meant. Each thing is described underneath the code.

You know... they can still copy and paste the code... And, there's a thing for codes when you type the message.

Code:
//like this

___________________________________________________________________________________________

Buttons o.O Signaturevs
This our website! There are many like it, but this one is ours! Without us, The Spritas is nothing! Without The Spritas, I am nothing!
SoarKrieg
SoarKrieg
Spritan
Spritan
Age : 27
Number of posts : 1447
Registration date : 2010-05-11
Location : Pittsburgh

Buttons o.O Empty Re: Buttons o.O

6/14/2010, 10:06 pm
Sorry. I didn't think this was a "tutorial" on how to do anythin' in particular. I just wanted to share some AS2 that could help you guys out. You can move the topic if you want, though.
avatar
Patt
Administrator
Administrator
Age : 26
Number of posts : 13142
Registration date : 2009-03-28

Buttons o.O Empty Re: Buttons o.O

6/15/2010, 7:26 pm
@DarkZeroXP wrote:
Pattiasina24 wrote:
@Granadico wrote:

why would that need to be a spoiler?
It's a code. I don't promote copypasta for learners. So I put the code and what things meant. Each thing is described underneath the code.

You know... they can still copy and paste the code... And, there's a thing for codes when you type the message.

Code:
//like this
I knew they could still copy the code, but i didn't know there was a thing for codes.
SoarKrieg
SoarKrieg
Spritan
Spritan
Age : 27
Number of posts : 1447
Registration date : 2010-05-11
Location : Pittsburgh

Buttons o.O Empty Re: Buttons o.O

6/16/2010, 6:07 pm
leocartoon1 wrote:uh...

Tutorials are meant for the tutorials section. Here's the place for posting things that you programmed. Anyone just move this to the right section.

Sorry, I didn't intend for this to be an actual "tutorial".
xKAreloadedx
xKAreloadedx
Spritan
Spritan
Age : 29
Number of posts : 1522
Registration date : 2010-07-20
Location : I forgot...

Buttons o.O Empty Re: Buttons o.O

7/23/2010, 9:38 pm
so if i possibly wanna make a next button instead of making countless useless frames in a flash movie to help reading the text go at the viewer's speed......how would i go about doing that confused
SoarKrieg
SoarKrieg
Spritan
Spritan
Age : 27
Number of posts : 1447
Registration date : 2010-05-11
Location : Pittsburgh

Buttons o.O Empty Re: Buttons o.O

7/23/2010, 11:18 pm
@xKAreloadedx wrote:so if i possibly wanna make a next button instead of making countless useless frames in a flash movie to help reading the text go at the viewer's speed......how would i go about doing that confused

on(release){
_root.nextFrame();
}

Copy and paste that code onto a button's main AS Window. P.S. That's AS2.

If that's wrong, which I don't think it is, lemme know. Haven't coded anything in months...and I did that without checking Flash, so yeah, if it don't work, lemme know. Tired as hell right now.
xKAreloadedx
xKAreloadedx
Spritan
Spritan
Age : 29
Number of posts : 1522
Registration date : 2010-07-20
Location : I forgot...

Buttons o.O Empty Re: Buttons o.O

7/24/2010, 12:10 am
@SoarKrieg wrote:
@xKAreloadedx wrote:so if i possibly wanna make a next button instead of making countless useless frames in a flash movie to help reading the text go at the viewer's speed......how would i go about doing that confused

on(release){
_root.nextFrame();
}

Copy and paste that code onto a button's main AS Window. P.S. That's AS2.

If that's wrong, which I don't think it is, lemme know. Haven't coded anything in months...and I did that without checking Flash, so yeah, if it don't work, lemme know. Tired as hell right now.
i did but theres one problem...i want the movie to pause at that button's frame until you press next, it didnt stop T_T
SoarKrieg
SoarKrieg
Spritan
Spritan
Age : 27
Number of posts : 1447
Registration date : 2010-05-11
Location : Pittsburgh

Buttons o.O Empty Re: Buttons o.O

7/24/2010, 12:15 am
@xKAreloadedx wrote:i did but theres one problem...i want the movie to pause at that button's frame until you press next, it didnt stop T_T

Oh, dude! On the frame you want it to stop on, go into the frame's ActonScript and type "stop();", no quotation marks, though.
xKAreloadedx
xKAreloadedx
Spritan
Spritan
Age : 29
Number of posts : 1522
Registration date : 2010-07-20
Location : I forgot...

Buttons o.O Empty Re: Buttons o.O

7/24/2010, 12:21 am
@SoarKrieg wrote:
@xKAreloadedx wrote:i did but theres one problem...i want the movie to pause at that button's frame until you press next, it didnt stop T_T

Oh, dude! On the frame you want it to stop on, go into the frame's ActonScript and type "stop();", no quotation marks, though.
yay it worked but after the first next button, it stops at that animation....T-T it wont go to the next "next" button
SoarKrieg
SoarKrieg
Spritan
Spritan
Age : 27
Number of posts : 1447
Registration date : 2010-05-11
Location : Pittsburgh

Buttons o.O Empty Re: Buttons o.O

7/24/2010, 12:23 am
@xKAreloadedx wrote:
@SoarKrieg wrote:
@xKAreloadedx wrote:i did but theres one problem...i want the movie to pause at that button's frame until you press next, it didnt stop T_T

Oh, dude! On the frame you want it to stop on, go into the frame's ActonScript and type "stop();", no quotation marks, though.
yay it worked but after the first next button, it stops at that animation....T-T it wont go to the next "next" button

Oh, sorry. The previous code I stated with the "next" thing in it causes Flash to STOP on the next frame. If you want it to play on the next frame, then type:

on(release){
_root.play();
}
xKAreloadedx
xKAreloadedx
Spritan
Spritan
Age : 29
Number of posts : 1522
Registration date : 2010-07-20
Location : I forgot...

Buttons o.O Empty Re: Buttons o.O

7/24/2010, 12:31 am
@SoarKrieg wrote:
@xKAreloadedx wrote:
@SoarKrieg wrote:
@xKAreloadedx wrote:i did but theres one problem...i want the movie to pause at that button's frame until you press next, it didnt stop T_T

Oh, dude! On the frame you want it to stop on, go into the frame's ActonScript and type "stop();", no quotation marks, though.
yay it worked but after the first next button, it stops at that animation....T-T it wont go to the next "next" button

Oh, sorry. The previous code I stated with the "next" thing in it causes Flash to STOP on the next frame. If you want it to play on the next frame, then type:

on(release){
_root.play();
}
yyyyyyyYYYYYYEEEEESSSSS!!!!!! it WoRKED!!! thanks o much dude!!!! I REALLY NEEDED THIS, now.....all my Movies will be at their best XD
SoarKrieg
SoarKrieg
Spritan
Spritan
Age : 27
Number of posts : 1447
Registration date : 2010-05-11
Location : Pittsburgh

Buttons o.O Empty Re: Buttons o.O

7/24/2010, 12:32 am
Lol. Glad I could help you out.
xKAreloadedx
xKAreloadedx
Spritan
Spritan
Age : 29
Number of posts : 1522
Registration date : 2010-07-20
Location : I forgot...

Buttons o.O Empty Re: Buttons o.O

7/24/2010, 12:36 am
yeah lol sorry for that umm....outburst but i've needed this for a while now man, so yeah thanks again XD, its about time we both got some shuteye =D, peace dude
SoarKrieg
SoarKrieg
Spritan
Spritan
Age : 27
Number of posts : 1447
Registration date : 2010-05-11
Location : Pittsburgh

Buttons o.O Empty Re: Buttons o.O

7/26/2010, 7:11 pm
@xKAreloadedx wrote:yeah lol sorry for that umm....outburst but i've needed this for a while now man, so yeah thanks again XD, its about time we both got some shuteye =D, peace dude

Okay, dude. Let me know if you need any help some other time.
xShufflee
xShufflee
Spritan
Spritan
Age : 23
Number of posts : 139
Registration date : 2012-08-19

Buttons o.O Empty Re: Buttons o.O

8/20/2012, 10:10 pm
This will help me in the future thanks ;3

___________________________________________________________________________________________

I'm a dragon rawr :3.

Skype is: allan-san1

Add me broooos. :)
Back to top
Permissions in this forum:
You cannot reply to topics in this forum