ActionScript 2.0 :: Random Function With Sound?

Mar 3, 2007

I am working on a piece now that will have 10 invisible MC's (1-10) stacked on frame 1 in seperate layers that function like buttons on the main timeline. Each of these mc's will trigger a corresponding mc (A-J) to become visible and play and also start a sound file. This I have all worked out.

What I am writing about is a random function. When 1 triggers A, I would like one of five distinct MC's inside of A to be randomly selected to play, both with sound and with image.

Right now I'm working on the random function with sound, and I'm in need of soome assistance. I'm not sure of my approach, but why I'm stuck in particular now is because ususally when attaching a sound to an MC, when the sound is called it is through the name of the sound rather than the mc name and as I've created a random function I can't very well call the sound name as then it won't be random. Here's what I've got:

sound1 = new Sound(soundHolder1_mc);
sound1.attachSound("chime");
sound2 = new Sound(soundHolder2_mc);
sound2.attachSound("psychic");

[code]...

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Sound And Video Within A Random Function?

Apr 23, 2010

I've designed an interactive quiz that has 10 questions, and for each question 3 possible answers (obviously only one of which is right), however I'd like to add some sound to certain questions and a small video clip. The only issue I'm having, and I've not been able to get my head around. I've loaded all the questions and answers into arrays, and used the random function to display them in a different order each time, and because of this I'm having trouble figuring out how I'll be able to implement the use of sound and video into the project.

I'll post the code so far below as to give a better idea of what I'm trying to do, and what I've done so far.

Frame containing Array function:

[Code].....

View 0 Replies

ActionScript 2.0 :: Random Sound Load And Start Is Speeding Up The Sound?

Dec 16, 2005

I'm trying to load sound dynamically into a clip and then play it randomly. The AS I came up with works great if the sound is embedded and I use the .attachSound() method instead of loadSound(). Now, when I load it dynamically and use the code below, the sound plays very fast and at a higher pitch.

Code:
var crows = new Sound(this);
crows.loadSound("Raven.mp3", false);
crows.setVolume(100);

[Code].....

View 1 Replies

ActionScript 3.0 :: WAV File - New Sound.extract() Function To Get Two Seconds Of A Sound Into A ByteArray

Nov 11, 2009

I'm having some trouble getting the following code to work - trying to use the new Sound.extract() function to get two seconds of a Sound into a ByteArray, and then create a new bytearray with a WAV header, and then output the file. The resulting 'test.wav' file sounds very wrong although slightly recognisable? I think I may have some of the WAV header settings may be wrong but I'm not quite sure what's the matter and after a long time scratching

[Code]...

View 5 Replies

ActionScript 3.0 :: Random Sound With An Array?

Dec 23, 2009

I would like to use an array to play 5 sound files randomly.Here's the code I've got so far! Can anyone tell me what code I'm missing?

