STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228156
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2561 · P5122

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/96623989?noj=FRM96623989-21DC" width="1" height="1"></div>

Music Control Tutorial.swf

This is the info page for
Flash #66751

(Click the ID number above for more basic data on this flash file.)


Text
3

2

1

The Flash
Sound Control
Panel Tutorial
By Ash4792

In this tutorial, I will show you how
to create a simple yet effective
sound control panel with several
songs, similar to the one below.
You will be able to customize your
buttons and songs as you wish.

First of all, you need to draw
your button. I just used the
oval tool to draw a circle with
the settings that you can see
in the panel on the right.
Draw your button onto the
frame.
Tip: if you hold down shift while
drawing an oval, it will keep the
shape in a perfect circle.

Now you need to convert  your
drawing to a more manageable
shape. To do this, highlight all of
your shape and press f8, select
graphic behavior and call it
'Control_Shape' and then click
on OK.

Next, you need to copy and
paste your 'Control_Shape'
depending on how many songs
you have plus one extra button
for the stop button. For
example, I had three songs so I
needed four buttons.

Now label your buttons
accordingly, with a number for
each song and a simple square
or a mute symbol for your stop
button. You need to convert
your stop/mute symbol to a
graphic as you did with your
'Control_Shape'.

Now, select your first
'Control_Shape' and the number
on top of it (hold shift to select
multiple items) and then press
f8 to convert them both into one
symbol. Select button behaviour
and call it 'Sound_Control#'
where # is the same as the
number or symbol on the button.

Do this for each of your control
buttons. When you get to the
stop/mute button, use the
same settings but call it
'Sound_Control_Stop'.

Now you need to get your
buttons to actually play the
audio when you press them.
First of all, you need to import
your songs to the library. Go to
File, Import, Import to library, as
it shows below.

Then, find your music files and
click open. The files will then
appear in your library. If your
library is not open, press Ctrl +
L to open it up.

Now, right click on the song in
your library and go to
properties. If there is a button
showing at the bottom right
that says 'advanced' click on it.
Now apply the settings below.

Call each song 'Song1', 'Song2'
and so on, depending on which
button you want them to apply
to. So 'Song1' will apply to
button 1. Most full length songs
have a large file size so bear
that in mind when submitting to
Newgrounds, where the file size
for flash is limited to 10Mb.

Now select your first button and
press f9 to open the actions
panel and enter this code;
on (release) {
stopAllSounds();
bgmusic = new Sound(this);
bgmusic.attachSound("Song1");
bgmusic.start(0, 9999);
}
Change the number in the
"Song1" part in line 4 to the
number on the button.

So, that code basically just
means that when the button
gets pressed, it will stop all
other sounds and play "Song#"
where # is the number found in
the instance name of the song
and it will loop that song 9999
times. Which means that it
should play enough times to last
throughout your movie or game.

The code for the stop button is
simple, select the button, press
f9 to open the actions panel and
enter this code;
on (release) {
stopAllSounds();
}
This code just means that when
the button is pressed, it will stop
whichever song is playing.

Now, click on the frame with
your buttons on it and press f9
to open the actions panel. Add
this code to make the movie
stay on that frame;
stop();
Now press Ctrl + enter and test
your buttons to see if they do
what they're supposed to.

Your buttons now play music
when they're pressed. If you
want a song to play
automatically when the frame
loads, open up the frame actions
again by selecting the frame and
hitting f9 and then add the code
(which is on the next page) after
the stop code. The code will play
a random song from your library.

x = random(3)+1;
bgmusic = new Sound(this);
bgmusic.attachSound("Song"+x);
bgmusic.start(0, 9999);
You need to change the number
in brackets on the first line "(3)"
in this case to however many
songs you want to use. If you
don't want to play a random
song, then follow the
instructions on the next page.

