Create an Account!

Adobe Flash Community Forum for all your Flash, Actionscript and Swift3D Support

Search:
FlashDevils Community
 Recommend Us
 About FlashDevils Community
 Can i become a moderator?
 How do i add Flash to my post?
 
Flash Community Register Flash Forum Control Panel Calendar Member List FAQ Search FLA Files
FlashDevils Community FlashDevils Community > Board > Flash > Flash ActionScript > Button Replay?


  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
freakout
Little Devil

Registered: Jan 2006
Local time: 05:04 AM
Location:
Posts: 14

Button Replay?Post #1

I am trying to get a button to replay a movie but no luck. Thanks to XemonerdX He gave me the code to get a button to play a movie,..
// place on your button
on (release) {
_root.myMC.play();
}

//
That worked very well, but what I am trying to do is after clicking on the play button, I want it to "disapear" and then on last frame of movie, I want to have another button labelled "replay". I am stuck on what code to use for this. I have tried using alpha fade at 0% but then the button "play" doesen't seem to work? My questons are these, how to incorporate a second button labelled "replay?" with correct code? And how to get the first button labelled "play" to dissapear when clicked so that only the movie clip is played and then when movie clip stops, I want the "replay?" button to appear. Thanks to anyone who can help.



Report this post to a moderator | IP: Logged

Old Post 01-25-2006 06:40 PM
freakout is offline Click Here to See the Profile for freakout Click here to Send freakout a Private Message Find more posts by freakout Add freakout to your buddy list Edit/Delete Message Reply w/Quote
JimmyPez
Awesome Devil

Registered: Dec 2005
Local time: 12:04 AM
Location: NY
Posts: 798

Post #2

on the play button - keep your code the same, but after the play command - try
-

ActionScript:
on(release){
        _root.myMC.play();
        buttonInstancename._visable=false;
}




place the replay button in the movie timeline,have that initially set to _visable.false; also,


then in the last frame of the movie, tell

replayButtonInstance._visable=true;

theres probably better ways to do this



Report this post to a moderator | IP: Logged

Old Post 01-26-2006 02:41 PM
JimmyPez is offline Click Here to See the Profile for JimmyPez Click here to Send JimmyPez a Private Message Click Here to Email JimmyPez Visit JimmyPez's homepage! Find more posts by JimmyPez Add JimmyPez to your buddy list Edit/Delete Message Reply w/Quote
ShapeShifter
<- [Staff Member] -> this.brainCells++;

Registered: Apr 2005
Local time: 06:04 AM
Location: Sweden
Posts: 2344

Post #3

first of all - it should be _visible and not _visable

second.. if the code is on the button and you need to target the button itself from within it's code you can use "this"..

try:

ActionScript:
on (release) {
        _root.myMC.play();
        this._visible = false;
}

__________________
>[ Rate Me 5! ]< >[ Rate Me 4! ]< >[ Rate Me 3! ]<
One who makes no mistakes never makes anything.



Report this post to a moderator | IP: Logged

Old Post 01-26-2006 03:47 PM
ShapeShifter is offline Click Here to See the Profile for ShapeShifter Click here to Send ShapeShifter a Private Message Click Here to Email ShapeShifter Visit ShapeShifter's homepage! Find more posts by ShapeShifter Add ShapeShifter to your buddy list Edit/Delete Message Reply w/Quote
JimmyPez
Awesome Devil

Registered: Dec 2005
Local time: 12:04 AM
Location: NY
Posts: 798

Post #4

<<< loves to spell things wrong



Report this post to a moderator | IP: Logged

Old Post 01-26-2006 04:08 PM
JimmyPez is offline Click Here to See the Profile for JimmyPez Click here to Send JimmyPez a Private Message Click Here to Email JimmyPez Visit JimmyPez's homepage! Find more posts by JimmyPez Add JimmyPez to your buddy list Edit/Delete Message Reply w/Quote
ShapeShifter
<- [Staff Member] -> this.brainCells++;

Registered: Apr 2005
Local time: 06:04 AM
Location: Sweden
Posts: 2344

Post #5

it's better to spell wrong than do stupid mistakes.. lol!

