ActionScript 2.0 :: Add Click Sound To Mc Instance?
Jan 17, 2007The buttons of my menus are mc with instance names. I want to play a click sound on each of them on rollover.
View 8 RepliesThe buttons of my menus are mc with instance names. I want to play a click sound on each of them on rollover.
View 8 RepliesI am loading my movie clips dynamically. Is there any way I can get the instance name of a movie clip when I click on it with a mouse?
View 2 Repliesvar sound_[infotoload]:Sound = new Sound();
This doesn't work. I want sound_01 sound_02 sound_03 sound_04
I am attempting to set a movie clip's instance name to a string variable when clicked. For example: on my stage I have many mc instances named section101, section102, etc. when I click on any specific one I'd like to get the instance name (i.e. "section101") set to a string variable. So far I have:
var sectionfocus:String = new String;
addEventListener (MouseEvent.MOUSE_DOWN , setfocus );addEventListener (MouseEvent.MOUSE_UP , tracefocus );
[Code].....
I have some sounds in my library that I want to play in a soundchannel, but how? This is what I have so far:
var music:Sound = new Sound();var channel:SoundChannel = new SoundChannel();var sTransform:SoundTransform = new SoundTransform();var sound:SoundFile1 = new SoundFile1(); // Note: SoundFile1 is a class; in it is my soundfile in the library// music.load(sound); ??channel = music.play();
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.
I've been learning AS3 lately and am trying to put together an interactive map. I've brought in some map data and converted it to individual movie clips, each of which has an instance name that I'd like displayed when each clip is clicked on. ideally an informational box would appear with the name of the clip and some other info that I've specified.
What do I need to script so that if one clicks on a movie clip, the instance name is displayed?
I am using a loop to add 10 shapes to the stage, then i just want to click on one at a time, in any random order and make it alpha 0, im using this code.. it gets rid of some shapes but not all. i dont get it?
Code:
var shape:MovieClip;
for (var i:Number = 0; i < 10; i++)
{
[Code]....
I want to create a class where when you mouse click on an instance of it, all other instances are notified about this click.
I want this functionality to be inside the class so there wll be no need to write any code outside the class definition, like assigning listeners to all instances and such.I wrote the following code but the event I dispatch doesn't get catched.
package sample{ import flash.events.EventDispatcher; import flash.events.MouseEvent; import flash.display.MovieClip; import flash.events.Event; public class labels extends MovieClip { var dispatcher:EventDispatcher = new EventDispatcher(); public function labels() { this.buttonMode = true;
[code]...
It used to happen in AS2.0 as follows :
my_Mc.onPress = function()
{
trace( this)
}
//output :
[my_Mc Movieclip]
[Code]...
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)---
Imagine this scenario:The application is a Game, where the enemy characters can 'attack' the player, and each time they attack the 'Attack.mp3 file is played from the libraryNow my question is, if I have to create a new instance of the MP3 file in the memory, each time playing it, or can i use a 'master' Sound instance ,that I can play multiple times simultaneously.(similarly I can use one 'enemy.jpg' bitmapdata, that I can then copy to the screen with copyPixels, and only having it in the memory just once )IE if i have 50 'Enemy' characters running around the game
View 1 RepliesI'm using as3, i want to have the GunShot sound play every time the player clicks the mouse. not sure how to make it work. the code i am using is
Code:
mouse.addEventListener(MouseEvent.CLICK, playSound);
function playSound(event:Event){
[code]....
How can I edit sound from a timeline if I don't have the original sound file? When I right-click my sound in the library, I can't open it in any sound editor program. What do I do?
View 3 RepliesI have some code on my button that should play my sound file, but when I run my FLA, it shows an error. The error says, "Scene 1, Layer 'Layer 1', Frame 1, Line 1 1046: Type was not found or was not a compile-time constant: button1" Does anyone know how to fix this? I have exported the sound in actionscript but nothing?
View 2 RepliesI'm currently recording sound and storing the byte array for playback and subsequent encoding to mp3.
Unfortunately though I am getting a click sound at the very beginning of the recording.
I have attempted a couple of methods to try to eliminate this such as:
recording the first .3 seconds with mic.gain = 0; then setting mic.gain = 50; clearing the byteArray after the first .3 seconds then continuing to write the bytearray (in effect deleting the first .3 seconds of the recording.)
Neither of those methods has stopped the click being added.
how I can prevent the click from being added?
Here is my recording/storing code:
public var mic:Microphone = Microphone.getMicrophone();
public var micSilence:uint;
private var soundBytes:ByteArray = new ByteArray();
private var soundBA:ByteArray = new ByteArray();
[Code].....
Anyone know how to make a sound (picked at random from a selection in the library) play when a button is clicked?
View 2 Replieshow do i play a sound on press?
View 3 RepliesI have a scrollplane instance onstage that I need to skin, but flash is not allowing me to double click the instance to edit its timeline. Does anyone know why this may be?
View 1 RepliesI am trying to delete a single line using graphics.clear() method but it clears all the instance of lines created by lineTo() method. I want to remove a single line upon click from bunch of its multiple instance.
View 2 RepliesA graphic of a piano keyboard with hot spots on each key when the user clicks two things happen.The note plays from a sound file a small graphic of the note displays where the note is on the staff and give the user the name. It stays until they move the mouse but the not only sounds once per click.
View 5 RepliesThe sound only plays when I hold the mouse button down. I need it to play when I click it. But it has to stop the sound from playing twice import flash.media.SoundMixer; this.addEventListener(MouseEvent.MOUSE_UP,f); function f(e:Event):void{ SoundMixer.stopAll(); } here is a link to my swf file [URL]
View 4 RepliesI want a link to trigger a sound click in flash AS3. I've taken the .play() outside of the function to confirm that it works by itself. What am I missing that will let me call an AS3 function from javascript?
Here is my html
<object width="5px" height="5px">
<param name="movie" value="play_coin_sound/playCoin.swf?v=5">
<param name="wmode" value="transparent">
<embed src="play_coin_sound/playCoin.swf?v=5" width="5px" height="5px">
[Code] .....
Sound Exported to Actionscript with name: shoot onPress:shoot starts?
View 3 RepliesI have a movie clip with a sound at the beginning of my project, and when I click a button in another scene it starts playing the voiceover from that clip. I don't have the button linked to that clip.
View 2 RepliesI 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].....
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.
I am making a gun game, and I want to make so that it plays a sound when you click the mouse.I have the sound already imported, and i am using it in an external (.as) file for a pistol. I've spent hours incorporating it into a movie clip, but it either plays over repeatedly or just doesn't even go.Is there any way to do this? Ive tried lots of tutorials before I came here but nothing seemed to work
View 4 RepliesI found this code to play sound:
myButton_btn.addEventListener(MouseEvent.CLICK, buttonIsClicked); [code]....
I got it working fine, but was wondering how to program a function for another button to stop stop playing that sound?I tried a function with snd.stop(); but that seems to be incorrect.
i know this is a problem allread often talked about, but i cant solve it.i want to start and stop a sound with a mouseclick event.the problem seems to be that the click event is never triggered. can anyone see why?
[Code]...