On roll over play sound

I want a sound to play when a movie clip rolls over an other movie clip instance. How do I tackle it?

var tl:MovieClip = this;
stop ();
var buzz_snd:Sound=new Sound(sun_mc);
buzz_snd.attachSound ("buzz_id");
var distance:Number = 10;
var keyListener:Object = new Object ();
keyListener.onKeyDown = function ()
if (Key.isDown (Key.LEFT))
sun_mc._x = Math.max (sun_mc._x - distance, 0);
//trace ("move left");
else if (Key.isDown (Key.RIGHT))
sun_mc._x = Math.min (sun_mc._x + distance, 575);
//trace ("move right");
else if (Key.isDown (Key.UP))
sun_mc._y = Math.max (sun_mc._y - distance, 0);
//trace ("move up");
else if (Key.isDown (Key.DOWN))
sun_mc._y = Math.min (sun_mc._y + distance, 570);
//trace ("move down");
//delete the sun with the cloud  
for (var i = 1; i <= 6; i++)
if (sun_mc.hitTest (tl["cloud_mc" + i]))
trace ("the sun hit the cloud");
//sun_mc's depth is less than 0, swap into
//an unoccupied removeable depth
sun_mc.swapDepths (1000000);
sun_mc.removeMovieClip ();
//delete an instance of the star with the sun  
for (var i = 1; i <= 6; i++)
if (sun_mc.hitTest (tl["star_mc" + i]))
buzz_snd.start ();
trace ("the sun has hit the star_mc movieClip");
star_mc.swapDepths (1000000);
tl["star_mc" + i].removeMovieClip ();
Key.addListener (keyListener);
// This code duplicates and randomly positions new instances
//of the movieClip star_mc
for (var i = 1; i <= 6; i++)
duplicateMovieClip ("cloud_mc", "cloud_mc" + i, i + 6);
_root["cloud_mc" + i]._x = 600 * Math.random ();
_root["cloud_mc" + i]._y = 200 * Math.random ();
for (var i = 1; i <= 6; i++)
duplicateMovieClip ("star_mc", "star_mc" + i, i);
_root["star_mc" + i]._x = 600 * Math.random ();
_root["star_mc" + i]._y = 200 * Math.random ();
var buzz_snd:Sound = new Sound (this);
keyListener.onKeyDown = function ()
trace ("button working");
buzz_snd.attachSound ("buzz_id");
buzz_snd.start ();

