Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-30-2004, 06:53 AM   #1
whiteybags
Registered User
 
Join Date: May 2004
Posts: 14
Default drag & drop audio - slight problem :)

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;
}


}
whiteybags is offline   Reply With Quote
Old 05-30-2004, 10:12 AM   #2
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579
Default

attached file might help but you may also need to upload your file

cheers
Attached Files
File Type: zip drag_replace.fla.zip (3.5 KB, 493 views)
__________________
Billy
Online Galleries
iPhone Safety App - iStaySafe
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote
Old 05-30-2004, 03:17 PM   #3
whiteybags
Registered User
 
Join Date: May 2004
Posts: 14
Default

I have the file I'm working on posted at

http://mediapack.7host.com/soundfile.html.
It is over 6MB so be warned!
whiteybags is offline   Reply With Quote
Old 05-30-2004, 07:24 PM   #4
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579
Default

did the file I uploaded help?
__________________
Billy
Online Galleries
iPhone Safety App - iStaySafe
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote
Old 05-31-2004, 07:40 AM   #5
whiteybags
Registered User
 
Join Date: May 2004
Posts: 14
Default

I have the drag & drop working with for clips the same way you have.

The problem that I have is that I want to have 6 original clips with only four target areas. I want the user to pick four out of the six clips to put into the target area.

When the clips are placed on the target areas sound is slotted into the corresponding element of an array and then the array can be played back by the user.
whiteybags is offline   Reply With Quote
Old 05-31-2004, 09:56 AM   #6
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579
Default

try tracing the droptarget

you might be dropping teh last 2 on to an already dragged clip
__________________
Billy
Online Galleries
iPhone Safety App - iStaySafe
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote
Old 05-31-2004, 02:39 PM   #7
whiteybags
Registered User
 
Join Date: May 2004
Posts: 14
Default

i got it working eventually. thanks for your help. I had just forgotten to give the last two clips their instant names. Something small & stupid! Thanks
whiteybags is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:50 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.