Hi,
I'm working on a drag & drop audio timeline. 6 movie clips with 6 buttons within those movie clips. Then only four target areas that they can be dropped onto. The sounds associated with the movieclips are placed in an area of an array. The first four movie clips and the sounds work. The last two don't.
I'm trying to get the last two sounds to register on the target they are dropped on and play as part of the array.
Is it something to do with only having 4 free spaces in the array and there being 6 clips. That shouldn't matter right?
Any help or suggestions would be greatly appreciated!
Thanks
Here is the code on the 1st frame:
jingle1 = new Sound();
jingle1.attachSound("blank1");
jingle2 = new Sound();
jingle2.attachSound("blank1");
nosound = new sound ();
sound1 = new Sound();
sound1.attachSound ("person1");
sound2 = new Sound();
sound2.attachSound ("person2");
sound3 = new Sound();
sound3.attachSound ("person3");
sound4 = new Sound();
sound4.attachSound ("person4");
sound5 = new Sound();
sound5.attachSound ("person5");
sound6 = new Sound();
sound6.attachSound ("person6");
timeLine = new Array();
timeLine [0] = jingle1;
timeLine [1] = new Sound();
timeLine [2] = new Sound();
timeLine [3] = new Sound();
timeLine [4] = new Sound();
timeline [5]= jingle2;
function makeSequence () {
timeLine[0].onSoundComplete = function ()
{
trace ("fin " + 0 + " ");
timeLine [1].start();
}
timeLine[1].onSoundComplete = function ()
{
trace ("fin " +1 + " ");
timeLine [2].start();
}
timeLine[2].onSoundComplete = function ()
{
trace ("fin " + 2 + " ");
timeLine [3].start();
}
timeLine[3].onSoundComplete = function ()
{
trace ("fin " + 3 + " ");
timeLine [4].start();
}
timeLine[4].onSoundComplete = function ()
{
trace ("fin " + 4 + " ");
timeLine [5].start();
}
timeLine[5].onSoundComplete = function () {};
trace ("fin 5");
}
makeSequence();
//define a variable to store the currentSound
var currentSound = undefined;
function startSound (my_sound) {
trace ("in start sound");
//stop currentSound
currentSound.stop();
//store the new sound
currentSound = my_sound;
//play
currentSound.start();
}
stop();
On the play button:
on (release) {
startSound(timeLine[0]);
}
On the stop button:
on (release) {
stopAllSounds()
}
I have four target areas with instant names "target1" to "target4"
I have six dragable movie clips with instant names "soundMC1" to "soundMC6". Inside the movie clips are buttons with code:
on (press) {
this.startDrag ();
}
on (release) {
this.stopDrag();
if (_root.soundMC1._droptarget == "/target1") {
_root.timeLine[1] = _root.sound1;
_root.makeSequence();
//coordinates for target area 1
this._x=161.9;
this._y=190;
trace ("sound 1 in target 1");
}
else if (_root.soundMC1._droptarget == "/target2") {
_root.timeLine[2] = _root.sound1;
_root.makeSequence();
//coordinates for target area 2
this._x=216.9;
this._y=190;
trace ("sound 1 in target 2");
}
else if (_root.soundMC1._droptarget == "/target3") {
_root.timeLine[3] = _root.sound1;
_root.makeSequence();
//coordinates for target area 3
this._x=272.9;
this._y=190;
trace ("sound 1 in target 3");
}
else if (_root.soundMC1._droptarget == "/target4") {
_root.timeLine[4] = _root.sound1;
_root.makeSequence();
//coordinates for target area 4
this._x=328.9;
this._y=190;
trace ("sound 1 in target 4");
}
else {
//coordinates for original position for soundMC1
this._x=26;
this._y=15;
}
}
Same on the rest of the buttons. This is the code on button six:
on (press) {
this.startDrag ();
}
on (release) {
this.stopDrag();
if (_root.soundMC6._droptarget == "/target1") {
_root.timeLine[1] = _root.sound6;
_root.makeSequence();
this._x=161.9;
this._y=190;
trace ("sound 6 in target 1");
}
else if (_root.soundMC6._droptarget == "/target2") {
_root.timeLine[2] = _root.sound6;
_root.makeSequence();
this._x=216.9;
this._y=190;
trace ("sound 6 in target 2");
}
else if (_root.soundMC6._droptarget == "/target3") {
_root.timeLine[3] = _root.sound6;
_root.makeSequence();
this._x=272.9;
this._y=190;
trace ("sound 6 in target 3");
}
else if (_root.soundMC6._droptarget == "/target4") {
_root.timeLine[4] = _root.sound6;
_root.makeSequence();
this._x=328.9;
this._y=190;
trace ("sound 6 in target 4");
}
else {
this._x=476;
this._y=15;
}
}