Sound on/off by click a button in flex4????
hello everybody, i want to make a website by flex.in that have sound effect. i want when i load page have sound and if i don't want to listen i can click button.the sound will stop play and else. But i don't know how to make on/off sound by a button click
i done:
in actionscript file Sound_playExample1.as: i write code
package myComponents {
import flash.display.Graphics;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.ProgressEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
public class Sound_playExample1 extends Sprite {
private var snd:Sound = new Sound();
private var channel:SoundChannel = new SoundChannel();
public function Sound_playExample1() {
var req:URLRequest = new URLRequest("myComponents/soundall.mp3");
snd.load(req);
channel = snd.play(0,6);
// ActionScript file
in my Main.mxml:i write
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:MyComp="myComponents.*"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
protected function button1_clickHandler(event:MouseEvent):void
// TODO Auto-generated method stub
]]>
</fx:Script>
<fx:Declarations>
<MyComp:Sound_playExample1/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button x="177" y="71" label="Button" click="button1_clickHandler(event)"/>
</s:Application>
can u help me please what i have to do. if you know you can
Additional for this code.thanks
// below code sinppet should go into on button click event handle method.
if
(pausePosition==0 ){ if(channel!=null){pausePosition = channel.position;
channel.stop();
sound.setStyle("icon",soundOffClass); // mute
}else{
if(channel!=null){channel.stop();
channel = snd.play(pausePosition);
sound.setStyle("icon",soundOnClass); // un mute , this should be default as
pausePosition=0;
Similar Messages
-
Why sound goes off after click on dashboard
Why sound goes off after click on dashboard
All sound or just iTunes?
Try disabling your Widgets one at a time, cause it sounds like maybe you have one that is taking control so that it can be heard?
Dennis -
Playing basic sound ( *.wav ) through a click of button ?
Hi Java experts:
Need to know the Java code to be added to a click button 1 to play sound ( *.wav ) and the code to stop the sound through and other click of button 2.
Using a normal applet
Thank you in advance
M C BenzerariSee...the scenario is something like this : I have a main application running into a JFrame instance. Now, from a menu item in this JFrame, I have opened the modal JDialog. And from this modal JDialog, I have created a JFrame. Now I am not able to focus and perform any operation on this JFrame unless I close the JDialog from which it was created.
Please suggest some workaround so that without closing the JDialog, I am able to fire some event from the JFrame which is being created from this modal JDialog.
Thanks,
Gauri -
Make sound play when I click on button in DWCS3
Sorry about this nube question. I appreciate the patience of
the person who helps me. I just want to link a short sound to a
text item in DW. ( I don't want it to play in a separate window).
Thanks!Go to > App store > Store > and click on Sign in.
-
Keyboard clicks and lock sounds are off even though the settings show them as "on". How to get them back?
Use the volume buttons on the side of the phone. Personally, I find it's better with those off completely.
-
Where in god’s name is the homesharing button, I see a little cloud that you cannot click on and tells you what account you have but that's it. There's an option for turning on and off homesharing, but no button to access the actual library of the other PC. On either PCs. Both are logged in and both are registered for homesharing. however because apple keeps updating and moving things around for no reason there appears to be no way of accessing the homsharing button in the latest version of itunes. the website refers to " Once set up, all the libraries from your computers you've enabled Home Sharing on will show up in the SHARED area of iTunes:" well I have searched all over in the recent itunes versions and there is no "shared area" to be found.
Please find the attachment of a screen cap of my itunes.
If anyone can help by telling me where it has been moved to or if it even still exists that would be much appreciated.Welcome to the Apple Community.
-
Yesterday double clicked home button and all of my apps disappeared; cannot shut off i-pad, and syncing it does not restore apps or enable me to use it again. Help!
See if this fixes things.
Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up. -
Change sounds, by clicking same button
I need to create a button, that will play one sound at a time
when it's being clicked, switching to a different sound from the
library each time it's clicked. (I have about 10 sounds at the
library I need to rotate when the user keeps clicking the button.)
I'm new to actionscript, so I apologize for not, having any
code to start with! I've looked everywhere online and can't find a
tutorial for this. Any help would be appreciated! Thanks!Actually, I got it to work - I just removed the line
s.stop( );
and I changed
s.indexVar=0;
to
s.indexVar=1;
so here's the code as it is now:
s=new Sound(this)
s.indexVar=1;
soundbtn.onPress=function(){
s.attachSound("sound"+s.indexVar++);
if(s.indexVar>9){
s.indexVar=1;
s.start();
} -
How to Track Clicks on Buttons, Triggers and Drop-Offs
In my presentation, I want to be able to keep track of every time someone clicks a button and what button they click. I also want to be able to keep track of when people drop off from the presentation. Is this possible with Captivate?
Thanks,
Vinceadd a stage covering rectangle to the lowest layer of your external swf and make sure the stage sizes of the loading and loaded swf are the same. convert that shape to a movieclip and assign an instance name (eg, bg_mc). in the actions panel, you can use:
bg_mc._alpha=0;
bg_mc.onRelease=function(){
bg_mc.useHandCursor=false; -
Debug mode switches off after clicking button
Hi there,
I am trying to use Debug Mode in order to track down a problem, but when I click an application button on a page Debug Mode is being turned off so I do not get the debug output that I am after.
In brief, I am doing the following:
1) Editing the page in Application Builder
2) Clicking the "Run" button to run the page
3) Clicking the "Debug" button to turn Debug Mode on. The page is then redisplayed with debug ouput among the page items.
4) I then type some text into some fields in a form region and click a button in the same region to create a record. The same page is then redisplayed but Debug Mode has now been turned off!
I then tried something similar using the example ORDERS schema under a different workspace and username, and this time Debug Mode remained switched on until I switched it off explicitly.
Is there something I have to do to keep Debug Mode switched on?
Regards.
John.John,
The branch defined on the page determines whether the current setting of &DEBUG. is used in the URL redirected to. Normally, that wouldn't be set. You'd have to edit the branch (and make it an f?p URL with &DEBUG. or YES in the debug position.
Scott -
I have the 5S and there is a check mark next to no sound when phone is in lock mode that prevents me from getting my calls and messages. How can I turn that off? Clicking it does nothing. Please help! Thanks!
Thanks for taking the time to try to help me. . I checked and the Do not disturb is off. The check is still there stopping calls from coming in when phone is locked. Any other ideas? Thanks again!
-
i upgraded my iphone 4 OS yesterday to ios 5, today morning my phone is not working, i am not able to click any button and also its not allowing me to switch off the phone and restart. Anyone having similar issues?
From my post on what seems like the same issue (found here: https://discussions.apple.com/message/21087892#21087892)
Take the following steps:
1) while connected to wifi, toggle off then back on the Show All Music and iTunes Match options shown in my original post. Important: I did this step before, but wasn't connected to wifi, and my music disappeared. Subsequently, I connected to wifi and turned off and then back on those options and everything came back though it was grayed out and my only option was to download music.
2) To get streaming over cellular back, go into Settings>General>Cellular and scroll down to the "Use Cellular Data for:" options and make sure the iTunes option is set to 'On'
The above steps will bring back the streaming capability which seemed to go away when you update to 6.1. It didn't ACTUALLY go away, but something about the update toggled off the iTunes option in step 2 above.
I did a final test by turning off wifi, opening Music app and selecting a song. It played successfully without downloading! Crossing my fingers, but I think I'm good to go!
Hope this helps! -
Hi,
This is probably really easy but is there some way to turn
off the "click" sound when using click boxes?
Thanks!
GaryHi Gary
Are you using Captivate 4? If so, it now sports such an
option!
If not, you will need to replace the click sound file with a
silent file to achieve it.
Click
here for more on that
Cheers... Rick -
I am creating an elearning movie with many scenes. for each a
scene an external sound clip loads. i would like to create a sound
on/off button. I can create the button and turn the sound off. But
the problem i have is that it only turns it off for that particular
scene. So when the user goes to the next scene. the sound will come
back on because it loads an external sound clip. Is there any way
that the user can switch the sound on/off and it effects the all
the scenes?
ThanksDon't use scenes. Ever. Big no no. Scenes are what was left
over from Flash 4 before Movie Clips were invented. Code from one
scene cannot communicate with code in another, and there are many
more problems. Divide your main timeline into sections with frame
labels, and use that to separate parts of your application. -
I just went on to an app and I decided to come off a while after so I clicked the button and it kept on coming up with siri so I have to turn off my phone and turn it back on to get to the home ,what's up?
Restart the phone
Maybe you are looking for
-
Mail Sending and Outbox errors
I tried to look through old threads and find an answer to my question, but I haven't really read anything about how to fix this problem. I set up my Mail at the beginning of the summer when I got my MacBook with info for my Gmail email account. Every
-
How do you reinstall OS X Mountain Lion?
I have had a problem and I was wondering how you take off Mountain lion and reinstall it onto the OS?
-
Connection pool error in content server
getting below error. resumed the suspended pool and tried restarting the content server... but, unable to get login page itself. Unable to load the user information. There are no connections available from pool for provider 'SystemDatabase'. Unable t
-
Why Would Crystal Change all "string" values to hexidecimal
We are running Crystal Reports version 11 and using it to access a ISeries DB2 Database. We use the OLE DB (ADO) connedction to the ISeries. We have had several reports running for months, then last Friday when we ran one of the reports Crystal indic
-
HELP!!!! TIME MACHINE RESTORE CRASH!!!
I am running 10.5.8 on my desktop Dual 1.8GHz upgraded Quicksilver. I was having some directory problems this past week and couldn't find any easy fixes that didn't require re-installing. I have a 750GB start up disk and a 1TB Time Machine disk. I fi