Alright, where you have //Hold playhead here stop();
//Declare global variable for tracking the number of sounds currently playing _global.soundsPlaying = 0; //Create function to load in random sound file onRollOver this.onRollOver = function() { //Check to see if soundsPlaying is less than specified limit if (_global.soundsPlaying < 6) { //Define variable for random sound file number soundNumber = Math.round(Math.random()*7)+1; var soundFile:Sound = new Sound(); soundFile.loadSound("sounds_library/conflict_"+soundNumber+".mp3", true); soundFile.onLoad = function(success:Boolean):Void { if (success) { soundFile.start(); } }; //Increment soundsPlaying variable _global.soundsPlaying++; trace(soundsPlaying); //Decrement soundsPlaying variable when sound finishes soundFile.onSoundComplete = function(){ _global.soundsPlaying--; trace(soundsPlaying); }; } //Define function to load a new random image onRelease frameNumber = Math.round(Math.random()*3)+1; maskBox.gotoAndPlay("tran"+frameNumber); }; replace it with this: //Hold playhead here stop(); var soundsNowPlaying:Array = new Array(); _global.counterJ = 0; //Declare global variable for tracking the number of sounds currently playing _global.soundsPlaying = 0; //Create function to load in random sound file onRollOver this.onRollOver = function() { //Check to see if soundsPlaying is less than specified limit if (_global.soundsPlaying < 10) { //Define variable for random sound file number soundNumber = Math.round(Math.random()*7)+1; soundsNowPlaying[counter] = new Sound(); soundsNowPlaying[counter].loadSound("sounds_library/conflict_"+soundNumber+".mp3", true); soundsNowPlaying[counter].onLoad = function(success:Boolean):Void { if (success) { this.start(); } } //Increment soundsPlaying variable _global.soundsPlaying++; //trace(soundsPlaying); //Decrement soundsPlaying variable when sound finishes soundsNowPlaying[counter].onSoundComplete = function(){ _global.soundsPlaying--; delete this; }; _global.counterJ++; trace(_global.counterJ); } //Define function to load a new random image onRelease frameNumber = Math.round(Math.random()*3)+1; maskBox.gotoAndPlay("tran"+frameNumber); } and tell me if that helps out. If yes I'll explain whats happening and if no, then I'll try and find something else. On 3/26/07, Ryan Burrell < [EMAIL PROTECTED]> wrote:
Can you give me a more specific example of how to go about setting up the array and pulling sounds from it? I've worked with arrays before, but not extensively. I'm just unsure of the syntax. On 3/26/07, Jason Cordial <[EMAIL PROTECTED] > wrote: > > I tried the online version, and I saw your problem. > > Off the top of my head, declare an array for all the different sounds. > Like > > var soundsNowPlaying:Array = new Array(); > > keep setting sounds like > > soundsNowPlaying[soundsNowPlaying.length+1] = new Sound blah blah.... > > I think the problem might be that you're overwriting the sound every time > the next one starts playing, which causes the problem. > > > > On 3/26/07, Ryan Burrell <[EMAIL PROTECTED]> wrote: > > > > Thank you for your help. I have several other options that I am going > to > > try out to see if I can get something working, but anything that anyone > > may > > happen to notice or suggest on this is appreciated. I work tech support > > for > > a living and the worst type of problem to fix is one that is > > sporadic...just > > like this one. > > > > On 3/26/07, Jason Cordial <[EMAIL PROTECTED]> wrote: > > > > > > First suggestion, keep all your actionscript on one frame. Searching > > > through > > > everything is making it a real pain to debug. I'm looking at it right > > now, > > > if I find anything I'll let you know. > > > > > > On 3/26/07, Ryan Burrell < [EMAIL PROTECTED]> wrote: > > > > > > > > Hello all, > > > > > > > > I am experiencing an issue with some streaming sounds that I pull > in. > > I > > > > have > > > > an example up here: > > > http://www.humanussonus.org/flash/co.../conflict.html . > > > > Basically, the problem is that after rolling over these images > (which > > > then > > > > dynamically stream in a random sound) the sounds will cutoff mid-go. > > > This > > > > appears to be entirely at random as well, so I've been having a hard > > > time > > > > troubleshooting it. I have the source file and needed sounds > available > > > > here: > > > > http://www.humanussonus.org/flash/conflict/conflict.zip. > > > > > > > > Any ideas that anyone has are more than welcome. I've tried several > > > > different approaches, including putting a control in to only allow a > > > > certain > > > > number of sounds to be playing at any one time. I have been unable > to > > > find > > > > mention of this sort of problem through my searches; I'm wondering > if > > my > > > > approach needs to be re-evaluated as to how I am pulling in these > > random > > > > sounds dynamically. > > > > > > > > In this particular file (I have others I am working on) the cutoff > > > > normally > > > > occurs when multiple sounds are playing at the same time. According > to > > > my > > > > research, Flash is *supposed* to be able to have 32 channels of > sound > > in > > > > FP > > > > 8 & 9. However, the cutoff does not occur when hitting the 32 sound > > mark > > > > (or > > > > even 16, not certain if it tracks stereo as dual-channel or not). > > > > > > > > To complicate things more, I have put in code to limit the > > simultaneous > > > > sounds to 6 at any given time (this code is commented out in the > > version > > > I > > > > have up on the web; it is in the source file however). I figured > that > > > this > > > > would fix the issue, but the problem still occurs if you get > multiple > > > > streaming sounds going at the same time....*and* it still doesn't > > happen > > > > consistently. > > > > > > > > Are there other methods to load sound in dynamically from a source > > > > directory > > > > without using Media Server? Perhaps storing things in an array? (why > > > this > > > > would matter I don't know). I'd prefer to get my current setup > > working > > > as > > > > it is easy to add more sound files to and very low in size. > > > > > > > > Thank you in advance for any help. > > > > RB > > > > _______________________________________________ > > > > Flashcoders@chattyfig.figleaf.com > > > > To change your subscription options or search the archive: > > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > > > Brought to you by Fig Leaf Software > > > > Premier Authorized Adobe Consulting and Training > > > > http://www.figleaf.com > > > > http://training.figleaf.com > > > > > > > > > > > > > > > > -- > > > Jason Cordial > > > VIA 2 Lab Grunt - Waist deep beneath the borderline... > > > Life is a euhemerism... > > > http://bsu.edu/blogcaster2/jason/ > > > _______________________________________________ > > > Flashcoders@chattyfig.figleaf.com > > > To change your subscription options or search the archive: > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > Brought to you by Fig Leaf Software > > > Premier Authorized Adobe Consulting and Training > > > http://www.figleaf.com > > > http://training.figleaf.com > > > > > _______________________________________________ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://www.figleaf.com > > http://training.figleaf.com > > > > > > -- > Jason Cordial > VIA 2 Lab Grunt - Waist deep beneath the borderline... > Life is a euhemerism... > http://bsu.edu/blogcaster2/jason/ > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
-- Jason Cordial VIA 2 Lab Grunt - Waist deep beneath the borderline... Life is a euhemerism... http://bsu.edu/blogcaster2/jason/ _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com