Skip to main content
dstx
Inspiring
December 29, 2008
Answered

Flash movie control buttons

  • December 29, 2008
  • 24 replies
  • 3048 views
In Flash 8, I want to add a set of buttons from button library to bottom left of my movie
(begin, stop, pause, play, end) that are visible entire duration of movie.
What is best way to create such action? With event handlers?
Do I put each button on a separate layer and add frames from beginning to end of movie ?
Or can all buttons be on same layer?
And how do I find/write actionscript code that will control entire movie from any frame for each action: go to beginning or end, stop, pause, or play?
This topic has been closed for replies.
Correct answer clbeech
dstx - you're welcome :)

nice kg - that's an efficient toggle setup!

just for fun, how about :D

pauseBtn.onRelease = function() {
(toggle = (toggle) ? false : true) ? stop() : play();
}

24 replies

kglad
Community Expert
Community Expert
December 31, 2008
you're welcome.
dstx
dstxAuthor
Inspiring
December 31, 2008
Length of my timeline was established to correspond to lenght of sound file.

I reselected sound on Controls (or Actions) layer,
then added the following to first line of actionscript code:

// Stops the playhead at Frame 1.
stop()

Seems to work fine. Thanks.
dstx
dstxAuthor
Inspiring
December 31, 2008
Length of my timeline was established to correspond to lenght of sound file.

I reselected sound on Controls (or Actions) layer,
then added the following to first line of actionscript code:

// Stops the playhead at Frame 1.
stop()

Seems to work fine.
kglad
Community Expert
Community Expert
December 31, 2008
if you did that correctly you would see a wavy line in the sound layer that extends from frame 1 to the frame where the sound ends. if you see the wavy line, set your sound to stream.
dstx
dstxAuthor
Inspiring
December 31, 2008
Sound was selected in Properties of Control layer which has frames for full timeline.
Created new Soundtrack layer, deleted all frames and inserted frame on frame 1 only, then selected sound in Properties.

Movie doesn't autoplay which is fine.
However, when I press play button, video plays but I now get no sound at all.
kglad
Community Expert
Community Expert
December 31, 2008
there shouldn't be any keyframes (except frame 1) in the layer that contains your sound.
dstx
dstxAuthor
Inspiring
December 31, 2008
Why does play keep repeating if I have Properties - Sync set to Stream, Repeat 0?


clbeech
clbeechCorrect answer
Inspiring
December 31, 2008
dstx - you're welcome :)

nice kg - that's an efficient toggle setup!

just for fun, how about :D

pauseBtn.onRelease = function() {
(toggle = (toggle) ? false : true) ? stop() : play();
}
dstx
dstxAuthor
Inspiring
December 31, 2008
Found the mistake: failed to enter instance name for buttons so code didn't recognize them when pressed.

Thanks for the help.

A final question:
Is there any way to write code for "pause" function where pressOn1=stops, and pressOn2=play, etc.?
kglad
Community Expert
Community Expert
December 31, 2008
pause toggle:

clbeech
Inspiring
December 31, 2008
very good, you're getting there :)
did you assign 'instance names' to the control buttons?