Similar Messages

  • Roll over button sound

    Hello,
    i'm trying to get a sound clip to play when rolling over the
    buttons. I was trying to integrate the following function to my
    actionscript file, but it ain't working. i have tried many
    variations but no luck, any ideas?
    thanks
    Function:
    this.addEventListener(MouseEvent.MOUSE_OVER, playSound);
    function playSound(event:MouseEvent):void {
    mySoundChannel = mySound.play();
    var mySoundReq:URLRequest = new URLRequest("songsample.mp3");
    var mySound:Sound = new Sound();
    var mySoundChannel:SoundChannel = new SoundChannel();
    mySound.load(mySoundReq);
    Actionscript file code:
    package {
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    public class sieges extends flash.display.MovieClip{
    var debug:Boolean=true;
    public const SIEGE_LIBRE:int = 0;
    public const SIEGE_SYSTEME:int = 1;
    public const SIEGE_USER:int = 2;
    var status:int = SIEGE_LIBRE;
    // constructeur
    public function sieges () {
    if (debug) trace("siege:"+this.name);
    this.addEventListener(MouseEvent.CLICK, siege_click);
    this.addEventListener(MouseEvent.MOUSE_OVER, siege_over);
    this.addEventListener(MouseEvent.MOUSE_OUT, siege_out);
    siege_init();
    // click sur un siege
    function siege_click(event:MouseEvent):void {
    if (debug) trace("siege_click");
    if (this.status == SIEGE_LIBRE) {
    user_reservation();
    } else if (this.status == SIEGE_USER) {
    siege_init();
    this.parent.parent["durocher"].enleve_siege(this.name);
    // over un siege
    function siege_over(event:MouseEvent):void {
    if (debug) trace("siege_over");
    var request:URLRequest = new
    URLRequest("/reservations/images/"+this.name+".jpg");
    this.parent["photo"].scaleContent = true;
    this.parent["photo"].addEventListener(IOErrorEvent.IO_ERROR,
    ioErrorHandler);
    this.parent["photo"].load(request);
    event.target.alpha = .5;
    function siege_out(event:MouseEvent):void {
    if (debug) trace("siege_over");
    event.target.alpha = 1;
    function ioErrorHandler(e:Event):void {
    public function siege_init() {
    if (debug) trace("siege_init");
    this.status = SIEGE_LIBRE;
    gotoAndStop(1);
    // reservation pour un usager
    public function user_reservation () {
    if (debug) trace("user_reservation");
    this.status = SIEGE_USER;
    this.parent.parent["durocher"].reserve_siege(this.name);
    gotoAndPlay(10);
    // reservation pour le systeme
    public function system_reservation () {
    if (debug) trace("syste,_reservation");
    this.status = SIEGE_SYSTEME;
    gotoAndPlay(5);
    Actionscript file code

    does playSound() called?

  • Can I have a mouse-over function to play sound?

    Hello all,
    I have a flash graphic here www.stainlessrhino.com top left
    corner. What I would like is for the graphic to play (soundless as
    it does now) when the page is loaded, however, if the user mouse
    over the swf a sound would play once. How would I accomplish this?
    Is it possible?
    Thank you!

    There are several ways to do this. The easiest way is to
    attach the sound to the graphic. Do this by editing the object you
    want, create a layer called sounds. Click on the first frame you
    want the sound to play in, press F6 to create a keyframe. Click in
    that keyframe and look in the Properties window. In the box labeled
    "Sound:" (go figure) you select the sound you want to play.
    If you are using a roll-over listener you can use the
    Sound.play() method to play the sound in the function. AS3.0
    example:
    myGraphic.addEventListener(MouseEvent.ROLL_OVER,
    myOverFunction);
    function myOverFunction(event:MouseEvent):void{
    play.sound(mySound);
    I recommend searching for "Playing Sounds" in the help
    documentation (F1).

  • Playing sound over network file

    Hello,
             I have swf file in my domain which has to play sound file that is located over the network. say my domain is http://mydomain.com/play.aspx which hosts the swf file. This swf file plays a sound thats is located at \\SERVERNAME\PATH\xyz.mp3. This SERVERNAME can be local or network. When I try to access the sound file I get IO error 2032. I copied crossdomain.xml (with full access to *) under \\SERVERNAME server at the root path that is C:\ and also to \\SERVERNAME\PATH. It didnt work. IS there something that I m missing?..
    Thanks,
    Bharani

    it depends on the place you called this method and the place of the sound clip, the class within which you called the method must be at the same directory of the sound clip, if you used the file name as the parameter of this method without supplying directores like sounds/myClip.mid
    ex.
    package myPack.test
    class Test{
          getclass.getResource("myClip.mid"); //this call assumes that the file path is ...myPack/test/myClip.mid
    }GoodLuck

  • Making Movies play with Roll Over

    Does anyone know how to make a movie roll over button, that
    will start and stop were you left off. here are some examples:
    http://www.fabchannel.com
    http://www.diddy.com/diddy.php
    The buttons are at the bottom.
    Thanks so much,
    GL

    it will basically pause the movie on rollOut and resume on
    rollOver.
    so YES, it will start and play from where it has
    stopped

  • Rollover buttons to play sound using "loadSound"

    Hi, there
    I am seeking help with the following AS2 code. The target effect: Rolling over each of the two buttons on the main stage plays different sound. The code below works. However, I need to embed it in another application (Articulate) which doesnot allow the use of "_root" and "attachSound". I was recommended to use "loadSound" instead. However, not a coding person, I am at a loss.
    Can anyone help me to change the script below to remove "_root" and "attachSound" and use "loadSound" instead? Thanks so much!
    var mySound:Sound = new Sound();
    mcButton5.onRollOver = function() {
    _root.mySound.attachSound("sound1");
    _root.mySound.start();
    var mySound:Sound = new Sound();
    mcButton6.onRollOver = function() {
    _root.mySound.attachSound("sound2");
    _root.mySound.start();

    I finally got it work, using load Sound...
    Kglad, thanks for your great help, as always!
    mySound1 = new Sound();
    mySound1.loadSound("Sound1.mp3", false);
    mcButton1.onRollOver = function() {
    mySound1.start();
    mcButton1.onRollOut = function() {
    mySound1.stop();

  • How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)

    Hello,
    Here is the problematic:
    1° How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)
    - I've many button in a doc im creating
    - the color of the buttons is white with black stoke & black text
    - in roll over state i want them to inverse the color coding (the text white & bottom black)
    - currently the text becomes invisible as black on black cant be seen (ive stroked it white but that looks ugly)
    - i would just like to know if there is a function made for this?
    My other questions:
    2° Ive a presentation on which Ive created buttons which tigger pop-up animations
    - i have 5 buttons which trigger animations
    - the viewer can chose to Click on any of the buttons randomly
    - the problem is once the animation is open how can it be close... either:
    a) by it self after "40" seconds
    b) when ther viewer clicks another button
    3° Ive created buttons linking pages..
    - "go to page xxx"
    - when i do a preview and click on the buttons the links dont take me to the right pages
    - is that normal? (maybe in preview its suppose to be like that)
    4° I would like to intergrate YouTube videos in the presentation so they play inside the docment.. when i tried.. it said the 'link isnt a flash video'
    - what should i do?
    5° Once i export it into Swf. how how can i visualize it? or put it online?
    Thank you for your time.

    stlbbl4u wrote:
    Hello,
    Here is the problematic:
    1° How can i change the color of the text on a button in Roll Over or Click state (Cs5.5)
    - I've many button in a doc im creating
    - the color of the buttons is white with black stoke & black text
    - in roll over state i want them to inverse the color coding (the text white & bottom black)
    - currently the text becomes invisible as black on black cant be seen (ive stroked it white but that looks ugly)
    - i would just like to know if there is a function made for this?
    You should setup Object Styles - these can also include Paragarph Styles that can be triggered when the Style is selected.
    http://help.adobe.com/en_US/indesign/cs/using/WS5CEDB81A-0011-4dc9-9DE8-AC7AD4C80076a.html
    My other questions:
    2° Ive a presentation on which Ive created buttons which tigger pop-up animations
    - i have 5 buttons which trigger animations
    - the viewer can chose to Click on any of the buttons randomly
    - the problem is once the animation is open how can it be close... either:
    a) by it self after "40" seconds
    b) when ther viewer clicks another button
    I'm not sure what you mean - I don't do files with Animations
    3° Ive created buttons linking pages..- "go to page xxx"
    - when i do a preview and click on the buttons the links dont take me to the right pages
    - is that normal? (maybe in preview its suppose to be like that)
    Does it work properly when you export it to the finished file?
    4° I would like to intergrate YouTube videos in the presentation so they play inside the docment.. when i tried.. it said the 'link isnt a flash video'- what should i do?
    InDesign won't link directly to youtube videos. I think your best bet would be to use Downloader to download the video and embed them directly in Indesign.
    5° Once i export it into Swf. how how can i visualize it? or put it online? 
    Thank you for your time.
    You can look up how to embed a SWF file into your HTML - but it depends what you mean by "online" there's a dozen ways to get a file "online".

  • How do I tell Apple to fix their software like apps that play sound even though the sound is turned off and not being able to disable features you hate like game center

    Apple is suppose to be the pinnacle of usability and, yet, I want to throw my new IPhone 4s as far as I can and watch is smash into a million pieces on concrete. Seriously, I've already got three things that irritate the **** out of me. First, there are Apple apps that insist on playing sound even though the sound is turned off. If I flick a switch to turn the sound off, I want the sound off!!!! Second, if I do not want a totally unnecessary feature like Game Center, I should be able to disable it. I completed most of the Angry Bird levels with 2 or 3 stars and now I have to start over from square one. Maybe, this happened when I upgraded to the 4s but it sure seemed to happen when I joined Game Center. Tomorrow, I am going to reset my 4s to factory defaults to try to get rid of my Game Center account. I don't want Game Center! I do need Game Center! I hate Game Center! Finally, I had an alarm go off to wake me up and there was a Snooze button but no button to turn the alarm off. I flicked the slider to access the main screen expecting to see something to turn the alarm off but there was nothing. The alarm just kept alarming. I had to warm boot my IPhone to shut the alarm off! Really, Apple!!!!

    The sound is turned off. Only, some Apple apps like YouTube and Siri make sound when the sound is turned off. It is very embarrassing when this happens at work. My question was how do I tell Apple to fix this?
    Turning off game center does not work. The games just prompt me to sign in when they are started.I have tried everything I can find online to stop this behavior. It is annoying and should not happen. My question was how do I tell Apple to fix this?
    The alarm went off. There was a green thing that looked like a button but pressing it did nothing. There was a red button that said snooze. I did not want to snooze. I wanted to turn the alarm off. I slid the bar to unlock the phone and there were no running apps with a button to press. The alarm just keep running. I have not had this problem since it first occurred. The alarm now shuts off when I just unlock the phone. It may have happened because I had another alarm app running. The two may have interfered with each other. I would like to tell Apple about it.
    It also annoys me that the button that closes apps leaves the phone app running. If I press on a number at 6:00 AM to get information about who called me, the phone automatically dials the person back and my natural reaction is to press on the button to close the phone app but the phone keeps dialing this person at 6:00 AM. It is a bad design. I would like to tell Apple about it.
    Finally, I looked all over Apple's site to try to find someplace I could send them a polite message to let them know that I was not happy with these "features" but could not find anything. It is extremely frustrating to have issues with a product and not being able to tell the manufacturer about it. So, you grow up!.
    When trying to fix the Game Center issue, I saw a link someone posted to report issues with the IPad to Apple. The answer I am looking for is where is the link to report issues with the IPhone.

  • Is there a way to prevent roll-over ads from opening? Some sites are almost impossible to navigate because of this new nuisance.

    For instance, www.roughstock.com is a country music website where you can see lyrics and chords for popular songs that contributors have sent in. From the main page you click on the "Cowpie" tab to enter the page where you can search for songs. If you do this I am quite sure you will experience one of the roll-over advertisements I am talking about. They are small ads which, if you touch any portion of their area, will TAKE OVER the screen and play until the advertisement is finished or until you are able to find a usually obscure 'close' button.
    I've got 'pop-ups' disabled, but this new kind of ad is already resident on the page you wish to view so it is beating the system.
    Also, I'm not spamming for that site, it's just the most recent site where I've experienced this problem.

    It's going to get worse with crap like that as more web sites adopt HTML5 and HTML5 compatible browsers are released. There's all sorts of new tags in HTML5 that will probably be misused for displays like that.

  • Swap images while rolling over popup menu

    Hello,
    I've been playing with fireworks CS5 for some days now and made a first attempt on a website.
    So far, i've made a navigation bar with two states in order to be able to add a simple roll over behavior, e.g. darkening text on rollover. I also have been able to make a dropdown menu (popup) via slices.
    Then I decided to swap images when on nav bar headings. So far, so good.
    When I did a preview in my browser, it appeared that as soon as I was leaving the nav bar, the image swapped back to the old setting. Perfect.
    But when I did a mouse over on one of the dropdown menu's of the navigation bar, the image swapped back as well.. I've been trying, but didnt manage to find out how to fix this.
    So, is there anyone here that knows if it is possible, and if so, how to keep images swapped to a second stage as long as the mouse is on the dropdown menu, but swaps back to the original state when leaving the dropdown and/or the navigation bar.
    Thanks in advance,

    Hi Bryan,
    It may be possible to cheat and put this onto the button:
    the option that you want is called TITLE.
    if you set one of the other parameters (e.g. the label)
    to be:
    LABEL_TEXT" TITLE="TITLE_TEXT
    basically when it adds the text onto the form it will wrap it in "
    If it doesn't strip out the " from your text you should get your extra parameter.
    it may slip past the portal checking.
    I can't test it as I only have WebDB, but I have done something similar with javascript in WebDB.
    good luck
    Michael

  • Why does my html widget not play sound in ibooks?

    I've designed a widget that plays sound correctly in every other browser. It uses an AAC-MPEG4 with the .m4a file extension on all of the sounds. I know the code is working correctly because as I said, it works in any browser. I've checked to volume controls and speakers of the ipad, they work and are turned all the way up. I just wonder if ibooks somehow does not support the javascript .play() command...

    flammer4 wrote:
    Now THIS worked!   First the message displayed, and when I viewed the page
    source, the code that you suggested earlier appeared.
    Now, why can't I get this when I enter the code directly?
    L.
    This proves what I believed and that is you are not naming the file correctly.  It has got a hidden file extension and if you were using Windows, I would have told you how to reveal the file names properly including hidden extensions of known file names.  I know nothing about MACs so you have yto wait until Murray Summers or John Waller comes here.  They know about Apple MACs and they have been in the business longer than anybody here.
    In windows, if we want Notepad to keep the names as it is we normally name the file as:
    "welcome.html"       including the quotes so that Notepad will know that it is not the normal text file to be opened in notepad or wordpad (TWO text editors in Windows)
    Perhaps you should use my file as a template and then change the text to:
    <p>The quick brown fox jumps over the lazy dog.  The quick brown fox jumps over the lazy dog.  The quick brown fox jumps over the lazy dog.  The quick brown fox jumps over the lazy dog.  The quick brown fox jumps over the lazy dog.</p>
    Hope this helps.

  • Play sound in specified duration and desired file when reading data with VISA functions ?

    Hi.
    I read data with VISA read function and then I use functions like multiple for showing data on Chart. every thing is OK.
    now I want play a specified sound (like a 3s song in my desired folder) when signal amplitude cross over from specified value. then after desired time, it will be wait for new cross over from specified value and this procedure repeat again until I stop the program. 
    Data comes from MCU and it doesn't stop when system play sound and when system play sound, incoming data for this part (play sound) will be ignore them until specified expired.
    I use this VI for reading data and mentioned part which is sound part is empty and I don't know what I must done ?
    altougth I use another while loop for sound apart because I want save CPU time.
    Thanks.
    Solved!
    Go to Solution.

    I would recommend making the data type of the notifier a cluster that contains a path and a numeric (double).  The path tells the player which file to play.  The numeric is the duration.
    Now for a slightly complicated, but really neat, way to stop your second loop.  Do not use a second notifier.  Instead, send the normal notification but use Not A Path for the path in the cluster.  Your second loop can do a check for the Not A Path and stop when that is recieved.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Flash player 9 stoped playing sound

    Hello!
    I have flash player 9 installed in Firefox 2.0. On certain
    web sites the player stops playing sound after a while. As one
    hovers over a hyperlink the sound was back for a while. Has anyone
    experienced the behavior and got a solution?
    Thank's
    Steve

    You seem to be experiencing the same problem as I am... see post http://forums.adobe.com/thread/779624
    Even when I select "publish to Flash 9" it will only work on those machines that have Flash 10.
    The Flash version that we have is 9.0.16
    Can you do me a favour? Go to www.whatismyflashversion.com
    I'm curious to know what exact version of Flash 9 you have. Is it possible that we just happen to have the one or two Flash 9 versions that don't work with Captivate 5?? Like, if I had 9.0.17 than I wouldn't be having this problem?

  • Playing sound

    hi there
    i want to play sound but i keep getting errors here is the code i am using:
    try
    InputStream in = getClass().getResourceAsStream("/fire1.wav");
    Player p = Manager.createPlayer(in, "audio/x-wav");
    p.start();
    catch (MediaException me) { }
    catch (IOException ioe) { }
    and here is the error message when i run the program:
    java.lang.IllegalArgumentException
         at javax.microedition.media.Manager.createPlayer(+11)
         at gamescreen.<init>(+108)
         at tester.<init>(+12)
         at java.lang.Class.runCustomCode(+0)
         at com.sun.midp.midlet.MIDletState.createMIDlet(+34)
         at com.sun.midp.midlet.Selector.run(+22)
    please help me as soon as possible thanks

    Ok so I found a message that advised running this test form:
    http://forms.pjc.bean.over-blog.com/article-2078527.html
    So I tried running that form and there is no sound forthcoming.
    I'm hardpressed to debug a java bean. Is this where this signing stuff
    comes up?
    Before I get completely bogged down in that certificate stuff, this
    also applies to the jre, correct? (The article says
    "Oracle9i Forms:JAR File Signing for JInitiator 1.3"
    http://www.oracle.com/technology/products/forms/pdf/SigningJint13.pdf
    This is forms 10g r2 and I'm not using jinitiator I was in fact using the jre
    1.5.12) So is this correct?
    Whereas if I do this suggested thing:
    web.show_document('soundUrl','_blank');
    It does work but ....
    when it starts IE says: "Do you want to open or save this file".
    (for which one has to pick open) and then it starts up winamp in the foreground
    (and it asks if you want to add the wav file to the library)...

  • Airplay only playing sound

    I have an iPhone 4 and just got the new iPhone 5 today and on both devices, airplay is only playing sound when I try to mirror a youtube vidio from my iphones to my appleTV.  When I set the iphone to mirror to my appletv, i get the message "this device can only play sound over airplay."
    Any thoughts as to why??  Don't get it...
    Other info:
    Checked all my router settings..set on 2.4 GHz, auto channel

    What an obnoxious reply.  It sounds like you are completely confused by what I was suggesting, so let me try again ...
    I had suggested using the Remote app on your iOS device -- not the slim remote control that came with your ATV.  Using the Remote app on your iOS device is much easier than the ATV remote control, and using the iOS app is no harder (or slower) than navigating YouTube on your iOS device.
    If you don't know what the Remote app is, then you're you're not only missing out on a great way to control your ATV, you're also showing your ignorance (or is it arrogance?)

Maybe you are looking for

  • Having problems in creating a class with name File.

    I want to compile a new class with class name as File, i have made it part of a new package also but still i am getting this error "File.java:2: CustomFile.File is already defined in this compilation unit import java.io.File; ^ File.java:6: cannot re

  • Error in compile C code

    hi! I'm from brasil this code is of the book "The Java Native Interface Programmer's Guide and Specification" #include <jni.h> #include <stdio.h> #include "IntArray.h" JNIEXPORT jint JNICALL Java_IntArray_sumArray(JNIEnv *env, jobject obj, jintArray

  • Menu Bar Submenu Placement

    MenuBar Widget, v1.5 on CSS and js files. The submenus show up correctly on Mac Safari, but on both Mac Firefox and Camino the submenus overlap the main menu. I've no doubt changed something I shouldn't have but I've no idea what. The page can be vie

  • IPhone 5 video recording

    Hi, I've had my iphone 5 since launch date and I was able to record videos with sounds perfectly now when I record a video I can't hear anything, I tried voice memos and I can hear myself an I have nothing covering the microphone. Anyone please

  • IMac keeps changing identity adding a number (x) behind byname-iMac

    My iMac's computer name keeps changing automatically after Yosemite upgrade This started happening once I upgraded my iMac to Yosemite. It will add numbers to the name of my iMac. Example: It starts off as say "My iMac" Then a half day later, it chan