Arrays :: Import Multiple Sounds In A For Each Loop, Actionscript 3

Mar 1, 2011

So im recreating my ear training program with more effective coding so i can add on to it. original i did.

//88 C8
var mp3Req88:URLRequest = new URLRequest("88.mp3");
var mp3_88:Sound = new Sound();
mp3_88.load(mp3Req88);

I basically got 88 sound files (each note of the piano) doing this code 88 times for each sound. with mathamatical equations made my ear training program.

Is there a simpler way to import these sounds in a loop of some sort so i dont have to do this 88x for the piano and however many times for the other instruments i will be including?

thus var i have tried things along the lines of below with failure

var i:int;
for (i = 0; i < 5; i++)
{
var pianoMP3Req+i:URLRequest=new URLRequest("piano/"i+"mp3");

[Code].....

View 1 Replies


Similar Posts:


ActionScript 2.0 :: 1 For Loop To Loop Multiple Arrays?

Aug 25, 2010

How do i word a for loop to make it loop through multiple arrays?I want 1 for loop to loop through multiple arrays in order to move/alter objects.I want to keep the arrays separate.

ActionScript Code:
characters = new Array();
characters[0] = male;

[code]........

View 3 Replies

ActionScript 2.0 :: Calling From Multiple Arrays In One Loop?

May 23, 2007

I have two arrays - one for movieclip buttons and one for images. The idea is - rollover a button and it loads it's respective image. I have a loop for the button array that pretty much loads each button and creates a rollover state for it. At the moment it just traces what button the mouse is over. The problem is trying to load the correct image based on that button. The way it is now - it will only load the same image for all the buttons.

Code:
tagPosition = 0;
viciousImgs = new Array("vaI1_mc", "vaI2_mc", "vaI3_mc", "vaI4_mc", "vaI5_mc");
viciousButs = new Array("va1_mc", "va2_mc", "va3_mc", "va4_mc", "va5_mc");
vicious = new Array("vicious_mc", "uTitle_mc", "uTxt_mc", "uButs_mc", viciousImgs, viciousButs);

[code]....

View 2 Replies

Arrays :: Fastest Way To Merge Multiple Arrays?

Sep 26, 2011

I'm trying to write a function where I can specify any amount of array, and the return value will be an array containing the contents of all of the specified arrays.I've done this, but it seems like a really slow and ugly way of doing it:

var ar1:Array = [1,2,3,4,5,6,7,8,9];
var ar2:Array = ['a','b','c','d','e','f','g','h'];
function merge(...multi):Array[code].....

Is there an inbuilt and more efficient / nice way of achieving this? The result does not need to be in the same order as the input - completely unsorted is fine.

View 3 Replies

ActionScript 3.0 :: Control Multiple Sounds In Multiple Timelines

Mar 10, 2009

Here's the setup:

-I have a music score that will be streamed in via actionscript

-I also have multiple short sounds (SFX) in multiple nested MCs

-these SFX sounds are customized using the ide edit interface, so it would be a pain to use actionscript to play each sound

What I need: To have 1 mute button for the music, and 1 mute button for the SFX, both on the root timeline.[code]...

View 7 Replies

Actionscript 3 :: Compare Two Different Arrays Using For Loop Within A For Loop

Nov 29, 2011

basically I need a loop within a loop to compare two different arrays in my actionscript3 lottery game. I have attempted the loop but I cannot seem to get it to work ...

[Code]....

So basically within this code check_win is a button. Once the button is clicked it runs the loop. It is meant to take an instance of matches which contains 6 properties and loop until index is greater than matches. According to my output this is happening but the second loop doesn't appear to do anything.

View 1 Replies

ActionScript 2.0 :: Setting Sounds To Loop

Mar 23, 2007

I'm planning to implement as sound that will simply play in the background of my site. The sound file is just under 30 seconds in length. Obviously I want this to loop ... can I set it to do so using ActionScript? If so, would you mind providing me with some sample code?

View 3 Replies

IDE :: Sounds Loop In Nested Movieclips?

Dec 9, 2010

We have found that if you skip over frames that include nested movieclips with embedded timeline sounds, those sounds loop endlessly.For example, if you gotoAndStop(20) from frame 2, but frames 5-10 have a CLIP A that embeds CLIP B, which has a timeline sound, you hear that sound over and over again (even though the playback head never touched the frames with that clip).Does anyone have a convenient workaround (other than the obvious -- playing sounds dynamically, etc). For animation-sync reasons we need to use timeline sounds in this particular case.

View 1 Replies

ActionScript 3.0 :: Multiple Arrays Containing Multiple Objects?

Oct 11, 2009

What's the best way to say:

if(this.object in same array as that.object)

with multiple arrays containing multiple objects?

View 2 Replies

ActionScript 2.0 :: Loop Sounds - Plays Once (5 Seconds Long) And Then Stops?

Oct 10, 2003

i have a soung loop that i want to "loop" in my movie.this is my script:

mySound = new Sound();
mySound.loadSound("loops/music.mp3",true);

the problem is that it only plays once (5 seconds long) and then stops, how do i get it to loop? - short of placing it on the timeline.

View 8 Replies

ActionScript 2.0 :: Loop Sounds - Only Plays Once (5 Seconds Long) And Then Stops

Oct 10, 2003

i have a soung loop that i want to "loop" in my movie. this is my script: mySound = new Sound(); mySound.loadSound("loops/music.mp3",true); the problem is that it only plays once (5 seconds long) and then stops, how do i get it to loop? - short of placing it on the timeline.

View 8 Replies

ActionScript 2.0 :: Function Conflict - Loop Sound Works But The Other Sounds Don't Play

May 5, 2004

How can I change the following so it won't conflict with sounds inserted manually in keyframes. Currently when this function is active, the loop sound works but the other sounds don't play..

[Code]...

View 13 Replies

Actionscript 3.0 :: 2D Arrays In A Loop

Apr 18, 2009

I need to assing two dimensional with random numbers so i just try to do it in a loop, but it can not be done the way I show You below.[code]trying to run that code I just get an error...

View 1 Replies

Sound: Set Different Volumes For 2 Or Multiple Sounds?

Jan 19, 2003

Iam searching vor solution so adjust different volumes for multiple sounds. That means:

Sound1 Volume 100
Sound2 Volume 20

I have tried that with the following script:

DayNature = new Sound();
DayNature.attachSound("Day_Nature01");
DayNature.setVolume(100);

[Code].....

View 4 Replies

ActionScript 3.0 :: How To Play Multiple Sounds

Aug 5, 2010

I am making a slide show, for every image i want sound on it. For example if it the "Tiger" in the image, it says "Tiger". I have all the voice in .wav format.
 
Right now my slide show is xml based and in as3, i have made another attribute for voice.
 
Let me know how i can play different sounds for different images.

View 5 Replies

ActionScript 2.0 :: Playing Multiple Sounds From Different MCs?

Sep 3, 2010

Working on a project with multiple sounds (all contained in different MCs) played by different key board events. Most of it works, but when I try to use simultaneous 2 button combinations to call upon a different sound, all 3 sounds play at once. The 3 sounds are as follows: the sound associated with the first button, the sound associated with the second button, and the sound associated with the 2 button combo. I've made several different true/false statements to override different events and states, but they don't affect the playing of the MCs. I've also tried using attachSound but I don't like the results I'm getting from that either.

How can I stop the first 2 sounds from being played, so only the 3rd sound can be heard?

View 2 Replies

ActionScript 2.0 :: Add Multiple Sounds Of Movie?

Nov 11, 2005

im am using this script in my current movie to attach sound using acttion script it also has a stop/start button but i need to now how to add multiple sounds in this way.

[Code]...

View 2 Replies

ActionScript 3.0 :: Preloading The Multiple Sounds?

Jun 11, 2009

In my app, scenes on the stage play based on user interaction, and are accompanied by sound clips that are loaded through a soundLoader class (see below). I can play the correct track from the model, but I can't figure out how to correctly write a loadTracks function that will proload all of the track options for a given scene, and then play the correct one based on what the user clicks without a pause. How would I preload and store those sounds in a way that I can use them when needed?

Code:
package mvc
{
import flash.display.*;
import flash.media.*;
import flash.events.*;

[code]....

View 2 Replies

ActionScript 3.0 :: Use Each For Loop Code In Arrays?

Feb 9, 2012

I have a problem to use each code in for loop. I create 2 Circles in my stage with addChild code. And I gave them function ( mc.x += 2; ) and the time they get to the end of stage I gave the function ( mc.x -= 2; ) but my problem is when one of the circles get to end and wants to move to the right the other circle move with him to the right. and I think the each code in for loop helps me. but I don't Know how to use it in my actions.

my code is:

ActionScript Code:
var mc1:Circle = new Circle();
var mc2:Circle = new Circle();

[code]....

What should I change in this code to use each for loop..?

View 9 Replies

ActionScript 2.0 :: Creating Arrays In A For Loop?

Jun 15, 2005

creating multiple arrays in a for loop? This doesn't work :

for (i=0; i<catNum; i++) {
var arr(i):Array = new Array ()
}

[Code].,...

View 7 Replies

ActionScript 2.0 :: Create Arrays In Loop?

Nov 15, 2008

Is it possible to have a for loop and create a new array for every loop
for

(i=0; i<5; i++){
myArray+i:array=new Array;
}

I know this doesen't work it just illustrates what im after.

View 6 Replies

ActionScript 3.0 :: Add More Options To A For Loop Regarding Arrays?

Mar 16, 2010

I wanted to know if there's a way to add more options to a for loop regarding arrays. Say the current position in the loop is 1 (thats where my block is) then i want it to check the array if current position -1, +1,-3,+3. if any of these are null (thus, empty spot.) Because the block moves across a board i need the script to be adaptable.

View 3 Replies

ActionScript 2.0 :: For Loop To Display Arrays

Jun 7, 2011

I'm trying to display strings stored in arrays with a for loop, i could just write out each array like:[code]but it only displays the last one, is there a way to display it from 1-10, or 1-any number?

View 4 Replies

ActionScript 2.0 :: Adjusting Volumes With Multiple Sounds?

Apr 27, 2009

m using Flash 8. And I'm trying to adjust two sounds files using action script. First I set a sound file to 100, then I tried to set another file to 25 but when that happens, it also sets the first sound file to 25.

How do I adjust the second sound file so that the first one doesn't get changed as well.

By the way, here's the action script I was using for both sound files:

Sound File 1
background = new Sound();
background.attachSound("Kingdom Hearts Theme");
background.setVolume(100);

[Code].....

View 2 Replies

ActionScript 2.0 :: Flash8 : Preloading The Multiple Sounds?

May 14, 2009

I have 10 sound files in an array.I am wanting to preload all of them and update a counter once each one loads sucessfully.So when song 2 for instance finishes loading then the counter would be at 2,then 3,etc....I think maybe I need to use a while loop to hook each sound into a load event?

View 1 Replies

Actionscript 3 :: Playing Multiple Generated Sounds

Sep 6, 2010

Inspired by Andre michelle, I`m building a tone matrix in AS3.I managed to create the matrix and generate the different sounds. They donīt sound that good, but Iīm getting there One big problem I have is when more than one dot is set to play, it sounds just horrible. I googled a lot and found the additive synthesis method but donīt have a clue how to apply it to as3.anybody out there knows how to play multiple sounds together? any hint?

View 2 Replies

Actionscript 3 :: Working With Multiple Sounds & Channels

Nov 17, 2011

Are there any audio management libraries for ActionScript 3? The more tailored they are for game development the better.I'm finding it hard to understand and work with multiple channels, which is making a lot of my audio sound screwy and cancel each other out, etc. I've been working on an RPG that can at a given time have quite a number of sounds playing such as environmental noise (like opening doors, thunder, rain, etc), walking enemies, inventory sounds (for events like dropping an item into your inventory), passive spell-casting sounds, voice clips, weapon swinging etc. Alternatively, if there are any good resources that explain how to use multiple sound channels strategically.

View 1 Replies

ActionScript 2.0 :: [FMX] Controlling Sounds Across Multiple .SWFs?

Apr 10, 2003

I need a little advice. I've got a set of swfs that are all part of one training, and within these movies are a few sound effects attached to button instances. I want the user to be able to click a button to turn the sound on or off at any time during the training.

My first idea was to create a variable called wantSound, which each sound instance checks before deciding to play. This is working perfectly. There's a toggle switch on the main timeline that sets sound to on or off, and when a sound is supposed to play, it checks to see if wantSound=true, and plays, or if it is false, it does not.

This works fine on each individual .swf, but when a new .swf loads in, the sound defaults back to true, and the user has to turn it off again. I imagine this could be fixed by loading each movie into different levels instead of loading them into level0 or root, but as this is not how I originally created the file, that will take a lot of work to handle aligning the loaded movies and parking them (making sure none of the buttons are active on the level below). I'm lazy, what can I say? :-)

I've been looking around at similar questions, and found a decent tutorial on Macromedia's site about using javascript to pass a variable from flash to HTML. I went through that, and managed to get Flash to send my wantSound variable to HTML with no problem. Check here for the tutorial.

The only problem is that in macromedia's example for sending data from HTML back to Flash, they use a text field for getting the variable. I just want to take the variable sent from Flash to HTML and send it back to Flash when requested (at the beginning of the next SWF.)

View 1 Replies

ActionScript 2.0 :: Manage Multiple Sounds With One Function?

Dec 17, 2005

I have set this:

Code:
mp3_1 = new Sound();
mp3_1.loadSound("1.mp3", true);
mp3_2 = new Sound();
mp3_2.loadSound("2.mp3", true);

[Code]...

View 2 Replies

ActionScript 3.0 :: How To Use Multiple Sounds To Play A Single Mp3

Jan 22, 2009

I have figured out how to play a sound with AS3, but i cannt figure out how to use multiple sounds. to play a single mp3, i am using this:

Code:
//number that is redefined when the pause button is hit
var pausePoint:Number = 0.00;
//a true or false value that is used to check whether the sound is currently playing

[Code]....

but what I need to do is have 4 different mp3's, each with its own stop & play button, so the user can play any file they want. These are voice over reels, not music, so each needs its own set of buttons.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved