Home > > Stop Play action script 3 for mp3 on layer

Stop Play action script 3 for mp3 on layer

I this the wrong way to write a stop play for mp3 on layer.
I have buttons and sound within a movieClip.
Should I give outside movie clip instance name
play_btn.addEventListener(MouseEvent.CLICK, playSound);
stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
function playSound(e:MouseEvent):void {
function stopSound(e:MouseEvent):void {
The code you show should work so you may have some implementation issues.
For the stop button error you should go into your publish settings and select the option to permit debugging so that the error includes a line number for what's causing the error.  A 1009 error indicates that some object your code is trying to target does not exist as far as the code sees it.... which can be due to a number of reasons, such as assigning code in a frame where the targeted object does not exist.
For the second error, it appears to be an issue loading (or possibly finding) the file.  Does the sound start playing on its own when you first run the code?
Usually an error of any kind will prevent a file from running properly, so it may just be an issue of fixing just one of them.
You normally don't have to wait for a sound file to completely load before executing a play command... that woiuld be counter-productive to the concept of streaming sound.  In theory, a play command following a load command will execute but the sound will not start until a sufficient buffer exists.
Read the other 6 answers
hi i am daily batch processing with an action script to make flat tiffs from psd layer files, like 10-100 files every couple of days in my workflow. until now i could not fine a solution to begin the batch processing-action with opening layer files F
Hello, Can someone give me an action script which could position my layer on specific Y location depending on height of text. I have a hundreds of PSD files with text. Each text has a different height. I need a script which would put the text of ever
Hi, I am trying to create an action script that will move a layer 90% to the left or right. Can this be done thru actions or is it something that can only be done via JS Scripting. The reason I need percentages is not all images are the same dimensio
i have made a introduction with a  audio and controller. I am facing one problem. I will like to play as  soon as some one enter the page but it does not. My action script is pasted below and kindly advise me for any changes that can be done var soun
In my Captivate 8 project I use smart shape as buttons. The buttons have different images presented dependent on the state of the button. I have also created a simple action script that shows what happens when the button is pressed. When the button h
how can i add data to a grid row called name in action script. i have a cfselect control containing name of students and i want to add the values of the selected student from the list to grid.Did you add your instance of SpectrumCanvas to the stage w
Hi, I am trying to edit an old flash file that uses Action Script 2.0. I am using CS6 and keep getting the following error message after publishing: Scene 1, Layer 'AS', Frame 1, Line 5, Column 29 1067: Implicit coercion of a value of type int to an
using action script 2 how can i send a variable value to a dynamic textbox on a different keyframe?Thanks for your swift response. That sounds like a good solution, but the code I have on frame 2 is this timer = 0; countup = function(){ timer++; coun
Hi I am developing an application where I need to load a child.swf . All works fine when I load the mc but as soon as I add Action Script (lets say trace("test")) to the Child.swf I get a Error #1009: Cannot access a property or method of a null
I followed a tutorial on how to make an interactive photo gallery but for some reason the file isn't working. I am new to flash and no very little about action script. Would someone be willing to take a look at my file and advise me? ThanksDid your t
We are using OIM 11gR1 along with the AD and Domino connectors. We are also using Action Scripts to perform some post create actions on the AD and Domino resources that get created by OIM. The action scripts are being invoked with the correct set of
I can't get the original disk to work on a reinstall.  I get the message AdobeColorCommonSetRGB Error: Error 2. I teach a class using this program on Macintosh computers running 10.9.5 and the action script is not working.  It will work on any progra
Hello Guys! I created the following action script named "sketch.as" : package import flash.display.Sprite; import flash.events.MouseEvent; import com.adobe.images.JPGEncoder; public class sketch extends Sprite { public function sketch():void { /
Hi, If I am getting by source file as a big generation wise excel format and even properties in excel sheet with large number of custom property field values. Is making a Import action script out of the excel to load to DRM is the only way, or do we
Hi I have created an Action Script project in flash builder 4 and want to use a mx.controls.button. The as file looks like this: package     import flash.display.Sprite;     import mx.controls.Button;     public class as_test_project extends Sprite  
Alright please help.. I have tried everything, been fooling around with this in the past 5 hours and its not going anywhere :( . Here is what i have. : I have 6 menu buttons... Button 4 is what i am concentrating on. at the moment here is the current
I created an XML scrolling thumbnail gallery using a tutorial found here I then had to alter the action script to get my thumbnails to display properly -- they were spaced out or overlapping each other and not in the sequence specified in the XML fil
Hi - Firs time I'm on this board. Searched and didn't see anything that fit. Adobe/Macromedia Support told me my form needs an action script insert for me to gain access to a previous page. I'm revamping an online order form. It's about 2 1/2 pages i
Hi surfers, We have a problem in Action Script 2.0 to solve the maths equation given below: write a code in Action Script 2.0 to solve these two equation. Aim: To know the value of "a" in both different equations. 1. 2a + 5 = 3a + 1 2. 4a + 3 =