To play a specific song rather
than a random song, simply
replace the first line with this;
x = #
Where # is a number, depending
on which song you want to play
(match the number in the script
with the number in the instance
name of the song you want to
play automatically.

So there you have it, your sound
control panel is complete and all
your buttons should be working
perfectly. If you are still having
problems, then PM me on
Newgrounds, I'll be more than
happy to help.

Restart

Special thanks to Matt Steele,
or 'Streetproject' as he's known
here on Newgrounds for
providing the actionscript and
instructions. I made this
because I had alot of problems
creating a sound panel myself
(for Hippie Pong 3) until Matt
helped me out. Thanks Matt!

ActionScript [AS1/AS2]

Frame 1
Mouse.hide(); startDrag (NewCursor, true);
Frame 2
Mouse.hide(); startDrag (NewCursor, true); x = random(3) + 1; bgmusic = new Sound(this); bgmusic.attachSound("Song" + x); bgmusic.start(0, 9999);
Frame 3
stop(); Mouse.hide(); startDrag (NewCursor, true);
Frame 4
Mouse.hide(); startDrag (NewCursor, true); stop();
Frame 5
stop();
Frame 6
stop();
Frame 7
stop();
Frame 8
stop();
Frame 9
stop();
Frame 10
stop();
Frame 11
stop();
Frame 12
stop();
Frame 13
stop();
Frame 14
stop();
Frame 15
stop();
Frame 16
stop();
Frame 17
stop();
Frame 18
stop();
Frame 19
stop();
Frame 20
stop();
Frame 21
stop();
Frame 22
stop(); Mouse.hide(); startDrag (NewCursor, true);
Frame 23
stop();
Symbol 48 Button
on (release) { getURL ("http://www.newgrounds.com", "_blank"); }
Symbol 50 MovieClip Frame 40
stop();
Symbol 76 Button
on (release) { _root.play(); }
Symbol 77 MovieClip Frame 1
function onEnterFrame() { if (!loaded) { var _local3 = _root.getBytesLoaded() / _root.getBytesTotal(); if (_local3 >= 1) { play(); bar._x = initX; loaded = true; } else { bar._x = initX + ((_local3 - 1) * bar._width); } } var _local4 = getTimer() - time; timeAccum = timeAccum + _local4; while (timeAccum >= FRAME_TIME) { var _local2 = 0; while (_local2 < timeClips.length) { if (timeClips[_local2]._currentframe < timeClips[_local2]._totalframes) { timeClips[_local2].nextFrame(); } else { timeClips[_local2].gotoAndStop(1); } _local2++; } if (loaded && (_currentframe < _totalframes)) { nextFrame(); } timeAccum = timeAccum - FRAME_TIME; } time = time + _local4; } stop(); _root.stop(); var initX = bar._x; var time = getTimer(); var FRAME_TIME = 33.3333333333333; var timeAccum = 0; var loaded = false; timeClips = [bargfx, tank.mc0, tank.mc1, tank.mc2, tank.mc3, tank.mc4, tank.mc4.mc0, tank.mc4.mc1, tank.mc4.mc0.mc0, tank.mc4.mc0.mc0.mc0.mc0, tank.mc4.mc0.mc0.mc0.mc1, tank.mc4.mc0.mc0.mc0.mc2, tank.mc4.mc0.mc0.mc0.mc3, tank.mc4.mc0.mc0.mc1, tank.mc4.mc0.mc0.mc2, tank.mc5.mc0]; var i = 0; while (i < timeClips.length) { timeClips[i].stop(); i++; }
Symbol 77 MovieClip Frame 51
Symbol 83 Button
on (release) { stopAllSounds(); }
Symbol 86 Button
on (release) { stopAllSounds(); bgmusic = new Sound(this); bgmusic.attachSound("Song3"); bgmusic.start(0, 9999); }
Symbol 88 Button
on (release) { stopAllSounds(); bgmusic = new Sound(this); bgmusic.attachSound("Song2"); bgmusic.start(0, 9999); }
Symbol 90 Button
on (release) { stopAllSounds(); bgmusic = new Sound(this); bgmusic.attachSound("Song1"); bgmusic.start(0, 9999); }
Symbol 103 Button
on (release) { nextFrame(); }
Symbol 109 Button
on (release) { prevFrame(); }
Symbol 163 Button
on (release) { gotoAndPlay (3); }

Library Items

Symbol 1 Sound [Song1]
Symbol 2 Sound [Song2]
Symbol 3 Sound [Song3]
Symbol 4 GraphicUsed by:77
Symbol 5 GraphicUsed by:77
Symbol 6 GraphicUsed by:7
Symbol 7 MovieClipUses:6Used by:77
Symbol 8 GraphicUsed by:10
Symbol 9 GraphicUsed by:10
Symbol 10 MovieClipUses:8 9Used by:77
Symbol 11 GraphicUsed by:77
Symbol 12 GraphicUsed by:77
Symbol 13 GraphicUsed by:77
Symbol 14 GraphicUsed by:21 50
Symbol 15 GraphicUsed by:21 50
Symbol 16 GraphicUsed by:21 50
Symbol 17 GraphicUsed by:21 50
Symbol 18 GraphicUsed by:21 50
Symbol 19 GraphicUsed by:21 50
Symbol 20 GraphicUsed by:21 50
Symbol 21 MovieClipUses:14 15 16 17 18 19 20Used by:77
Symbol 22 GraphicUsed by:77
Symbol 23 GraphicUsed by:24
Symbol 24 MovieClipUses:23Used by:77
Symbol 25 GraphicUsed by:26
Symbol 26 MovieClipUses:25Used by:77
Symbol 27 GraphicUsed by:31
Symbol 28 GraphicUsed by:31
Symbol 29 GraphicUsed by:30
Symbol 30 MovieClipUses:29Used by:31 34
Symbol 31 MovieClipUses:27 28 30Used by:45
Symbol 32 GraphicUsed by:34
Symbol 33 GraphicUsed by:34
Symbol 34 MovieClipUses:32 33 30Used by:45
Symbol 35 GraphicUsed by:38
Symbol 36 GraphicUsed by:38 41
Symbol 37 GraphicUsed by:38
Symbol 38 MovieClipUses:35 36 37Used by:42
Symbol 39 GraphicUsed by:41
Symbol 40 GraphicUsed by:41
Symbol 41 MovieClipUses:39 36 40Used by:42
Symbol 42 MovieClipUses:38 41Used by:45
Symbol 43 GraphicUsed by:44
Symbol 44 MovieClipUses:43Used by:45
Symbol 45 MovieClipUses:31 34 42 44Used by:77
Symbol 46 GraphicUsed by:77
Symbol 47 GraphicUsed by:48 83
Symbol 48 ButtonUses:47Used by:77
Symbol 49 GraphicUsed by:50
Symbol 50 MovieClipUses:14 15 16 17 18 19 20 49Used by:77
Symbol 51 GraphicUsed by:77
Symbol 52 GraphicUsed by:77
Symbol 53 GraphicUsed by:77
Symbol 54 GraphicUsed by:77
Symbol 55 GraphicUsed by:77
Symbol 56 GraphicUsed by:77
Symbol 57 GraphicUsed by:77
Symbol 58 GraphicUsed by:77
Symbol 59 GraphicUsed by:77
Symbol 60 GraphicUsed by:77
Symbol 61 GraphicUsed by:77
Symbol 62 GraphicUsed by:77
Symbol 63 ShapeTweeningUsed by:77
Symbol 64 GraphicUsed by:77
Symbol 65 ShapeTweeningUsed by:77
Symbol 66 ShapeTweeningUsed by:77
Symbol 67 GraphicUsed by:77
Symbol 68 GraphicUsed by:76
Symbol 69 GraphicUsed by:76
Symbol 70 GraphicUsed by:76
Symbol 71 GraphicUsed by:76
Symbol 72 GraphicUsed by:76
Symbol 73 GraphicUsed by:75
Symbol 74 GraphicUsed by:75
Symbol 75 MovieClipUses:73 74Used by:76
Symbol 76 ButtonUses:68 69 70 71 72 75Used by:77
Symbol 77 MovieClipUses:4 5 7 10 11 12 13 21 22 24 26 45 46 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 76Used by:Timeline
Symbol 78 GraphicUsed by:80
Symbol 79 GraphicUsed by:80
Symbol 80 MovieClipUses:78 79Used by:Timeline
Symbol 81 GraphicUsed by:82 83 86 88 90
Symbol 82 MovieClipUses:81Used by:83 86 88 90
Symbol 83 ButtonUses:82 47 81Used by:Timeline
Symbol 84 FontUsed by:85 87 89
Symbol 85 TextUses:84Used by:86
Symbol 86 ButtonUses:82 85 81Used by:Timeline
Symbol 87 TextUses:84Used by:88
Symbol 88 ButtonUses:82 87 81Used by:Timeline
Symbol 89 TextUses:84Used by:90
Symbol 90 ButtonUses:82 89 81Used by:Timeline
Symbol 91 GraphicUsed by:96
Symbol 92 GraphicUsed by:93 96 103 109
Symbol 93 MovieClipUses:92Used by:96 103 109  Timeline
Symbol 94 GraphicUsed by:96
Symbol 95 SoundUsed by:96
Symbol 96 ButtonUses:91 93 94 92 95Used by:Timeline
Symbol 97 FontUsed by:98
Symbol 98 TextUses:97Used by:Timeline
Symbol 99 GraphicUsed by:103
Symbol 100 GraphicUsed by:103
Symbol 101 GraphicUsed by:103
Symbol 102 SoundUsed by:103 109 163
Symbol 103 ButtonUses:99 93 100 101 92 102Used by:Timeline
Symbol 104 FontUsed by:105 110 117 121 125 126 133 137 141 142 149 151 152 154 155 156 157 158 159 162 164
Symbol 105 TextUses:104Used by:Timeline
Symbol 106 GraphicUsed by:109
Symbol 107 GraphicUsed by:109
Symbol 108 GraphicUsed by:109
Symbol 109 ButtonUses:106 93 107 108 92 102Used by:Timeline
Symbol 110 TextUses:104Used by:Timeline
Symbol 111 BitmapUsed by:112
Symbol 112 GraphicUses:111Used by:113
Symbol 113 MovieClipUses:112Used by:Timeline
Symbol 114 BitmapUsed by:115
Symbol 115 GraphicUses:114Used by:116
Symbol 116 MovieClipUses:115Used by:Timeline
Symbol 117 TextUses:104Used by:Timeline
Symbol 118 BitmapUsed by:119
Symbol 119 GraphicUses:118Used by:120
Symbol 120 MovieClipUses:119Used by:Timeline
Symbol 121 TextUses:104Used by:Timeline
Symbol 122 BitmapUsed by:123
Symbol 123 GraphicUses:122Used by:124
Symbol 124 MovieClipUses:123Used by:Timeline
Symbol 125 TextUses:104Used by:Timeline
Symbol 126 TextUses:104Used by:Timeline
Symbol 127 BitmapUsed by:128
Symbol 128 GraphicUses:127Used by:129
Symbol 129 MovieClipUses:128Used by:Timeline
Symbol 130 BitmapUsed by:131
Symbol 131 GraphicUses:130Used by:132
Symbol 132 MovieClipUses:131Used by:Timeline
Symbol 133 TextUses:104Used by:Timeline
Symbol 134 BitmapUsed by:135
Symbol 135 GraphicUses:134Used by:136
Symbol 136 MovieClipUses:135Used by:Timeline
Symbol 137 TextUses:104Used by:Timeline
Symbol 138 BitmapUsed by:139
Symbol 139 GraphicUses:138Used by:140
Symbol 140 MovieClipUses:139Used by:Timeline
Symbol 141 TextUses:104Used by:Timeline
Symbol 142 TextUses:104Used by:Timeline
Symbol 143 BitmapUsed by:144
Symbol 144 GraphicUses:143Used by:145
Symbol 145 MovieClipUses:144Used by:Timeline
Symbol 146 BitmapUsed by:147
Symbol 147 GraphicUses:146Used by:148
Symbol 148 MovieClipUses:147Used by:Timeline
Symbol 149 TextUses:104Used by:Timeline
Symbol 150 FontUsed by:151 154 155 157 158
Symbol 151 TextUses:104 150Used by:Timeline
Symbol 152 TextUses:104Used by:Timeline
Symbol 153 Font
Symbol 154 TextUses:104 150Used by:Timeline
Symbol 155 TextUses:104 150Used by:Timeline
Symbol 156 TextUses:104Used by:Timeline
Symbol 157 TextUses:150 104Used by:Timeline
Symbol 158 TextUses:104 150Used by:Timeline
Symbol 159 TextUses:104Used by:Timeline
Symbol 160 GraphicUsed by:161 163
Symbol 161 MovieClipUses:160Used by:163
Symbol 162 TextUses:104Used by:163
Symbol 163 ButtonUses:161 162 160 102Used by:Timeline
Symbol 164 TextUses:104Used by:Timeline

Instance Names

"NewCursor"Frame 1Symbol 80 MovieClip
"bar"Symbol 77 MovieClip Frame 1Symbol 7 MovieClip
"bargfx"Symbol 77 MovieClip Frame 1Symbol 10 MovieClip
"tank"Symbol 77 MovieClip Frame 1Symbol 24 MovieClip
"bargfx"Symbol 77 MovieClip Frame 2Symbol 10 MovieClip
"bargfx"Symbol 77 MovieClip Frame 20Symbol 10 MovieClip

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS1/AS2.
ExportAssets (56)Timeline Frame 1Symbol 1 as "Song1"
ExportAssets (56)Timeline Frame 1Symbol 2 as "Song2"
ExportAssets (56)Timeline Frame 1Symbol 3 as "Song3"

Labels

"LOAD"Symbol 77 MovieClip Frame 1
"COMPLETE_STOP"Symbol 77 MovieClip Frame 2




http://swfchan.com/14/66751/info.shtml
Created: 11/4 -2019 21:08:34 Last modified: 11/4 -2019 21:08:34 Server time: 21/05 -2024 02:39:15