New at Flash, please help! Sound On/Off Button
I'm trying to create a button that when clicked once, it plays music, and when clicked again, it stops. I don't need the button image to change at all, I just need a simple start/stop.
I've been able to make the button start the music when clicked but I've not been successful in making it stop.
I am using CS4, and have no scripting experience.
This is for a graphic arts assignment so please help!
drag your button to the stage and assign it an instance name (eg, btn). you can then use:
var sound:MP3=new MP3();
var sc:SoundChannel = sound.play();
btn.addEventListener(MouseEvent.CLICK,f);
function f(e:MouseEvent):void{
if(sc){
sc.stop();
sc=null;
} else {
sc=sound.play();
Similar Messages
-
I am trying to create a simple slideshow. Each time a new
photo comes up, I need the viewer to be able to click and go to a
separate html page for each photo. I know this is very simple, but
I keep getting code errors. The first photo works, but after that,
I get duplication errors. Any help would be greatly appreciated.
This is what the original code looks like. I thought all I
needed to do was copy and paste it with each keyframe and then just
change the html redirect page.
inv_btn.addEventListener(MouseEvent.CLICK,
buttonClickHandler);
function buttonClickHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("
http://www.golfozarks.com/little_league/bk-auto/john-botson.htm"));
trace("");
The Flash is playing right now at
http://www.golfozarks.com/little_league/bk-auto/roster.htmWithout seeing what the errors are saying I am only guessing
that the duplication may be regarding the addEventListener
attachments. You may be able to get away with using:
inv_btn.removeEventListener(MouseEvent.CLICK,
buttonClickHandler);
ahead of each secondary (after the first frame) assignment of
adding the listener.
Another more efficient approach would be to have the
buttonClickHandler and event listener remain constant, but pull the
urlRequest out as a separate variable and only change its value for
each player's frame.
So you'd have a layer that spans all other layers that
contains the url variable declaration, event listener assignment,
and the buttonClickHandler function, and only in the first frame.
var url:URLRequest = new URLRequest();
inv_btn.addEventListener(MouseEvent.CLICK,
buttonClickHandler);
function buttonClickHandler(event:MouseEvent):void {
navigateToURL(url);
Where only the url value changes with each player frame:
url = "
http://www.golfozarks.com/little_league/bk-auto/...etc" -
I have added a flash banner to a website that I have built
http://www.mauitropicalsoaps.com.
I am not sure if this is possible because this is the first time
that I have used flash, but I am wondering if there is a way to not
have the border around the flash when you put your mouse over it.
The border i am talking about is the one that pops up when the
title tag pops up saying press space bar or click to activate this
control. Any help with this would be great! Thanks!http://www.adobe.com/devnet/activecontent/
-
my i phone 4 cannot charge continously. it will charge then after few seconds its off then charge again. I cannot open it because it runs out of battery do i need a new battery?please help.
You could always check to make sure itunes is updated to 10.7 but im sure gdgmacdude is
right.
thanks
gdgmacdude
Hey dude
are there anymore hardware failure errors u know of
im kinda a novice apple man and could use all the help i can get
capp -
Hi can anyone help me. I have a apple macbook laptop OSX 10.5.8 . When i push print, it shows my printer but says cannot communicate with printer. (epson stylus nx125). Do I need new drivers? Please help . regards Cindy
Welcome to Apple Support Communities. We're users here and do not speak for "Apple Inc."
Some basic printer troubleshooting steps before worrying about a printer driver:
1. Have you tried turning the printer off and back on?
2A. Is the printer attached with a cable?
If yes, have you tried unplugging and re-plugging both ends of the printer cable?
If that does not help, can you test the printer with another cable?
2B. If your printer is not connected to the computer with a cable, have you tried restarting your printer (assuming wireless connection)?
Have you tried restarting your wireless router?
3. Have you tried restarting your MacBook? (Be sure to save your work first.)
4. Does the printer have ink? (Doesn't usually generate a 'communications error' though)
5. Have you updated OS X or the program you're trying to print from recently? -
Is there a way to run a 2005 PreSonus Firebox(with the firewire) to a mid-2011 iMac 0SX 10.7.2? It says its no longer supporting Power PC? Anything I can do without spending more money on new equipment or a new computer? Please help me.
Nevermind, I got it working.
I ended up extracting the new vob within MPEG Streamclip, which gave me an m2v and an aiff audio. I multiplexed those two back together in FFMpegX which gave me a complete VIDEO_TS folder with BUP and IFO files I needed. -
Hello Guys.
I had problems in the Computer before and changed my HD. I saved in my all files documents in (Time Capsule). How can I put all my files, pictures documents on my new HD?
Please Help.
Thank You
Julio SkovHey
Thank you very much for replay.
Would you explain to me how can I do?
I don't really understand these processes.
Thak you very much
Julio -
I purchased an audiobook in Nov 2012 using iPhone 4S and then upgraded to iPhone 5 in Dec. Now I am not seeing the audio book in purchase history in iTunes. This means I am not able to get the book in my new iPhone. Please help.
Audiobooks are currently a one-time only download from the store. If you don't have it on your computer (audiobooks go into the Books part of your iTunes library) nor on a backup, then if it's still in the store you can try contacting iTunes support and see if they will grant you a re-download : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page
-
I have no trouble viewing apps in the iTunes Store on my iPad. However, every time I try to install a new app, I get an error message after a while - cannot connect to iTunes Store. This issues cropped up two days ago on my new iPad. Please help...
JUst experienced the exact same problem after changing password.Getting same message. Hope someone has an answer for this.
-
my osx version is 10.8.2. i was buying the facetime app for my mac. i got this error -"FaceTime can’t be installed on “Macintosh HD” because the version of OS X is too new." so please help me out of this funny situation.
https://www.apple.com/support/mac-apps/facetime/
-
Can a one please help me turn off auto play for Facebook the option is no longer in my General settings why is this ?
And yet the link you posted only tells you how to do it on the Facebook App for Android. Nothing about the Facebook page is mentioned at all, or how to do it on an iPhone.
With that said, and assuming you have the most up to date version of the Facebook App, you can now turn the auto play feature Off within the Facebook App itself. Tap on the "More" icon on the bottom right, then scroll down to Settings->Videos and Photos->Auto Play. If Smart auto-Play is on turn it off. Then you can set the check mark on "Never Play Videos Automatically" which is the same as Off. -
NEED NEW CARD! Please help
Alright, well my dumbass roommate decided to plug in his super nintendo to my TV@nywhere card. To make a long story short, he messed something up. The computer wouldnt boot. It would get to the windows screen and freeze. I formatted, problem was no more, untill I installed the VGA drivers.
So now I cant do anythign with my screen, if I install the drivers, it wont boot.
Now I plan on just getting a new VGA card. Was looking at some nVidia products, but I am uncertain what to get. I want to spend $50 or less (eBay).
I have the MSI 651 MEGA PC. It says it has a APG 4x x1 slot on board, so I was just wondering what suggestions you guys had for a new card. Please help out if possible, thanks!Try the second hand ATI 9600XT.
-
I want to transfer my Adobe CS3 licence to my new Laptop.
Please help me for Deactivate Adobe CS3 licence from old LaptopHi sanket chalke,
I'm not sure what Adobe product you need help with, but you might want to start with this document, which has deactivation information: Activation & Deactivation Help
Please let us know how it goes.
Best,
Sara -
i have less than 5 authorised computers. yet cannot authorise my new iMAC27. Please help..
Hello Morfaly,
Thanks for the question. The following article may provide a solution to your issue:
iTunes: Missing folder or incorrect permissions may prevent authorization
http://support.apple.com/kb/TS1277
Thanks,
Matt M. -
I have been trying to get the full version of lightroom after using a trial version but it says something about "GB" ? And i need to log into different account or set up a new one? Please help?
I would love to give you more information but i cannot access that page again? i can add Lightroom to my cart but when i go into my cart it says there is nothing in there? I have a red bubble above "my cart" with a number 4 in it to show there is something there but there is not? It just wont let me buy anything?
Maybe you are looking for
-
Cannot connect HP1102w to Mac with OS 10.8.5
"Cannot install the software for the HP 1102w because it is not currently available from the Software Update server". I downloaded software per the link on another similar post http://support.apple.com/kb/DL907 I dragged the package icon to Applicat
-
Hi experts, I would like to know if there is any standard BAPI or RFC to Execute DP90 transaction in CS. This is in order to do the complete service order creation cycle through a small application in Enterprise Portal. Can any one please help me out
-
Read cluster PCL4 .. takes lot of time
Hi guys, Though I Know this is a functional related forum, i would want to post techincal question related HR ABAP. I have a report that needs to read data from PCL4 cluster and display master data changes for an employee. Developed a big program
-
Block throws exception ?
is it possible to suggest that a block will throw an exception ... i.e.:static throws Exception { } is invalid ... i suppose its not possible ... ?
-
When trying to import videos, pop up says not the right kind of document
I am on photoshop elements 13 editor, trying to import videos. A pop up says could not complete your request because it is not the right kind of document. Any solutions?