ActionScript 3.0 :: MovieClip Sound Not Playing On MouseEvent?

Jul 13, 2010

Why won't my sound play? It should play on Mouseover and stop on Mouseout.

stop();
import flash.display.MovieClip;
import flash.events.MouseEvent;
var req:URLRequest = new URLRequest("squeeak.wav");
var sound:Sound = new Sound();
var controller:SoundChannel;
function soundLoaded(event:Event):void{
controller = sound.play();
[Code] .....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: MouseEvent To Start Current MovieClip Playing?

Jan 31, 2011

Clicking a button to start the current movie clip playing. In the following example, playButton is the instance name of the button, and this is a special name meaning "the current object":

Actionscript Code:
this.stop();function playMovie(event:MouseEvent):void {
this.play();}playButton1.addEventListener(MouseEvent.CLICK, playMovie);

View 2 Replies

ActionScript 3.0 :: Get MouseEvent.ROLL_OVER Or MouseEvent.MOUSE_OVER To Pass Through To MovieClip Underneath

Jul 9, 2009

I have a MovieClip (call it base_mc) which is under a bunch of other MovieClips (call them subclips). The MovieClips on top are all mouseEnabled with MOUSE_OVER, CLICK, etc, event handlers. I want to capture the event of MOUSE_OVER (or ROLL_OVER) on the base_mc as well. Any time I am over one of the subclips I am also over the base_mc clip. How can I capture this event?

View 2 Replies

ActionScript 2.0 :: Stop Mc On Mouseevent And Assume Playing With Delay?

Feb 23, 2009

Does anyone know how to:stop a movieclip on mouse click, make the movieclip wait for, say, 3 seconds and then assume playing again from the same frame that it stopped on

(The movieclip is an instance on the main stage, the actual footage is placed in a seperate mc)

Im using Flash 8 (gave up on 10 as I realised I would have to post questions here on how to make a simple button )

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 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

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

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

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

Flash :: AS3 MouseEvent.MOUSE_MOVE Event Stops Responding After MouseEvent.CLICK Call?

Nov 6, 2010

I have several stage event handlers to enable mouseovers over several dynamically generated moviecilps on the stage that then change their alpha to indicate the mouse is over that particular mc... fairly trivial (mcOver handler). Additionally, I also want to know what MC is clicked, so I update a public variable (public var activemc:Number) with the ID of the dynamic movieclip when the mouse is over it (using a hitTest to check, which is why the EventListener is added to stage and not to the MC), which is checked in the mcClicked handler:This is in the constructor:

//stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
//stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);[code]....

However, the mouseover behaviour (alpha 0 when over, alpha 1 when out) stops working as soon as I click on any movieclip on the stage, and the mcClicked ID checking (below) stops working completely. I don't know if this is to do with focus:

private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
}

I then tried adding the event handler for the stage mouse_move again and this gets the mouseover working again but only for 1 more click, after which it stops again:

private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);

View 1 Replies

ActionScript 3.0 :: Flex - Diffrence In MouseEvent.CLICK & MouseEvent.MOUSE_DOWN?

Oct 21, 2010

I'd like to know what is the difference between MouseEvent.CLICK & MouseEvent.MOUSE_DOWN. Because when i use MouseEvent.MOUSE_DOWN for a button to set full-screen view its doesn't work, instead of this MouseEvent.CLICK works. So what was the reason.

View 3 Replies

ActionScript 3.0 :: MouseEvent.MOUSEDOWN Works But MouseEvent.CLICK Doesn't

Nov 6, 2010

I'm making a button for the first time, and I wanted to use a full click to drive it. However, when I use addEventListener(MouseEvent.CLICK, onClickHandler); nothing happens when I click on it. When I use (with the rest of the code being identical) addEventListener(MouseEvent. MOUSE_ down, onClickHandler); it works like a charm.

View 6 Replies

MouseEvent.CLICK Not Registering For MovieClip?

Oct 4, 2009

