ActionScript 2.0 :: [Flash8] Getting Sound To Play When Keyboard Button Is Hit?

Dec 9, 2009

I think worded the question wrong or posted in the wrong catagory I keep geting error messages with this code in AS2.0

Code:
if (key.isDown(key.getCode(81))) {
_root.samplesound=new Sound();
_root.samplesound.attachSound("sample1")

[code]....

This is the message fore both pieces Statement must appear within on/onClipEvent handler Im trying to get the letter "q" to play a linked mp3 in my library When I apply the code to a seperate layer No error messages shows, but no sound plays. When I apply the code to a movie clip/button object, that message shows up!

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Flash8 Play Sound On Keyframe?

Mar 16, 2009

I have a script that plays a sound on that keyframe. You see, the movie loops. So it keeps hitting that keyframe and the sound keeps playing over and over again. How do I stop this? what kind of script? I want the sound to still loop when it's over, but I dont want it to play again on that keyframe. Only when it's over.

View 1 Replies

Flash8 :: Simple Sound On / Sound Off Button

Nov 10, 2011

basically i simply want to give the option of turning of the sound in my flash via a button (If you press it sound goes mute, press it again sound unmutes) I searched around in the tutorials but i could only find (for this purpose) complicated pan sound control stuff.

View 1 Replies

Flash8 :: Change Button State On Play?

May 17, 2009

I am writing an application for my students which plays music when buttons are pressed.I made the buttons myself and they have 4 states in 4 colors.The rollover and mousedown states work okay but I would like the button to hold its 'hit' or "mousedown" color while the sound plays, and then return to its normal state. This way, while the sound plays, the student will see its connection to the button label (rather than a screen full of buttons in the same state/color)

View 2 Replies

ActionScript 2.0 :: Play Sound/stop Sound Button?

Feb 13, 2007

i want to make a single button to play a sound, and if pressed again, stop the sound. and if pressed again, play the sound, and so on...
i know it has to be made with a boolean variable, true/false, but i just can't figure out how.

View 13 Replies

Professional :: When Press On The Button The Stars Will Be Flying From The Button And The Sound Will Play?

Jan 29, 2011

i'm designing a website in flash8... now i have created some buttons, and i want that when i click on the button stars will fly from them and there will be a sound... i have already created the animation of the stars seperatly and it's in the library, i have also the sound file.... i just can't remember how to put everything together.... when i'll press on the button the stars will be flying from the button and the sound will play?

View 3 Replies

Play A Sound On Button Press?

Aug 11, 2009

OK, say I have a button that does something, like go to the next frame, is there anyway to have it play a simple sound located in the library without looping?

View 8 Replies

ActionScript 2.0 :: Flash8 : Put A Keyboard Letter?

Oct 6, 2010

I want a keyboard letter in this code:

if(Key.isDown(Key.RIGHT))
{
this._x += 15
}

As you see now there is the right key that is attached to the code but I'm making a 2 player game and I want one of the players to use the letters WASD.Just putting the letter D in there dosen't work.

View 2 Replies

ActionScript 3.0 :: Make A Button To Play A Sound?

Sep 4, 2008

I've been trying to make a button to play a sound, I've created the button and have a sound in the library, but can't manage to get the button to play the sound!!! I get this error: 1120: Access of undefined property knock_sound.

I think I need to give the sound an instance name but it says I need to use AC2 to do that!!

View 3 Replies

ActionScript 3.0 :: Button Sound Wont Play?

Jun 13, 2010

after importing the sound to the library, and naming the class sound1, here is the code used
its a simple code, and theoretically should work - but for some reason, its not registering the sound as being played.....

View 7 Replies

ActionScript 3.0 :: Play / Stop Sound On One Button?

Jan 27, 2011

When you click the first time on the button, it should start the song, when you click a second time on the button, it should stop the song. how do i make this with actionscript 3?

View 1 Replies

ActionScript 3.0 :: Make A Button Play Sound?

Mar 26, 2011

I have been working on flash in school, and the school upgraded from flash MX to flash CS5, i have then gone to make my project in AS3, however, it is very diffrent from AS2

My problem, is, all i want is a button to play a song from the libray (not from a URL on the internet like the code snippet) and my ICT teachers have no idea how to use AS3. I also need is a play, stop and pause button, and a volume control slider, i CAN do all these on AS2, i infact have it set up (but without a pause button) but, i cannot do this in AS3 and i need it done bady.

View 4 Replies

ActionScript 3.0 :: How To Play Sound On Button Down State

Mar 30, 2011

How do I play a sound on CLICK or the button's down state? I know how to slap a sound on the timeline but not how to put it specifically to the button and it's down state.

View 3 Replies

ActionScript 2.0 :: Pause And Play Sound Button?

Dec 24, 2011

How to add both pause and play sound button in a single button.. on play it shows the image pause and on pause it shows the image play.

View 4 Replies

ActionScript 3.0 :: Play Sound On Click Of A Button?

Sep 11, 2006

I want to play a sound on click of a button. I can do this in AS 2.0

//Action Script 2.0

Code:

snd=new Sound();
snd.attachSound("try");
snd.start();

[Code].....

View 11 Replies

IDE :: Sound On/Off Button; Loop; Auto-play?

Jun 23, 2008

I'm almost done building a full flash site where it navigates by position of timeline.I just need a simple on/off button for a soundloop to loop and play automatically. the on/off button just simply turns it off (toggle is optional). on it doesn't have to resume, just start the pool again.

View 14 Replies

ActionScript 3.0 :: Play More Than Sound When Click Button?

Apr 17, 2011

i want to gotoAndPlay more than one sound Ex: when i click the button i want to play frame label m2 and frame labe m1 sound

playy.addEventListener(MouseEvent.CLICK ,pl);
function pl(event:MouseEvent):void
{
so.gotoAndPlay("m2");
so.gotoAndPlay("m1");
}

the sound play in the same time i want to finsh play frame label m2 then stop then play frame labe m1 and stop.

View 3 Replies

ActionScript 2.0 :: How To Make Button To Play Specific Sound

Jun 22, 2004

I have a button that is actually a Movie Clip (so I can animate it). I want this button to play a sound. (But this isn't a sound question.) If I have a list of 20 sounds, and 20 instances of this button mc, how can I make it know which sound is being called for? If it were a normal button, each instance would have its own load- or attach-movie command. But since they're MC's, the invisible button hit is always the same. Is there a way to make it look to the MC's instance name to get which sound to load?

View 14 Replies

Flash Piano - How To Get Each Instance Of Button To Play Unique Sound

Jun 15, 2009

I'm using flash CS4. I am trying to make a piano. It will be the header of a web page when the mouse rolls over a key the appropriate note plays- ideally the key would appear to be pressed as well. I have a jpg of a piano keyboard imported as a graphic. On a new layer I have made a button whos over state has a blank keyframe. I have imported that button to the stage and given the instance a name. I have attached a sound to the over keyframe (middle C).

I have dropped a second instance of the button onto the stage and given it a unique name. When I attach the next sound (D pitch) to the over state it changes the original middle C. How can I get each instance of a button to play a unique sound? I have tried using a new layer for each button but that didnt work. Do I have to make a brand new button for each note? I have reduced my design to include only 16 notes (I originally wanted 32 but I thought that may take too long to download)---

View 7 Replies

Actionscript 3 :: Flash Play/Pause Sound Toggle Button?

Sep 11, 2010

I've googled and googled but got no where or outdated tutorials. Anyone know how to make it so I can toggle audio with buttons using ActionScript 3 on Flash?

View 2 Replies

ActionScript 3.0 :: Button That Play Sound When Clicked And Be Controlled With Events?

Nov 8, 2011

I'm a flash beginner and I've been having alot of trouble figuring out how to make a button which can be controlled with the keyboard as well as the mouse and plays a sound when clicked but when the button is released the sound instantly stops. What I'm going for is a piano application, I made the button, I know how to create keyboard events with listeners and make the different button states up and down but I don't know how to control the button with the keyboard and play sound when the button is clicked but stop the sound when the button is released.

Also I'd like to have it where the space bar will cancel whatever makes the sound stop so it just rings out until the sound clip ends. Can someone explain to me how to do this, remember I'm a beginner so please explain everything.

View 6 Replies

ActionScript 3.0 :: Create A Button That When Press It And Hold It Play A Sound?

Feb 15, 2010

Is it possible to create a button that when you press it and hold it, it will play a sound, and when you release it then stops the sound?

View 2 Replies

ActionScript 3.0 :: Controlling Sound File With Play Stop And Mute Button

Oct 6, 2010

the method for stopping/playing sound in 2.0 don't work for 3.0. i can stop the sound by going to a different page/frame on the site.but i want the buttons.

1. play button?

2.stop button?

3.mute button?

View 1 Replies

ActionScript 2.0 :: Volumeslider - Sound To Start Directly When Press The Play Button

Apr 21, 2005

Look at this tutorial [URL] I want the sound to start directly when you press the play button, without having to adjust the volume.

View 14 Replies

ActionScript 2.0 :: Sound Attachment - Click On The Objects First Before Clicking On The Play Button

Sep 21, 2006

I have been trying to deal with sound attachment. Attached is the source file that i am dealing with(I deleted the sound files because the size is too big): Simply, i have to click on the objects first before clicking on the play button. Each objects i clicked represents a different sound and will be stored in the array. So i will be clicking the objects in sequence and when i click on the play button, the music will play. Now comes the problem with my coding, I was unable to let my music coming out one by one at the time in sequence.

View 10 Replies

CS3 Sound On Keyboard Stroke

Jun 13, 2009

Well i've used flash a bit but i never really messed with sounds. I want to make kind of a drum tool fun thing that can play sounds, so i need to know how to make a sound play when you press a letter or buton on keyboard

View 1 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 3.0 :: Create Dynamic Sound To Play Sound-file?

Oct 14, 2009

It's possible to play a sound file through AS, either by loading it from a folder or import it to flash. It's also possible to play a dynamic tone with flash.media.Sound + writeFloat.

But... is it possible to play a sound file with flash.media.Sound + writeFloat in some way? I want to play a sound file without having to deal with any files except the .swf!

View 9 Replies

ActionScript 2.0 :: Flash8 Dynamically Recording Sound From Mic

Apr 28, 2009

I was wondering if there was a way a user could click a button to record a sound that would be stored to a sound clip and played back by the click of a button?

In other words, can I dynamically record a sound from my mic into a sound clip in an .swf?

View 1 Replies

Flash8 :: Plays A Sound In The Library On Loop?

Aug 21, 2011

i was looking into if there is anyway to work with sounds using actionscript?Basically im looking for something that

* Plays a sound in the library on loop

* stops that sound

* mute that sound (so it's still playing but cant be heard)

* unmutes that sound

the idea is so i can spread out this in scripts instead of in the frames.

View 1 Replies







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