Tentukan layer yang akan digunakan untuk menempatkan Background dan Label-label lainnya, untuk tombol, serta layer untuk script action yang akan digunakan. Seperti pada gambar dibawah ini.
Ada beberapa tumbol/button yang akan digunakan untuk membuat sound player atau sond control, diantaranya Play, Stop, Volume Level, Balance, serta beberapa tombol lain untuk fungsi lainnya.
Import juga beberapa file music kedalam library lalu lakukan Linkage untuk menghubungkan tombol music dengan music yang akan diputar. Seperti gambar dibawah ini.


Selanjutnya atur tata letak tombol-tombol, text-text, dan segala atribut yang akan digunakan sesuai dengan layernya masing-masing, pada gambar dibawah ini seluruh tombol diletakan pada layer tombol, dan text-text dan sebagainya diletakakan pada layer background.

Setelah semua atribut di atur, maka selanjutnya memasukan action script pada tombol-tombol dan layer pada sound control
Layer Action
mySound = new Sound();
Tombol Play
on (release)
{
mySound.stop();
mySound.start();}
Tombol Stop
on (release)
{mySound.stop();}
Volume
Double click pada tombol volume lalu ketikan script pada layer 4
top = vol._y;
left = vol._x;
right = vol._x;
bottom = vol._y+100;
level = 100;
//
vol.onPress = function() {
startDrag("vol", false, left, top, right, bottom);
dragging = true;
};
vol.onRelease = function() {
stopDrag();
dragging = false;
};
vol.onReleaseOutside = function() {
dragging = false;
};
//
this.onEnterFrame = function() {
if (dragging) {
level = 100-(vol._y-top);
} else {
if (level>100) {
level = 100;
} else if (level<0)>
level = 0;
} else {
vol._y = -level+100+top;
}
}
_root.mySound.setVolume(level);
};
Balance
Double click pada tombol Balance lalu ketikan script berikut pada layer 4
increment = 4;
level = 0;
//
panKnob.onPress = function() {
if (Key.isDown(Key.getCode(18))) {
autoPan = true;
} else {
autoPan = false;
start = _root._xmouse;
newStart = panKnob._rotation;
dragging = true;
}
};
panKnob.onRelease = function() {
dragging = false;
};
panKnob.onReleaseOutside = function() {
dragging = false;
};
//
this.onEnterFrame = function() {
if (dragging) {
pivot = (_root._xmouse-start)*2+newStart;
panKnob._rotation = pivot;
if (pivot<-135) {
panKnob._rotation = -135;
}
if (pivot>135) {
panKnob._rotation = 135;
}
level = Math.round(panKnob._rotation/1.35);
} else {
if (autoPan) {
textInput.value.selectable = false;
level += increment;
if (level>99 || level<-99) {
increment *= -1;
}
} else {
textInput.value.selectable = true;
}
if (level>100) {
level = 100;
} else if (level<-100) {
level = -100;
} else if (level<=100 && level>=-100) {
panKnob._rotation = level*1.35;
}
}
_root.mySound.setPan(level);
};
Tombol Pilihan Musik
on (release) { mySound.attachSound("musik1"); <= “musik2” pada tombol kedua, dan seterusnya.
mySound.stop();
mySound.start(0,1);
}
Lakukan test movie, jika semua tombol telah berfungsi dengan benar maka, sound control siap dijalankan.





Tidak ada komentar:
Posting Komentar