ActionScript 2.0 :: Playing Sound When One Object Hits Another?

Jul 30, 2008

I am creating a kids game in AS 1 and want a "good" sound to play when a "good" object falls into the beavers basket and a "bad" sound to play when it falls into the basket. What is the best way to handle this in AS 1?

View 3 Replies


Similar Posts:


Actionscript 3 :: Know If A Sound Object Is Playing?

Jan 18, 2012

In AS3 i've created a code that load a sound and execute it in streaming.

var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
mySound.load(new URLRequest("surrender.mp3"));
myChannel = mySound.play();

Considering that the mp3 file is placed on the server, i need to trace if it's already begun or still receiving initial data from the server. Once it's effectively started i've to call a function that initialize some things.

how i can trace if a sound or channel object "is playing" ?

View 2 Replies

Actionscript 3 :: Playing A Sound Object In Reverse ?

Feb 3, 2010

For a project I'm working on, it's necessary that I am able to play a sound object in reverse. How would I be able to do this in AS3?

View 1 Replies

Flash - Playing Sound Object With Desired Point

Jun 17, 2011

I'm trying to make a player with EQ, get the data in the Sound object, but for some reason with the desired point to play it I can not play it right from the start of the track.

_out_snd.addEventListener(SampleDataEvent.SAMPLE_DATA, processSound);
_channel = _out_snd.play(pos);
function processSound(event:SampleDataEvent):void {
_samples = new ByteArray();
var len:Number = buf[trackDesc].sound.extract(_samples, BUFFER_SIZE);
[Code] .....

View 1 Replies

ActionScript 2.0 :: Playing 2 Different Sound Clips When Dragging Object Left Or Right

Jan 26, 2011

I currently have an dragable button that is locked to only move left and right within a small bar, and want to have that button playing one sound going left, and another sound going right.

View 3 Replies

ActionScript 2.0 :: If Object 1 Hits Object 2 With A Speed Greater Than 10?

Dec 19, 2010

I wonder if there is a way in actionscript 2 that makes something happen if an object hit another object with a specific speed. For exemple: If Object 1 hits Object 2 with a speed greater than 10 I want something to happen.

View 5 Replies

ActionScript 3.0 :: Sound Detection And Visual Output - Trigger A Video When It Hits A Certain Volume

Dec 15, 2011

So i found a code on the adobe site which pics up input from the mic. I need that to trigger a video when it hits a certain volume. I'm a complete novice to AS3 and i need this for a proof of concept in the morning. Here's the code that i'm using to pick up the mic -

[Code]...

View 0 Replies

Object - Two Movieclips In CS5 Hits?

Dec 5, 2010

I have two movieclips A and B when the movieclip A hits the movieclip B , I want the movieclip A to be removed what code should i write for this flash problem ?

View 1 Replies

ActionScript 3.0 :: Stop An Object When It Hits Another?

Nov 12, 2009

Im making a sort of maze game and have a ball that moves up, down, left and right when the corresponding arrow key is pressed. What I want to do now is introduce some walls, how do I make the ball stop moving when it touches a wall? (so it doesnt pass through the wall)

View 1 Replies

Flash - Get The Blue Object To Disappear Once It Hits A Red One?

Jul 23, 2011

I have a grid of objects that have been added to the stage dynamically, the objects are either of a Class Red or Class Blue, how do I perform a hit test on the Classes? I want the Blue object to disappear once it hits a Red one.

View 3 Replies

Actionscript 3.0 :: If Press Play Button While The Sound Is Already Playing It Has The Same Song Playing In The Background

Nov 13, 2010

I have a sound clip that I'm loading externally into my flash file. The code I'm using looks like this and is placed in the as layer on the first frame,

var mySound:Sound = new Sound();
var myChannel:SoundChannel = new SoundChannel();
var myTransform = new SoundTransform();
var lastPosition:Number = 0;
mySound.load(new URLRequest("introaudio.mp3"));
myChannel = mySound.play();
[Code]....

View 14 Replies

ActionScript 1/2 :: Stop Other Sounds From Playing While Current Sound Is Playing?

Apr 10, 2011

I am creating a game that has 6 movieclips all on the main time line of the game. Each movie clip has three buttons that when clicked plays, pauses or stops a sound clip.When I press any of the sound clip play buttons that sound starts playing, the problem is when I click any of the other sound clip play buttons those sounds also start to play. Is there a way I can disable the other sound clip buttons while the current sound is playing then enable all of the buttons when the current sound has stopped.
 
This is the code that creates one of the sound objects

[Code]...

View 3 Replies

Stop The Playing Sound And Start Playing The Button?

Oct 3, 2009

So I made a few buttons with sounds within them and when I publish it they work just fine. But what I want them to do is;

Say I click a Button.The sound starts playing.Then I click it again, before the sounds done playing.I want it to stop the playing sound and start playing the button I just clicked on, whether it be the same button, or a different one.Right now it just ends up sounds like an echo because it'll play it as many times as you click it.

View 2 Replies

ActionScript 3.0 :: Game Loop - Detecting When Object Hits MovieClip

Jul 17, 2010

I'm trying to program this code:
public function enemiesDie(){
enemyLoop: for (var k:int = enemies.length -1;k>= 0; k--){
bulletLoop: for (var i:int = bullets.length -1; i>=0; i--){
if (enemies[k].hitTestObject(bullets[i])){
trace("hit");
[Code] ....

To detect when a bullet hits an enemy in a game I'm trying to make and I get this error:
TypeError: Error #1006: hitTestObject is not a function.
at Space_Hooligans/enemiesDie()
at Space_Hooligans/gameLoop()

View 2 Replies

Flash :: Playing Sound From Data Acquired From Sound.extract()?

Aug 1, 2011

I'm trying to play a sound using a technique found here (play the sound by sampling raw sound data gathered from the original with extract()), with the difference that the mp3 sound is embedded in the swf, not loaded externally. This is my code:

var soundBytes:ByteArray = new ByteArray();
var mp3sound:Sound = Sound(new Sound1_design()); // this is the embedded sound
mp3sound.extract(soundBytes, int.MAX_VALUE);

[Code]....

This works, in a way, except that the resulting sound is distorted (it has a kind of a metallic ring).

View 1 Replies

ActionScript 2.0 :: [FMX] LoadSound - Sound To Keep Playing While The Rollovers Load Sound

Jun 22, 2003

I am loading small sounds dynamically with the loadSound command. These small sounds are activated with a rollover. see script below. This works ok. however. i want the first sound to keep playing while the rollovers load sound. a bit like playing the piano. This works ok when i import all the sounds into the library and place them on their very own button. however the size of the flash movie increases to 140k. whereas when i load them dynamically the size of the movie is 20k. obviously i want to load dynamically.

But with dynamic loading each sound stops when another sound is rolled over, so that there is only ever one sound playing at once. I need to load the sound into a different level or something, so that the first sound can keep going while the smaller, shorter sounds play over the top. this is my script below. The first sound loads when the movie starts. This is the one i want to keep playing. Then there are the smaller ones with rollovers. does this make any sense? there's actually 13 little sounds.

[Code]...

View 3 Replies

ActionScript 3.0 :: Flash - Play A Movieclip When Dragable Object Hits Its Target

Aug 15, 2011

I've got tree movieclips called: greenpip(this is the dragable object, which is visable), greenpip_target(which is invisible, but becames visible when greenpip hits it, and grrenpip is becaming invisible) and then the third one: greenpip_flask (which is the animation I want to play when the greenpip hits the greenpip_target).
Everything works but I don't know how to make the greenpip_flask play, when grrenpip hits the greenpip_target. This scenario takes place three times with three sets of objects

View 5 Replies

Professional :: Stop A Sound From Playing If It Is Playing Already

Dec 6, 2011

ok so i have a button that plays an animation for fire when held down. and when realsed goes to and stops and frame one. when it reaches the end of the time line it goes to and plays at frame 10 and goes back to the end of the timeline. I have a sound for the fire animation that plays for the effect. The problem is the sound keeps going untill its over even if the button isnt held down. and when the playhead reaches the end of the timeline it goes to and plays and frame 10 and it replays the sound. if i hold it down it will just keep playing the sound over and over from start to finish. what i want it to do it when i hold the button down i want it to play the sound and when released it stops the sound where ever it is at. I also dont the sound to play again if there is a sound already going to stop it from playing 20 sounds at one time it gets loud and you need asprin after about 5 seconds of that.

View 2 Replies

ActionScript 3.0 :: Assign A Sound To A Soundchannel Without Playing The Sound?

May 4, 2011

The thing I don't understand is how to assign a sound to a soundchannel without playing the sound. All the examples I've seen do this.

Code:
_SoundChannel = _sound.play();
_SoundChannel.stop();

And how can I set a SoundChannel volume to zero before allocating a sound to it?

View 2 Replies

ActionScript 3.0 :: Remove A Sprite Object When Another Sprite Object Hits It?

Mar 23, 2011

I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

at flash.display:isplayObjectContainer/removeChild()
at grid/ball_movement()// my function in enter frame event
The code I wrote in ENTER_FRAME is

[code].....

View 3 Replies

ActionScript 3.0 :: Remove A Sprite Object When Another Sprite Object Hits It

Mar 24, 2011

I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.[code]

View 1 Replies

CS3 Sound Control - No Sound Playing?

Apr 16, 2010

I am trying to embed some sound controls, and have hit a dead end. I made my play and stop buttons, imported my mp3,, assigned it proper linkage, and inserted this AS2 :

[Code]...

The buttons are named "play_btn" and "stop_btn" respectively. When I export it or preview it, hitting the play button does not do anything.... I hear no sound. What could be up with this?

View 4 Replies

ActionScript 2.0 :: A Line From One Point Past Another Point And Whether It Hits An Object?

Aug 19, 2009

I am using AS2 with Flash 8 Professional So, my problem is that I currently have a man in the middle of the screen, who shoots a line towards the mouse when I click. However, when I use hitTest to see if the line collides with another object, Flash recognizes the line as a large box if it is diagonal, so the hitTest isn't very accurate. The line only satys there for one frame, so I can't have the usual moving-bullet-style. I am either looking for a way to create an imaginary line with AS from the starting point to the mouse and beyond, and tell whether or not this line intersects with an object... or some other way that I haven't thought of to fix my problem. Keep in mind that the line rotates from a center point towards anywhere around it for 360 degrees.

View 1 Replies

Flash :: Dynamically Create New Sound Objects Based On Raw WAV / DATA Or Other Sound Object?

Jan 31, 2012

Is there any AS3 library or code-snippet that can create altered versions of a Sound object on-the-fly (at runtime)? Either based on:

An existing Sound object; A ByteArray object;

For example, say you have a "dry" sound of a gun-shot. You could:

[Code]...

View 1 Replies

Actionscript 3 :: Sound.extract Method Empties Sound Object Data

May 20, 2011

I am using the following to extract the byte info from a sound object - however if I go back to the same sound object and run this again, The byteArray has no bytes available.

var data:ByteArray = new ByteArray;
sound.extract(data,sound.length*44.1);
data.position = 0;
return data;

Is this the correct behavior? Is there not a way to do this multiple times on the same sound object?

View 3 Replies

ActionScript 2.0 :: F8 - Attach Sound Object To A Separate Mc To Control Independently From All Other Sound / Root Volumes

Mar 15, 2008

I have been at this for about 19 hours straight! I am going to go to bed immediately after this post, but for crying out loud, I have NEVER had this problem before today! Before anyone reads ahead and says 'you have to attach your sound object to a completely separate mc to be able to control it independently from all other sound/root volumes.' see if the following code accomplishes just that:

[Code]...

View 2 Replies

Flash - Take Two Sound Objects And Combine Them Into One Sound Object

Nov 15, 2010

Is it possible to take two Sound objects and combine them into one Sound object so that one Sound plays, and then the second plays right after it? I can just play the first Sound and then the next right after it, but it would be much cleaner to combine them before playing the audio.

View 1 Replies

ActionScript 2.0 :: Streaming Sound Distorted - Sound Object?

Jun 14, 2004

I have a streaming sound that is loaded into my flash movie (will end up on CD) that is very distorted, it sounds like someone is slowing down the audio, the voice sounds deep and slow

View 1 Replies

Sound Playing Too Soon?

Sep 2, 2010

Im making an animation and in the 3rd scene i have a deer that screams and the sound plays way to early. I had to drag it out way past the frame where it opens its mouth for it to play at the right time.

I have no idea whats wrong this has happened before. I really dont want to have to guess on where to put the sound for everything a character says.

View 2 Replies

Sound Not Playing On Mac?

Sep 21, 2009

Back to my nightmare project, I've embedded sounds in the project that play based on certain user actions. They play fine for me (PC), but my customer is telling me they don't work for her (Mac).Would there be ANY reason a sound would play on a PC but not a Mac?I've told her to update her Flash player to make sure it's current and to make sure her speakers are on and the volume is up, but no sound.Okay, the REAL reason this isn't working is user error based on everything else I'm told that's happening and not happening, but I need to cover my bases and see if there really may be a reason sounds won't play on a Mac.

View 3 Replies







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