I have th following code below. When the monster is clicked I would like to remove it but the MouseEvent.Click event never fires? I'm using flash cs4.
 
import fl.motion.Animator;import fl.motion.MotionEvent;var this_xml:XML = <Motion duration="30" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">    <source>       [code].......

View 2 Replies

ActionScript 3.0 :: Difference Between MouseEvent.MOUSE_UP And MouseEvent.CLICK?

Apr 7, 2009

What is the difference between MouseEvent.MOUSE_UP and MouseEvent.CLICK? Why should I use one of these over the other? 

Code:myButton_btn.addEventListener(MouseEvent.MOUSE_UP, fNavigate, false, 0, true);
myButton_btn.addEventListener(MouseEvent.CLICK, fNavigate, false, 0, true);

View 3 Replies

Actionscript 3 :: Cancelling MouseEvent.CLICK After MouseEvent.MOUSE-DOWN

Aug 11, 2011

I have a MOUSE_DOWN handler that creates a CLICK event listener on a child object. Naturally, as soon as you release the mouse button, if you happen to be over the child object, the CLICK event fires.I was disappointed to discover that event.stopImmediatePropagation doesn't interrupt the CLICK event from registering the MOUSE_DOWN as part of its detection cycle. It makes sense that it doesn't but still... disappointing.A MouseEvent.CLICK consists of detecting a MOUSE_DOWN on the object and then if it's followed by a MOUSE_UP without leaving the object, he event fires. I had hoped that by cancelling the MOUSE_DOWN event, it would clear that out of the CLICK buffer, but no such potatoes, alas.This could all be handled with a flag and a couple more MOUSE_UP and MOUSE_DOWN handlers, but dang, smacks of effort

View 2 Replies

ActionScript 3.0 :: Put A MouseEvent Listener On A Movieclip/sprite?

Mar 13, 2009

It's never been an issue since I always anticipate it but just wondering...

if I put a MouseEvent listener on a movieclip/sprite...

Code:
whatever.addEventListener(MouseEvent.CLICK, clickAction, false, 0, true);
function clickAction(e:MouseEvent):void {
trace(e.target);
}

that traces a movieclip inside the intended target...

View 2 Replies

ActionScript 3.0 :: Disable MouseEvent.CLICK Events On A MovieClip

May 12, 2009

Suppose, I created a MovieClip(with instance-name= "myClip") on the stage. If I need to process MouseEvent.CLICK event on this movieclip(myClip), then we use addEventListener(bla.... bla...); method.
 
Now, my requirement is, in certain case, I do not want to occur any MouseEvent.CLICK events on this same movieClip(i.e., myClip).Then, How to do this? (or) What is the method/class used in this context?
 
Atlast, My requirement is: How to remove/disable Mouse_CLICK events when occur on a MovieCLip.

View 1 Replies

ActionScript 3.0 :: MouseEvent - Display / Hide MovieClip On Stage

Dec 7, 2009

I am having trouble getting my menu to work. I want when you click a button it displays a movieclip on stage and then disappears when you click a different button. Error occurs at line 88 (I bolded it}.

Vmfa.as:
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.text.*;
import flash.display.MouseEvent.*;
[Code] .....

View 2 Replies

ActionScript 3.0 :: Detect If The Target Of A Mouseevent Is A Child Of A Movieclip?

May 29, 2010

I have a parent movieclip with a few other movieclips inside it. When I add a mouseclick eventlistener to the stage and click on one of the children, i want the target of the event to be the parent movieclip. I still need the children to be mouseEnabled.

how do you check if a movieclip is a child of another?

View 9 Replies

ActionScript 3.0 :: MouseEvent Doesn't Work On Loaded MovieClip

May 4, 2011

I'm having a problem with adding a MouseEvent listener to a Loaded MovieClip. The loaded MC is a single frame and contains two animated MCs. There's some MouseEvent listeners already on the two MCs. Here's the code in my loader SWF:

[Code]...

View 4 Replies

ActionScript 3.0 :: Disable MouseEvent.CLICK Events On A MovieClip?

