Sitemap

Amicuk Programming Answers

Sound on/off by click a button in flex4????

2015-10-11   Views:0

Advertisement

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 butt

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

The replay answer
Advertisement
// 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;

Go to See the other 2 answers

Sound on/off by click a button in flex4????

Category:DefaultRelease time:2015-10-11Views:130

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 butt[More]

Click a button in Safari

Category:DefaultRelease time:2015-10-11Views:130

I want to locate a button on a web page and click it. That's it. Sounds easy but I don't how to locate the button. I can't link to the web page because you need to be a member to view it. I also want to learn from this so I can locate a button on a d[More]

HT201209 Trying to redeem a free download for a song from KLove. When I get into my acct & try to redeem it, it just keeps bringing up the "sign-in" box. When I click the button on KLove's webpage to redeem it takes me to that page but does the same thing

Category:DefaultRelease time:2015-10-11Views:130

Trying to redeem a free download for a song from KLove. When I get into my acct & try to redeem it, it just keeps bringing up the "sign-in" box. When I click the button on KLove's webpage to redeem it takes me to that page but does the same[More]

Was typing an e-mail -trying to find "printer" - clicked SOME button now can't get back to my e-mail also top of page is missing/can't get to go down

Category:DefaultRelease time:2015-10-11Views:130

Went thru mozilla to business e-mail account/wanted to make a copy of notice to be sent/was clicking different buttons to find a "printer" all of a sudden the whole page went up and the top (bar,browser,everything disappeared) now can't find any[More]

I requested a repair, but there was an error after clicking the button with my credit card info. I was still charged, but the form email I received the next day had incorrect info about my iPod Touch problem. How can I contact CS w/o paying $19?!

Category:DefaultRelease time:2015-10-11Views:130

My iPod Touch battery is not working. I requested a repair through the Apple Support. On the final page, when I clicked the button that puts the info through with your credit card number, the resulting page gave an error (I wish I'd have saved it!).[More]

Hot
Hello: I am new to Arch Linux and just finished installing the 64bit on my laptop. It had a prebuilt Windows 7 (64) installed which I kept but split the hdd from 160Gb to 80Gb and 80Gb. I installed Arch there and set 4 partitions, all of them as Logi [More]
Anyone have a tip on how to retrieve voice memos in the iPhone 4? When I tap the button to the right of the VU meter, nothing happens. It was working fine up until now. Any tips much appreciated. Regards, MarkI've experienced this and have what appea [More]
Hey guys... strange error occurs even don't really know how to describe, I'll try but the video will describe it better, of course. Configuration: Macbook Pro 13" Mid 2012 8gb RAM (originally 4gb, self upgrade to 8gb (Corsair Vengeance SoDimm CL9 PC3 [More]
I'm the bad guy... at least according to Verizon's throttling policy for the remaining "unlimited" (haha!) data customers utilizing 3G.  And yes, it is throttling, "network optimization" doublespeak aside; a better term might be " [More]
Hi all, after installing the most recent BIOS update via ThinkVantage System Update, the DVI port in my T410s does not work anymore. Nvidia and Intel display drivers are in place, and I also checked the BIOS settings, but to no avail. It appears that [More]
Greetings... There may be a better way to accomplish what I'm trying to do, so I'm open to outside-the-box suggestions. I have a pretty simple page which lists a set of statuses and descriptions of each. The user can edit these status flags and their [More]
There aren't a lot of details in addition to what I put in the question field. Just got the FF beta v4 and used it fine, but when I attempted to launch it today, I got the error. The only info not listed there is the error title, XULRunner, which may [More]
How can I get my itunes library back onto my laptop from my ipad?Here is one way: http://www.copytrans.net/copytransmanager.php Google for more. Why isn't the library on your computer?Read other 3 answers [More]
I'm an Apple and Safari lover, but love goes only so far. I have tried everything with Safari in Yosemite, but it's really in a sad state when it won't even open my Google account page, or my own website. Sadly, I have found so many pages that either [More]
I download a TV/computer program both as an mp3 (audio) and as a mp4 (A&V) I could play them directly using the URLs but neither appeared in the download dropdown or in i tunes.  Does that mean that these files cannot be burned to a CD or DVD?I downl [More]