__________________
>[ Rate Me 5! ]< >[ Rate Me 4! ]< >[ Rate Me 3! ]<
One who makes no mistakes never makes anything.



Report this post to a moderator | IP: Logged

Old Post 01-26-2006 06:32 PM
ShapeShifter is offline Click Here to See the Profile for ShapeShifter Click here to Send ShapeShifter a Private Message Click Here to Email ShapeShifter Visit ShapeShifter's homepage! Find more posts by ShapeShifter Add ShapeShifter to your buddy list Edit/Delete Message Reply w/Quote
JimmyPez
Awesome Devil

Registered: Dec 2005
Local time: 12:04 AM
Location: NY
Posts: 798

Post #6

<<< likes to make those too



Report this post to a moderator | IP: Logged

Old Post 01-26-2006 08:02 PM
JimmyPez is offline Click Here to See the Profile for JimmyPez Click here to Send JimmyPez a Private Message Click Here to Email JimmyPez Visit JimmyPez's homepage! Find more posts by JimmyPez Add JimmyPez to your buddy list Edit/Delete Message Reply w/Quote
freakout
Little Devil

Registered: Jan 2006
Local time: 05:04 AM
Location:
Posts: 14

Post #7

Thanks guys, but I couldn't get that to work, the

ActionScript:
buttonInstancename._visable=false;


script did nothing? not sure what I did wrong there? But I figured a workaround, but only just,,

on scene 1, I have the "play button",and the actions for this are,
ActionScript:
on (release) {
        gotoAndPlay("Scene 1", 1);
        
}

Then I have a new layer on my Mclip timeline labelled button, which I have a keyframe on frame 1,I also have the "play button" on this frame with same code as above. on frame 2 I added a blank keyframe and this then I found removes the button so it is not on view, "which I wanted", and at end of my Mclip I inserted another keyframe and on this one I placed my "replay button". with the following actionscript,
ActionScript:
on (release) {
        _root.john.play();
        
}

/ which works the same as this
ActionScript:
on (release) {
        gotoAndPlay("Scene 1", 1);
}



So, what I got is a movieclip that plays when I click on the "play" button, and then the "play button" dissapears from view as the movieclip plays out it's frames, then on the last frame of the movie a new button,"replay?" appears. all good so far...

But what the "replay?" button does, is take me back to frame 1 where I am presented with the "play ?" button.
I'm not sure how to get the replay button to, "when clicked", play the movie without seening the "play button". Anyone got any ideas?

ModAdd: Please use AS-tags to embrace your code



Report this post to a moderator | IP: Logged

Old Post 01-26-2006 08:10 PM
freakout is offline Click Here to See the Profile for freakout Click here to Send freakout a Private Message Find more posts by freakout Add freakout to your buddy list Edit/Delete Message Reply w/Quote
ShapeShifter
<- [Staff Member] -> this.brainCells++;

Registered: Apr 2005
Local time: 06:04 AM
Location: Sweden
Posts: 2344

Post #8

use _root.john.gotoAndPlay(2) instead.. this would move the playhead to the second frame (after the play-button) and play the animation to the end (where your replay button is)..

I would reccomend to you to get rid of the scenes.. scenes are BAD.. they are a plague.. search this forum for "bad scenes" and you will get a LOT of threads where we explain why they are so bad

__________________
>[ Rate Me 5! ]< >[ Rate Me 4! ]< >[ Rate Me 3! ]<
One who makes no mistakes never makes anything.



Report this post to a moderator | IP: Logged

Old Post 01-26-2006 08:29 PM
ShapeShifter is offline Click Here to See the Profile for ShapeShifter Click here to Send ShapeShifter a Private Message Click Here to Email ShapeShifter Visit ShapeShifter's homepage! Find more posts by ShapeShifter Add ShapeShifter to your buddy list Edit/Delete Message Reply w/Quote
freakout
Little Devil

Registered: Jan 2006
Local time: 05:04 AM
Location:
Posts: 14

Post #9

