ActionScript 2.0 :: Adding A Sound Clip To Collision Scenarios
Apr 24, 2002Can someone tell how to add a soundclip (*.wav) to the following scenario:[code]
View 2 RepliesCan someone tell how to add a soundclip (*.wav) to the following scenario:[code]
View 2 Repliesi'm trying to add a rollover sound to a movie clip. i've read a bunch of tutorials but I can't seem to get it working here is the code for the first frame of my movieclip:
stop();
this.onEnterFrame = function(){
if(rewind == true){[code]....
I'm trying to figure out how to add a sound to a movieclip button so when the user clicks on it a sound is played.
View 10 RepliesI have a move that has a bunch of boxes that drop into the screen and bounce with a little gravity at the bottom of the window.
Code:
for (i=0; i<4; i++) {
var clip:MovieClip = attachMovie("circle", "circle"+i, getNextHighestDepth());
[code].....
How to import sound with AS? Cuz i have tried it and my sound just wount play. Can you explain me where my sound should be and what is the as code for importing cuz i use
mysound = new Sound();
mysound.attachSound("SoundOn");
mysound.start();
and this SoundON from where i get it, i try to add linkage to the sound file but in CS4 i cant find the option;. I do it from the library, adding text into the linkage field but still my sound doesn't want to play?
Im an aspiring flash game developer struggling with a bit of code in my upcoming game, I want to play a sound(A "ding") everytime the main character touches a cookie on stage. The main character follows the mouse cursor, and the cookies fall down from the sky.
I have scripted the cookies main class, with this function(which works fine)
private function eFrame(e:Event):void{
Code:
private function eFrame(e:Event):void{
this.y += 3;//move the bell slowly downwards
if(this.hitTestObject(_root.mcMain)){//if this touches the main character
_root.mainJumping = true;//make him jump
[Code].....
And I was hoping it would go into the library and play the sound bit named "bellSound" but it doesnt do this, instead nothing happends, not even any errors under the "Compiler errors" So no im a bit lost, as I do not know how to make this work, so a sound is played when the main character touches the cookie.
I'm having trouble trying to get my sound to only play once if it hits test object. As of now, if the mc remains in contact with the hto then the sound continues to play over and over. What I really need is for the sound to play once and only play again if the mc is moved off of the hto and then back on. Btw, it is a car and a building. Here is what I have so far:
[Code]....
i am making a pacman game, and i need to know how to make it go to a certain scence when a movie clip collides with another movie clip.
View 2 RepliesI have a collision going on between two clips, clip A and clip B. I tried to copy and paste clip A, but then clip B would only interact with one of them... not both.
Is there a way to get this to work with both? I tried adding clip A to an array, and checking for a collision with the array with
for(var i:uint = 0; i < TestArray.length; i++){
if (A.hitTestObject(TestArray[i])){
do something
but it still only works with one of the clips.
I want to navigate a maze and therefore I want to create collison detection with the maze itself, but when I try the collison is made with the entire maze movieclip, so even if my character is safe in a corridor without touching the walls of the maze it still counts as collisons.
View 1 RepliesIs it possible to make a collision detection between a separate movie clip and another movie clip that is with a movieclip thats on the same layer as the seperate one?
View 8 RepliesI would like to drag and drop multiple objects and on collision activate/play a video clip.
View 3 RepliesIn my file (AS2), I have a small square at the middle of the page. Diagonally to the right, I have a vertical wall which is a rectangle. Pasted inside my small square, I have the code:
onClipEvent(enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if (this.hitTest(Wall._x, Wall._y, false)) _x =
[code]......
I am having problems with a flash template that I am redesigning. Currently when the movie loads it automatically starts a song in the background. When you click my music navigation link my music page comes up and there are a few links there that I want to add music to. I also need to stop that background music so the song from the link can play.
View 1 RepliesI am doing a game such that when the score++, there is a certain sound. And when the score--, there is another sound. Cause I'm not really sure if this is the correct way. So I have two sound files, linkage "hit" and "miss" The actionscript goes like this on my movie clip:
[Code].....
I am very very new to flash...I created a quick little slide show...in which I want to add to add an mp3 file too...the slide show works as such.. Each frame has a picture and next button, so when I test the movie. The pictures are stopped, I click the next button and it
goes to the next frame......pretty straight forward. How do I add sound? I just want the music to start when I open it, and stop when the slide show is over.
The funny thing is...if I insert music into a file with no buttons and just let it stream (and stop on the last frame) it works great, the music plays...Only now that I have a movie with buttons, it doesn't even start. I have been thumbing around the actions panel, but for the most part I'm lost.
adding a simple sound to a movie with AS? I'd prefer this, since I already have simple "Roll On", and "Roll Out" script in place.
I have imported the sound file. In Properties, under Label, I have named it "tire_squeal". (Also, created a layer within the movie, and dragged the file onto the stage - all done.) Is this necessary when using Actionscript, or not?
The sound file loaded into my Library is named, "tire_screech.wav"
I want the sound to load "stopped", then play OnRollOver, and quit OnRollOut. (See previous AS code in string.)
so i am making a spinner and i want it to be like a see and say toy. How would i go about adding sound so that when the spinner lands on the picture that the sound will play. I have pictures and I have sounds. how would i do this?
View 2 Repliesi wan't to make a game where the character jumps when i press a key, but i also wan't to play a "jump" sound when the player press the "jump" key. I tried to use this:
ActionScript Code:
onClipEvent(enterFrame) {
if (Key.isDown(Key.SPACE)) {
kirupaSound = new Sound(this);
[Code].....
But it didn't work very well. When i pressed the "space" key it played the sound like 20 times untill it stopped.. It just continued to play the sound. Preview:megaswf(.)com/serve/1031811
i have a presentation and i have more then 1 scene is there a way to have music playing thoughout them all?
View 1 Replieshow can I add sound to a button on rollover?
I have tried this but the sound plays when the page is loaded aswell as when ouse over.
Code:
var aboutBtnsnd:Sound = new Sound(new URLRequest("clook.mp3"));
var aboutBtnchannel:SoundChannel = aboutBtnsnd.play();
var aboutBtnpausePosition:int = aboutBtnchannel.position;
[Code]....
When I tried to import music to flash animations I have created, I received error message that: One or more files were not imported because there were problems reading them.
The platform: Mac AA audio file Encoded with iTunes 10.1.2, Quick Time 7.6.6
Is it because of the audio file format that music cannot be imported? If so, how can i convert it to the compatible format?
i'm trying to make a little game for a school assignment. The problem is, when im adding sound to my game, this error appears:
Error #2044: Niet-afgehandelde IOErrorEvent:. text=Error #2032: Streamfout.
at herkansing/controleerOpHit()[C:UsersChrisAdobe Flash Builder 4herkansingsrcherkansing.as:145]
[code].....
I have a movieclip button that I want to add a sound to when press can someone tell me how to do this? The code I have for the contact form is:
stop();
//-----------<send form>------------\
//-----------</send form>------------\
//--------------------<submit button AS>---------------------[code]...........
I tried something I did on a soundBoard I made with an external folder, but then I thought that folder will never be added on the phone, so how am I going to do this?
View 7 RepliesI have a movieclip button that I want to add a sound to when press can someone tell me how to do this? The code I have for the contact form is:
[Code]...
I made a movie clip button, which is a custom cursor, and i want to know if it's possible to add a clicking sound into it. Or is there any way for a sound to be played everytime the custom cursor is in the clicking state??
View 2 RepliesI was wondering how I could add sound to a gallery that is driven by xml.I have a gallery that loads the picture, Title and description. the gallery is downloadable here.The regular gallery loads a web page when the picture is clicked. I am trying to make each picture load a different mp3.I have the general Idea of how it would be done but I don't know how put it to actionscript.I figured you would basically create a sound object that loads the specific mp3 from the xml file when the picture is clicked from the gallery.I think I might have some what of the idea right but I get an error everytime I load the swf file.
"ArgumentError: Error #2068: Invalid sound.
at flash.media::Sound/play()
at MethodInfo-6()"
[code].....
I have built a SoundClass which handles my sound. Any time I want to call upon a sound, I call upon the class and its function. Problem is, there is like a buffering time or something. For instance, when I jump with my character, I am trying to play the jump from the SoundClass I created. It plays, but takes about 3 seconds. Btw, it does this regardless of if its in its own class, or in the same class I am calling it from. The jump.mp3 is only 4KB.
Here is how I have it set up
Code:
package {
import flash.display.Sprite;
import flash.events.*;
[code]....
If I am in another class, I can call upon this by using "soundClass.jumpS();" It plays, but takes a few seconds. I have a trace on the function jumpS() and it traces immediately.
Any tutorials on adding right and wrong sounds to a game? Im making this game where on a wrong answer there is a wrong sound and on a right answer a right sound! How to get the code to do this!
View 1 Replies