Hi All,
I am using buttons to control which of a range of sounds play at particular frames in a looping timeline.
I have been putting code into the frames like this:
babyGControl = babyG.play(0,0,babyGsomeTransform);
babyAControl = babyA.play(0,0,babyAsomeTransform);
babyCControl = babyC.play(0,0,babyCsomeTransform);
babyDControl = babyD.play(0,0,babyDsomeTransform);
babyEControl = babyE.play(0,0,babyEsomeTransform);
glockG3Control = glockG3.play(0,0,glockA3someTransform);
glockA3Control = glockA3.play(0,0,glockA3someTransform);
glockC3Control = glockC3.play(0,0,glockC3someTransform);
glockD3Control = glockD3.play(0,0,glockD3someTransform);
glockE3Control = glockE3.play(0,0,glockE3someTransform);
and then using buttons to turn the volume of the sounds the user has chosen to 1 and leaving the unchosen sounds at 0 using
soundTransform. Eg One button if clicked sets
babyAsomeTransform and
glockA3someTransform to 1 so the babyA and the glockA3 sounds are heard.
This kind of works but some of the sounds (generally the ones lower down the list) don't play every time they should.
If I have the 'baby' group at the top (as above) the Baby sound chosen will always play but if the user the chooses the lower glock sound in the list (eg glockE3Control ..) it will only play the first time and then only occassionally after.
If I reorder the code it changes which sounds don't play.
I am guessing flash is playing the sounds higher in the list at 0 volume and running out of bandwidth to play the lower sound that is meant to be audible.
So I am thinking I should be able to have only one baby and one glock command in the frame and let the user decide which sound the commands are going to play.
So I made a variable and used that in the name of the soundControl and soundTransform objects eg:
var babyGlockplay:String = new String();
babyGlockplay = "glockD3Control=glockD3.play(0,0,glockD3someTr ansf orm);";
and put
babyGlockplay(); into the frame. But that didn't work.
I tried:
var babyGlockplay:String = new String();
babyGlockplay = "glockD3";
and put
babyGlockplayControl=babyGlockplay.play(0,0,babyGl ockplaysomeTransform);
into the frame. Doesn;t work.
I tried:
var babyGlockplay:String = new String();
babyGlockplay = "glockD3";
and put
[babyGlockplay]Control=[babyGlockplay].play(0,0,b[babyGlockplay]someTransform);
into the frame and that didnt work either.
How can I simplify code so that instead of having loads of options some of which are played at volume = 0, I can just have one or two lines of code that lets me play the sound the user has chosen. How can I set a variable and then place it in a line of code so it changes which soundControl or soundTransform objects are being called?
best
tommybanana
PS I hope that makes some kind of sense.....