Thanks ShapeShifter, but I tried that and it didn't work, ? I also used (5) and so on, but it still takes me back to the start of movie? where the "play" button is. OH, there is only one Scene 1 no others, just the default one? I'll keep trying... BTW, love that little character you have within your texts, ha ha, I haven't reached that stage yet!
Also what does the moderator mean by....AS-tags?



Report this post to a moderator | IP: Logged

Old Post 01-26-2006 08:47 PM
freakout is offline Click Here to See the Profile for freakout Click here to Send freakout a Private Message Find more posts by freakout Add freakout to your buddy list Edit/Delete Message Reply w/Quote
ShapeShifter
<- [Staff Member] -> this.brainCells++;

Registered: Apr 2005
Local time: 06:04 AM
Location: Sweden
Posts: 2344

Post #10

hm.. can you zip up the file and post it here?

sorry 'bout that short add.. I usually write these short attention-messages but never think of that one might not know what it is.. check the picture you should use AS-tags to embrace your code-snippets.. this way the code's readability improves a lot.. I fixed your last post - you can see how it looks now

haha.. I found that gif in my Temps and thought that it represents the best with programmig

ShapeShifter has attached this image:

__________________
>[ Rate Me 5! ]< >[ Rate Me 4! ]< >[ Rate Me 3! ]<
One who makes no mistakes never makes anything.



Report this post to a moderator | IP: Logged

Old Post 01-27-2006 01:21 PM
ShapeShifter is offline Click Here to See the Profile for ShapeShifter Click here to Send ShapeShifter a Private Message Click Here to Email ShapeShifter Visit ShapeShifter's homepage! Find more posts by ShapeShifter Add ShapeShifter to your buddy list Edit/Delete Message Reply w/Quote
freakout
Little Devil

Registered: Jan 2006
Local time: 05:04 AM
Location:
Posts: 14

For ShapeShifterPost #11

Sorry late reply, bin busy. Here it is zipped for you to try work out, I appreciate your involvment. It is nothing special the movie clip, just a test of how to use a play and play again button. Thanks for taking a look.



Report this post to a moderator | IP: Logged

Old Post 01-27-2006 07:33 PM
freakout is offline Click Here to See the Profile for freakout Click here to Send freakout a Private Message Find more posts by freakout Add freakout to your buddy list Edit/Delete Message Reply w/Quote
freakout
Little Devil

Registered: Jan 2006
Local time: 05:04 AM
Location:
Posts: 14

Post #12

I just noticed it didn't attach? I used winrar,, so will send again when i've downloaded Winzip. And try using that. Cheers.



Report this post to a moderator | IP: Logged

Old Post 01-27-2006 07:37 PM
freakout is offline Click Here to See the Profile for freakout Click here to Send freakout a Private Message Find more posts by freakout Add freakout to your buddy list Edit/Delete Message Reply w/Quote
freakout
Little Devil

Registered: Jan 2006
Local time: 05:04 AM
Location:
Posts: 14

Post #13

Here is the zip file ,, I hope, I used WinZip 10 this time.

Attachment: johntest.zip
This has been downloaded 425 time(s).



Report this post to a moderator | IP: Logged

Old Post 01-27-2006 07:44 PM
freakout is offline Click Here to See the Profile for freakout Click here to Send freakout a Private Message Find more posts by freakout Add freakout to your buddy list Edit/Delete Message Reply w/Quote
freakout
Little Devil

Registered: Jan 2006
Local time: 05:04 AM
Location:
Posts: 14

AT lLAST.Post #14

Finally figured it out, phew! Thanks all for your help, great forum this.
Here is the zip file with finished movie.

Attachment: new john2.zip
This has been downloaded 839 time(s).

Last edited by freakout on 01-27-2006 at 08:41 PM


Report this post to a moderator | IP: Logged

Old Post 01-27-2006 08:20 PM
freakout is offline Click Here to See the Profile for freakout Click here to Send freakout a Private Message Find more posts by freakout Add freakout to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 05:04 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
Advertising
Show Printable Version | Email this Page | Unsubscribe from this thread | Download thread

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

< FlashDevils - Terms of use >

Copyright, FlashDevils Community, 2002 -
Flash Archive

Links
Books