var my_sounds:Array = [Sound1, Sound2, Sound3, Sound4, Sound5];
var s1:Sound = new Sound(new URLRequest("GentleSeaOnFlatBeach.wav"));var s2:Sound = new Sound(new URLRequest("SPLASH.wav"));var s3:Sound = new Sound(new

[code]......

View 1 Replies

ActionScript 3.0 :: Way To Pick Random Sound

Oct 20, 2010

I've spent the last few days trying to find an answer to this seemingly simple question, and no luck. Well, partial luck, but not quite what I wanted.

My problem is this - I want to play a random sound when an event happens. In AS2, I used to do this[code]...

View 5 Replies

ActionScript 3.0 :: Play Sound At Random?

Oct 19, 2011

I'm working on a new AS3 project in Flash CS4. This is my second major project, and for some reason, when I enter a new frame, a sound from my library plays when it's not supposed to. It plays once, when I enter the frame. The thing is, there's no code that would initiate it to do so. In my first major project, it did the same thing. I figured I screwed something up since it was my first project, and ignored it -[code]...

View 9 Replies

ActionScript 2.0 :: Random Sound On Click?

Dec 19, 2006

Anyone know how to make a sound (picked at random from a selection in the library) play when a button is clicked?

View 2 Replies

IDE :: Loading Random Sound Clips?

Aug 26, 2009

I was wondering if somebody could point me in the right direction to be able to load in a random sound clip (from a set of 5 or more mp3s) when the user rolls over a button. I can't seem to find a way to do this.

View 14 Replies

ActionScript 2.0 :: Random Sound Event?

Mar 25, 2002

i am trying to write a script that generates a random sound. i like to make it a framescript but i am not sure how to do this, so i appended it to a movieclip (see below) but this doesn't work..

onClipEvent (enterFrame) {
randy = random(5);
if (randy=1) {[code]....

View 5 Replies

ActionScript 2.0 :: Play A Random Sound From Array?

Mar 22, 2009

I have 30 sound clips, each named s1, s2, s3 etc...

i want to create an array so when it enters the frame it will play a random sound from the array.

View 1 Replies

ActionScript 3.0 :: Play A Sound With Random Pitch?

Feb 16, 2009

I'm looking for a way to play a sound with slightly altering pitch to make it more "interesting" (read: tolerable).

I've previously used it with great results in java programming with the Slick library. Simply asked the sound to be played at 0.9 - 1.1 of original pitch (1 = default), gave a subtle but awesome effect.

View 0 Replies

ActionScript 2.0 :: Several Random Sound Linkage And Some Sort Of Pu?

Aug 15, 2005

I have to design a game for a school project that I have to redo to pass my year, but so far I have encountered several problems. My game is for children from 6 to 8 years old, so the game has to have a lot of sound (voice recordings) to explain the menus and the stuff they have to do.

[Code]...

View 8 Replies

ActionScript 2.0 :: Have A Random Sentence Generator, But How To Add Sound To It

Aug 28, 2007

I have a code that randomly generates a random sentence:[code]...Now on every word, I have a sound clip that I want to play, but how would I code it? I dont know I would I would assign a sound to a word or how to incorporate it into the coding above

PHP Code:
if(name "example"){mysound = new Sound();mysound.attachSound("example");mysound.start();}

[code].....

View 1 Replies

ActionScript 2.0 :: Using Number From Random Array To Attach A Sound?

Jan 4, 2010

I have a foreign language resource which randomly creates and displays a number. The player then needs to select the correct number in a particular foreign language. What i also need to do is play the audio for the randomly created number. I have numbers 13-20 all as seperate sound files also named as identifier names 13,14,15 etc up to 20.

The following script loads the sounds. Sound1 is the sound which needs to hold the random number which is generated:

ActionScript Code:
onClipEvent(load){
Sound1 = new Sound();
rndClip = ????????;

[Code]....

I need to load this array as Sound1 so that the correct sound file plays to match the random number.

View 2 Replies

ActionScript 2.0 :: Button Loads Random Sound Clip

Apr 18, 2011

I am a voice over artist and I'd like to have a button and when you click it, it loads one of say 20 mp3s stored...wherever. It can be in the flash movie itself...but I'd rather the script access a directory on my server, that way the movie itself doesn't take long to load.

View 2 Replies

ActionScript 3.0 :: Using Random Function With While Loop?

Feb 22, 2011

I have a while loop that I need to shuffle the order of my array. This was initially an AS2 code and am trying to convert this over but have come across with an error I don't understand so hoping someone may know what it means. My while loop code is:

Code:
var randomArray = shuffle(orderArray);
function shuffle(toShuffle) { // shuffles an array

[code]......

View 5 Replies

ActionScript 1/2 :: Random In Function Of Time

Sep 21, 2011

can i make the animation appear randomly but with time limite ?example:if the random number allow that the animation appear, the animation must stay 3 secondes then dissapear even if the random number is changed before the 3 secondes are finish.also when random number allow that the animation disappear, the animation must stay hidden 3 to 6 secondes randomly but at least it must stay disappeared 3 secondes .

View 5 Replies

ActionScript 2.0 :: Function To Get A Random Number Between 111 And 666?

Oct 18, 2009

is there any chance someone could give me a function to get a random number between 111 and 666. I need to put this function in a local variable in order to make the result appears in a dynamic text. So I need a simple function in as2 to get that number.

View 2 Replies

ActionScript 2.0 :: [FMX]Function Random Movement?

Apr 23, 2004

I have the following clipEvent on a movieclip called square:

onClipEvent (enterFrame) {
xmove = (xpos-this._x)/5;
this._x += xmove;

[code].....

View 1 Replies

ActionScript 2.0 :: [FMX] Function Random Movement?

Apr 23, 2004

I have the following clipEvent on a movieclip called square:

onClipEvent (enterFrame) {
xmove = (xpos-this._x)/5;
this._x += xmove;
}

And the following framecode in the same keyframe as square:

_root.square.xpos = Math.round(Math.random()*550);

Now I want to use this information in a function so I can control more than just one clip.

View 1 Replies

Tween Function - Loading Random Images

Nov 27, 2009

I have a .fla with 5 pics on my timeline and using tween function to roll them from bottom to top, what I need to get those images random from o folder or something.

pics= ["images/pic1.jpg",
"images/pic2.jpg",
"images/pic3.jpg",
"images/pic4.jpg", "images/pic5.jpg"];
[Code] .....

View 15 Replies

ActionScript 3.0 :: Memory Game Random Function?

Feb 11, 2010

I made a memory game with a tutorial. My knowledge of AS3 is not that good so I have to following question.There is a function like Math.Random to random generate number and put them on stage. I made a memory game and the cards are on the same place every time I play the "movie".I want them to shuffle every time I restart the game. How can I write a good random function in AS3?

View 10 Replies

Actionscript 3 :: Make A Math.random() Function?

Mar 17, 2011

I wonder how to make a Math.random() function, or something similar where it chooses a number from 0-9. But as the program progresses, another random variable will appear. That random value is what I want removed from the 0-9 scale. (The other random variable is also from 0-9)

View 4 Replies

ActionScript 3.0 :: Random Function With More Than One User - Get Different Numbers And Not The Same

Sep 4, 2010

i have been trying to write a multi player bingo game, i have got passed all problems, except 1, the random function, the random function works fine with 1 player but when i play the game with more than one user each user will get different numbers and not the same numbers. how would i do it so all users get the same number is there a way where i can shuffle 90 numbers then load them into a movie clip then all users play the movie clip then all users get the same number is this possible or is there a simple way. I have also tried getting random numbers from php mysql but get the same problem,

View 6 Replies

ActionScript 3.0 :: Function Load Random Images From Xml?

Mar 10, 2011

This function load random images from xml:

var imagesXml1:XML;
var imagesNb1:uint;
imagesXml1 = new XML(e.target.data);[code].......

Q: How to convert this to load images sequentially (one after another)?

View 3 Replies

ActionScript 2.0 :: Function For Random Number With No Repeats?

Jul 27, 2007

I'd like to have a random number generator that, once it chooses a number, deletes it from the pool of possibilities (it's for a photo gallery that shuffles images from an array)...either that or it keeps repeating the function until it gets a number that hasn't been used.

View 2 Replies

ActionScript 2.0 :: Random Array Function Buggy

Oct 22, 2008

I put this script into my fla before the movie starts. mcName equals a frame label, mcText equals dynamic text shown inside a movieclip, and url is the link on each movieclip. So it's supposed to load a random frame and highlight the name on that frame, and it works 90% percent of the time, but sometimes it seems it doesn't read the array or something because it brings up the first frame and no name is selected, but the names at least show up, which I don't get. Could it be the order I'm calling the events?

[Code]...

View 6 Replies

ActionScript 2.0 :: Make Function To Run In Random Mode?

Apr 7, 2011

how can i make this function to run in random mode.

switch (section){
case "BlueState" :
gotoAndPlay("bann1");
break;
}

i mean , when i open the .swf it should run in random , "bann1" , "bann2" , "bann3" then again "bann1" an so on ... only when i restart the swf. it should swich .

View 4 Replies

ActionScript 2.0 :: Flash Random Bar Transition Function

Apr 18, 2004

If you test swf you'll see a main nav, and bars randomly tweening back and forth. There are 6 bars, and they are all fixed sizes so the only thing that is tweening randomly is the x position. What I need is to put a short duration on the bars tweening, 5-10 seconds, and have it act as sort of a transition so when you click to go to from one section to another, the tweening bars move around for the short duration and then when they stop a gotoandplay or set visible true action is triggered to load the content. But here is the tricky part...i need to have the bars return to their initial positioning.

What i'm looking into now, is taking the initiate random movement script from the random layer, and placing it within each of the onrelease functions in the navigation layer with some kind of if/else element, like if 10 seconds has passed return bars to initial position and show clip... or something like that... Or...couldn't i put the //initiate the movement part in a function and then activate it onRelease for a few seconds using getTimer somehow and then call another function after getTimer is up that would stop the bars and return them to their initial x positions.

View 7 Replies







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