Be a Supporter!

Play Buttons

  • 377 Views
  • 16 Replies
New Topic Respond to this Topic
Tryptamine420
Tryptamine420
  • Member since: Aug. 13, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Play Buttons 2009-10-21 20:32:05 Reply

Ok so i got my trial version of Flash professional cs4 fixed
I am working on doing my first animation and i need a little help with the play button

How do you get the play button to start the animation?
and do you have to do the script by hand or is there a way arouund scripting it?

XDuradinX
XDuradinX
  • Member since: Oct. 4, 2008
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Play Buttons 2009-10-21 20:53:47 Reply

You need to use actionscript for a play button, but it's really easy.

Make a circle, square or whatever, and put some text over it saying play or something. Then select all of it, right-click - convert to symbol - button. Name it whatever you want.
Then once you have your button, click it and go to the actions bar, at the bottom above the properties bar. Add this code:

on(release) { // this means when you release the button after a click
gotoAndPlay('scene _', _) // scene _ (insert which scene)', _(insert the frame you wish to go to)
}


Yeah... that's my sig :)

BBS Signature
XDuradinX
XDuradinX
  • Member since: Oct. 4, 2008
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Play Buttons 2009-10-21 20:55:22 Reply

Oh and // means this part is just a comment, doesnt affect flash. Raw code is:

on(release) {
gotoAndPlay('scene _', _)
{

just replace scene _ with the scene, and the next _ with the frame you are going to.


Yeah... that's my sig :)

BBS Signature
Tryptamine420
Tryptamine420
  • Member since: Aug. 13, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Play Buttons 2009-10-21 21:27:17 Reply

At 10/21/09 08:55 PM, XDuradinX wrote: Oh and // means this part is just a comment, doesnt affect flash. Raw code is:

on(release) {
gotoAndPlay('scene _', _)
{

just replace scene _ with the scene, and the next _ with the frame you are going to.

You forgot the semicolon after on(release)
and
I already had that, and when i check for errors it says no errors, but when i debug or test movie it says i do have errors.

Tryptamine420
Tryptamine420
  • Member since: Aug. 13, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Play Buttons 2009-10-21 21:40:27 Reply

1180: Call to a possibly undefined method on.
1120: Access of undefined property release.

It Keeps giving me those errors and idk why
Can anyone tell me how to fix that?

HomerSexual
HomerSexual
  • Member since: May. 26, 2007
  • Offline.
Forum Stats
Member
Level 22
Programmer
Response to Play Buttons 2009-10-21 21:44:49 Reply

At 10/21/09 09:40 PM, Tryptamine420 wrote: 1180: Call to a possibly undefined method on.
1120: Access of undefined property release.

It Keeps giving me those errors and idk why
Can anyone tell me how to fix that?

Just use this code, shitloads easier for a beginner:
on(release, releaseOutside){
gotoAndPlay(nextFrame);
}

Tryptamine420
Tryptamine420
  • Member since: Aug. 13, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Play Buttons 2009-10-21 22:02:57 Reply

At 10/21/09 09:44 PM, uzi47 wrote:
At 10/21/09 09:40 PM, Tryptamine420 wrote: 1180: Call to a possibly undefined method on.
1120: Access of undefined property release.

It Keeps giving me those errors and idk why
Can anyone tell me how to fix that?
Just use this code, shitloads easier for a beginner:
on(release, releaseOutside){
gotoAndPlay(nextFrame);
}

Still doesn't work, it just keeps telling me the properties are undefined,
Just to check with everyone, are you guys giving me actionscript 2.0 codes?
becasue that may be the problem, i don't think it is based on the error message i'm getting, but it could be
The movie i am making is an actionscript 3.0 file

HomerSexual
HomerSexual
  • Member since: May. 26, 2007
  • Offline.
Forum Stats
Member
Level 22
Programmer
Response to Play Buttons 2009-10-21 22:06:25 Reply

At 10/21/09 10:02 PM, Tryptamine420 wrote:
The movie i am making is an actionscript 3.0 file

Actionscript 3.0 files are only used for AS3. You can't place the codes in the buttons, or MC's. Only just frames, and .AS files

So switch over to an actionscript 2.0 file, and your problem will be resolved.

Tryptamine420
Tryptamine420
  • Member since: Aug. 13, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Play Buttons 2009-10-21 22:11:42 Reply

At 10/21/09 10:06 PM, uzi47 wrote:
At 10/21/09 10:02 PM, Tryptamine420 wrote:
The movie i am making is an actionscript 3.0 file
Actionscript 3.0 files are only used for AS3. You can't place the codes in the buttons, or MC's. Only just frames, and .AS files

So switch over to an actionscript 2.0 file, and your problem will be resolved.

Thanks for the tip
I wish someone told me that before i spent two days working on an as3 file

HomerSexual
HomerSexual
  • Member since: May. 26, 2007
  • Offline.
Forum Stats
Member
Level 22
Programmer
Response to Play Buttons 2009-10-21 22:22:19 Reply

At 10/21/09 10:11 PM, Tryptamine420 wrote: Thanks for the tip
I wish someone told me that before i spent two days working on an as3 file

Yeah, no problem.
When I started flash, I learned this the hard way,

Tryptamine420
Tryptamine420
  • Member since: Aug. 13, 2009
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to Play Buttons 2009-10-21 22:33:01 Reply

Ok now i got the button set up, and i didnt have trouble with this when i was using an as3 file, but now i can't get the play text on my button to be part of the button, i don't know what exactly i did before

RayDeath9
RayDeath9
  • Member since: Jun. 22, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Play Buttons 2009-10-21 23:15:16 Reply

Lol

HomerSexual
HomerSexual
  • Member since: May. 26, 2007
  • Offline.
Forum Stats
Member
Level 22
Programmer
Response to Play Buttons 2009-10-21 23:25:10 Reply

At 10/21/09 10:33 PM, Tryptamine420 wrote: Ok now i got the button set up, and i didnt have trouble with this when i was using an as3 file, but now i can't get the play text on my button to be part of the button, i don't know what exactly i did before

Can you expand on this?
You want your play text to be apart of the button?
Just double click the button.
And make a new layer, then insert the text.

randomdoodleman
randomdoodleman
  • Member since: Sep. 12, 2008
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to Play Buttons 2009-10-22 08:18:37 Reply

your probably using as3, you need as2.


Racecar is racecar backwards.

Innermike
Innermike
  • Member since: Sep. 11, 2009
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Play Buttons 2009-10-22 08:30:01 Reply

Who says you need to change to AS2 , if you have AS3 you might aswell use it

stop();
instancenameofbutton.addEventListener(MouseEvent.CLICK,fPlay,false,0,true);
function fPlay(e:MouseEvent):void {
	play();
}

Put that in the frame with the play button in an AS3 document and change "instancenameofbutton" with whatever the instance name of your button is.

If you learn AS3 youll get more for your money , or in this case download tim ;)


nobody

henke37
henke37
  • Member since: Sep. 10, 2004
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to Play Buttons 2009-10-22 15:22:06 Reply

Also, you don't need to scrap all work in the file just to change the actionscript settings.


Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.

HomerSexual
HomerSexual
  • Member since: May. 26, 2007
  • Offline.
Forum Stats
Member
Level 22
Programmer
Response to Play Buttons 2009-10-22 16:45:06 Reply

At 10/22/09 08:30 AM, hdxmike wrote: Who says you need to change to AS2 , if you have AS3 you might aswell use it

AS2 is alot easier in first place.