May 12, 2009

My issue starts here:Suppose, I created a MovieClip(say, instance-name= "myClip") on the stage. If I need to process MouseEvent.CLICK event on this movieclip(myClip), then we use addEventListener(bla.... bla...); method.Now, my requirement is, in certain case, I do not want to occur any MouseEvent.CLICK events on this same movieClip(i.e., myClip)Atlast, My requirement is: How to remove/disable Mouse_CLICK events when occur on a MovieCLip.Here, I try to disable the MouseEvents because, The MovieClip must be visible but should not accept any Mouse_CLICK events on it

View 4 Replies

ActionScript 3.0 :: MouseEvent Target MouseEvent RelatedObject?

Jul 24, 2009

I have the following:
 
rwBtn.addEventListener(MouseEvent.MOUSE_OVER, audioOver);
function audioOver(e:MouseEvent):void
{
var thisClip:MovieClip = e.relatedObject;
thisClip.alpha = 0;
}
 
I would like to change the alpha of the clip that is being rolled over. I don't know how to target the clip that is being rolled over. How do I do that?

View 3 Replies

Flash :: Forward MouseEvent In Transparent Bitmap To Underlying MovieClip

Mar 24, 2011

So I'm Bitmaping some heavy stuff to try bring down the [pre-render] and [render] which is quite high according to FlashBuilder's profiling. I thought this was going well until I realised that as soon as you change a MovieClip to a Bitmap, you lose the pixel based accuracy of the mouse move events (Over, Out, Move...), all your left with is the entire bounding box of the Bitmap, something which is less than desirable. I've got a game where many Bitmapped assets would be on top of each other in a scene, on the stage, arranged in various ways and need to have that pixel accuracy moving between each one and have exhausted my efforts as to how to achieve the same mouse move results with the Bitmapped guys as normal.

This, [URL], is a FLA which shows this operation, and you can see how it works here, [URL]. When it loads up, both items on stage are drawn Shapes, encapsulated in MovieClips, both that get a glow, if you hover over them. If you click the stage at all, the purple guy gets turned into a Bitmap and now, his 'hit area', when it comes to MouseEvents is his whole bounding box and you can only get through to the back green item at the edge slivers.

I'm also tracing the pixel which the mouse is over, so I can clearly tell when the mouse is over a transparent area, it's 0, but how can I tell the event to forward itself on down the chain to the green MovieClip?

Below is how it's now pretty much working for me,

var bitmap:Bitmap = this['bitmap'];
var shouldMouseOver:Boolean = bitmap.bitmapData.getPixel(event.localX - bitmap.x, event.localY - bitmap.y);
if(shouldMouseOver)

[Code].....

I shut off mouseEnabled for my item, when I know it's wrong, then I search for another item that properly fits the bill and if there is one, send an Event to that and break. If that one's also wrong, it'll do the same again, but each time taking themselves out of the loop.

This does work exactly how I want it to, but I'd always prefer to keep things like globalToLocal and looping, and reading from arrays for not frequently updated methods like listeners to MOUSE_MOVE. Is there a more efficient way to do this?

View 2 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

HitTest Was Playing The Sound Over And Over?

May 20, 2009

I have a playhead that moves across the screen and when it hitTests a movie clip it plays a sound. all is working fine except that it will only work the first time it is played. The playhead is controlled by a button. I am working in Actionscrpt2. Here is the code on the movieclip:

onClipEvent(enterFrame)[code]....

In the begining I was having trouble because the hitTest was playing the sound over and over but the above code sorted that out. I think that the new problem was created by fixing the old one.

View 7 Replies

ActionScript 2.0 :: Sound Playing Only ONCE

Nov 13, 2009

I want to achieve the effect of a computer startup. IE, it only plays -once- and then doesn't play again for the rest of the time, even if the user comes back to the same menu. How do I get Flash working that way? I've tried variables to no effect... it doesn't want to change the variable condition.

[Code]...

View 1 Replies







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