ActionScript 3.0 :: Sound Played On Keyboard Event?
Apr 24, 2011
I'm creating kind of a pseudo RPG menu, and I just have the animation go to a different frame when you press an arrow key, backspace, or enter. I also have a couple of sound effects I wanted to play depending on what you press, but I am having no luck at all getting it to work, and everywhere I look online has very different instructions on how to go about it. Here's what I have just without any sound at all:
[Code]....
And then just different numbers based on what frame I'm on. As I said, I don't really know what I'm doing; a lot of this code was given to me. :/ So I know it's a lot to ask, but if I could get a very detailed explanation of what to do, If the sound could play before it switches frames, that would be best.
View 2 Replies
Similar Posts:
May 21, 2010
I have a flash header that was never completed because the guy I hired took people's money and ran. So now I even wonder if what he said could work with my flash header is true or not. But, usually there is always a way to make it work.
I have a flash header that does two important things: 1) Upon entering the site, it loads and plays an audio track 2) Makes an animal noise when you hover over each animal menu item. (not sure if I'm able to give a link to it or not on here. If I able to and someone would like to see it let me know)
I want to know if my flash header can support the following additional functionality/changes:
1) Currently, it loads everytime a page is selected. I only want it to load the one time of entering the site because the audio gets annoying. Set a cookie maybe?
2) But, I do not want to turn the audio off completely because I still want the hover over each menu item sound.
3) Have a link on it to allow them to select to turn on / off the sound completely. It currently has that, but only for the current page. Once you select another page, the audio is back to on.
4) Lastlly, is there a way for it to detect that someone doesn't support flash and to display an html version of it? And can flash create a html version from my fla file?
I don't know much about flash (but am learning) so I'm not sure if I'll be able to do this myself. However, I want to find out if my flash header will even work this way before I invest the time learning it just for these changes. I know it will be pretty deep with script code, but I'm hoping I could find base code already available for these features. Not sure I can afford help now because of being laid off and two different scammers taking advantage of me. So I'm going to try to do myself and see if there is any suggestions/support on here that can help. I have Flash CS4.
View 2 Replies
May 21, 2010
I have a flash header that was never completed because the guy I hired took people's money and ran. So now I even wonder if what he said could work with my flash header is true or not. But, usually there is always a way to make it work.I have a flash header that does two important things: 1) Upon entering the site, it loads and plays an audio track 2) Makes an animal noise when you hover over each animal menu item. I want to know if my flash header can support the following additional functionality/changes:
1) Currently, it loads everytime a page is selected. I only want it to load the one time of entering the site because the audio gets annoying. Set a cookie maybe?
2) But, I do not want to turn the audio off completely because I still want the hover over each menu item sound.
3) Have a link on it to allow them to select to turn on / off the sound completely. It currently has that, but only for the current page. Once you select another page, the audio is back to on.
4) Lastlly, is there a way for it to detect that someone doesn't support flash and to display an html version of it? And can flash create a html version from my fla file?
I don't know much about flash (but am learning) so I'm not sure if I'll be able to do this myself. However, I want to find out if my flash header will even work this way before I invest the time learning it just for these changes. I know it will be pretty deep with script code, but I'm hoping I could find base code already available for these features. Not sure I can afford help now because of being laid off and two different scammers taking advantage of me. So I'm going to try to do myself and see if there is any suggestions/support on here that can help. I have Flash CS4.
View 4 Replies
May 21, 2010
I have a flash header that was never completed because the guy I hired took people's money and ran. So now I even wonder if what he said could work with my flash header is true or not. But, usually there is always a way to make it work.I have a flash header that does two important things: 1) Upon entering the site, it loads and plays an audio track 2) Makes an animal noise when you hover over each animal menu item. (not sure if I'm able to give a link to it or not on here. If I able to and someone would like to see it let me know)I want to know if my flash header can support the following addionalunctionality/changes:1) Currently, it loads everytime a page is selected. I only want it to load the one time of entering the site because the audio gets annoying. Set a cookie maybe?2) But, I do not want to turn the audio off completely because I still want the hover over each menu item sound.
3) Have a link on it to allow them to select to turn on / off the sound completely. It currently has that, but only for the current page. Once you select another page, the audio is back to on.4) Lastlly, is there a way for it to detect that someone doesn't support flash and to display an html version of it? And can flash create a html version from my fla file?I don't know much about flash (but am learning) so I'm not sure if I'll be able to do this myself. However, I want to find out if my flash header will even work this way before I invest the time learning it just for these changes. I know it will be pretty deep with script code, but I'm hoping I could find base code already available for these features.
View 2 Replies
Jan 24, 2003
Ive attached sound in to mySound variable. How to get how many seconds the sound in mySound have played?
View 1 Replies
Mar 16, 2009
I have to play a sound file and show the progress of the sound file being played. I am using import flash.media.Sound; import flash.media.SoundChannel; But the PROGRESS event gives theprogress of loading of file. I want to know of much of the song has been played and how much more is left.
View 3 Replies
May 2, 2011
I have a multiple choice quiz that needs to have a sound played with each response. So if the user selects the correct response, they get the ding sound. If the user selects the incorrect answer they get a buzzer sound.
[Code]...
View 1 Replies
May 24, 2011
I have an MC with a lot of frames on stage and it has sound clips attached to each frame.
I need to stop the sound being played when I move on to another frame on runtime, thus, I need to access the sound object which has no instance name. Right now the sounds overlap since none of them stops and after a while all we hear is jibba jabba.
View 1 Replies
Jan 20, 2005
Im using MediaPlayback-component to load MP3-files into and play them.
I use this code to call it:
myMediaPlay.setMedia("SOUND.mp3", "MP3");
myMediaPlay.play(0);
Problem is that the sound is played twice overlapping eachother (some of the mp3 is played first,interrupted, and then restarted again to finish fully).
View 4 Replies
Jul 31, 2008
I am trying to play a sound clip using actionscript 2 the code I am using is attached to a button and the code I used is the following.
[Code]...
My problem is that the sound clip loops and I do not want it to do so. I have other animations going on on the stage. I tried to place the stop(); command but I do not seem to be able to make it stop after my sound has played once.
View 2 Replies
Jul 7, 2011
I am trying to learn JavaScript and I am wondering whether JavaScript has a event listener just like ActionScript's ENTER_FRAME. Basically, I want this event listener to listen "all the time" not just wait for any particular instance (mouse click, keyboard event) of event.
View 3 Replies
Apr 20, 2010
I am just a rookie in Flash, and came across a problem. I'm trying to create a flash movie that will display time like a TV ident does. I've successfully set it up to get the correct time and play a "tik-tok" sound as each second passes. However, it is to have some background music, and I can't get it to start when I need it - for instance, if the time is 18:00:00 it should start at 00 seconds, it time is 18:00:21 it should start at 21 seconds etc. This is the script I used for ticking:
[Code]...
What should I use for the complex situation as described above? My only guess is that I should sync it to the frames in the background video (behind the clock, running at 24 FPS), but I haven't got a clue how to set that up as well. Can someone please help? If necessary I can upload the .fla file.
View 3 Replies
Dec 17, 2008
after you load a swf in a movieclip, is there a way to trigger an event at the end of the swf that has been played?
View 4 Replies
Jul 24, 2008
i am having some problems linking my mp3 player swf file to my website. It looks like it loads fine, and the buttons work and change the track of the song, but there is no sound heard or played. Here is the code i used to do this:
[CODE].....
As i said before, the player loads up and shows up on the website with no errorsand the buttons work (going to next or previous song as well as the pause and play buttons pausing and playing the music properly), but no sound can be heard. (this is being test on the latest version of firefox).
View 6 Replies
Nov 1, 2009
i have a question to ask about asynchronous key controls This was what i did
[Code]...
and i checked with [URL]...?newspage=6249 and it looked more or less the same, so why is it that when i move my character and when i hold down a key, it just keeps on listerning to that keypress event listener, instead of just executing the other event. So say, i tap left and after which i tap right, it will work just fine, but if i hold left and tap right, the event listerner will still be listening to the left key. So, i was wondering could anyone point me in a direction as to how should i make my code stop listening to an event as soon as another event has been dispatched?
View 1 Replies
Jul 8, 2011
I am doing this inside a module containing viewstacks and their childs.Calling onInit() on creationComplete of module.When I am inside one of the childs of a viewstack of this module and press Enter, it doesnt not invoke the listener function at all (bp inside this does not get hit).
private function onInit():void{
this.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
}[code]..........
View 2 Replies
Apr 23, 2009
When game starts, the car runs automatically. Then we click the SPACE button, movement of car stops. And the door of structure near car is available to CLICK.
But in coding I got this error code:
TypeError: Error #2007: Parameter listener must be non-null.
at flash.events::EventDispatcher/addEventListener()
at shfg_fla::MainTimeline/key_pressed()
This is some part of my game code...
case Keyboard.SPACE :
removeEventListener(Event.ENTER_FRAME,car_movement);
--street_mc.bluehome_mc.door_btn.addEventListener(MouseEvent.MOUSE_DOWN,door_ready)
[Code]....
View 1 Replies
Jul 4, 2009
I have a question about making a function for two different kinds of event. It's not critical but I would like to reduce my lines of code and just be more efficient. Basically I have a button on the stage called "Enter". I also want the user to have the option of hitting the enter button. I don't have a problem making these two separate handlers for these events (i.e. one handler for the KeyboardEvent and one handler for the MouseEvent):
[Code]...
View 1 Replies
Oct 24, 2011
how can you switch the mouse event with keyboard event in the folowing example:
Code:
var qno=0;var rnd1; var rnd2;
tick.visible=false;cross.visible=false;
var right_answers=0;var wrong_answers=0;
[Code]....
i know that u have too define key up and down functions and in the beginnig give the keys we are using the false value, but how to make it that after i pess of a key you cant press in again unless you go to the next question that is the enable_disable in the following code. How would that function looked in case of keyboard event
View 1 Replies
Jan 28, 2010
i'm just new to actionscript, how will i trigger an javascript function when i click the button play and also when i finished playing an mp3 file song?
View 0 Replies
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
Apr 4, 2008
im wanting to create a simple feature in my flash ap that allows a user to select if they want voice overs played or the standard beep beep (fashy sounds) i have three buttons (onBtn, offBtn and rollMe). does anyone know how i could do somting like... if onBtn is selected then.. on rollover 'rollMe' mySound1.start(); else if offBtn is selected then... on rollover 'rollMe' mySound2.start();
View 6 Replies
Dec 4, 2009
How can I increase/decrease the volume of a Sound on key-press in ActionScript 3.0
View 4 Replies
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
Aug 28, 2011
I'm trying to control my mp3 sound clips with keyboard commands and have managed to get this to work with internal sound clips:
//************************************************** *************
var note2:b = new b();
btn2.addEventListener(MouseEvent.MOUSE_DOWN,playNo te2);
function playNote2(event:Event){
[code]....
View 3 Replies
Jul 5, 2009
ok so i am trying to change a boolean with a keyboard event
my code is this:
Code:
stage.addEventListener(KeyboardEvent.KEY_UP, keyPressed);
function keyPressed(evt:KeyboardEvent):void {
if (evt.keyCode==Keyboard.SPACE) {
if (!gamePaused) {
[Code]......
View 1 Replies
Nov 28, 2010
I am creating a game where you have to use the up and down buttons on the keyboard to avoid movie clips. For some reason it won't register when i press the keys down. Here is my code:
[Code]...
View 2 Replies
Jul 31, 2009
I'd like to arrange things so that I have a chain of keyboard event handlers in my flex application, all of whom are queried when key down events occur. Basically, when a visual component is on screen, it is a candidate for handling a key press event. Something like this (clearly this is pseudocode):
<application handles_keys="F5, F6">
<tabGroup>
<tab1 handles_keys="pgup, pgdn">
<control handles_keys="0,1,2,3,4,5,6,7,8,9" />
[code]...
I have a class written that will respond to the key events the way I want it to, so how do I register one or more instances of this class to have the results I want? Also, note that there are some situations where this class should receive events that would ordinarily be handled by a UI component. The TAB key is the main example; I have a few cases where I want my key down event handler to fire even when the focus is on a text field.
View 3 Replies
Mar 29, 2012
I'm trying to detect keyboard input and if the arrow keys are pressed, set the players next move to whatever was pressed. I'm listening for keyboard input using:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
This is the function that gets called:
public function keyDown(event:KeyboardEvent):void
[code]....
View 1 Replies
Dec 29, 2010
Tracing the keyCode for the 'a' key (65) only works once for KEY_DOWN events and sometimes KEY_UP behaves in the same way, making development a pain when trying to do things quickly.
Clicking on the stage makes it start working, but why is it just the 'a' key that is affected?
This is on a new MBP running OSX 10.6.5, Flash version MAC 10,1,102,64
[URL]
The issue can be reproduced every time with this code:
ActionScript Code:
import flash.events.KeyboardEvent;
stage.addEventListener (KeyboardEvent.KEY_DOWN, keyDownHandler);
[Code]....
View 4 Replies