Attach a sound to this

  • Started
  • Last post
  • 1 Response
  • spent2000

    I am try to attch a sound to the mc called scanner

    /*
    * Draggable object code
    * @author Casey Corcoran -
    */

    makeDraggable(clip1);
    makeDraggable(clip2);
    makeDraggable(clip3);

    function makeDraggable(mc)
    {
    mc.onPress = onObjectPress;
    mc.onRelease = mc.onReleaseOutside = onObjectRelease;
    mc.onDrag = onObjectDrag;
    }
    function onObjectDrag()
    {
    var tgt = eval(this._droptarget);
    if(tgt == this._lasttarget) return;
    if(tgt == this._parent.scanner)
    {
    tgt._alpha = 80;
    this.scanner.attachSound("ls7708...
    }
    else
    {
    this._lasttarget._alpha = 100;
    }
    this._lasttarget = tgt;
    updateAfterEvent();
    }
    function onObjectPress()
    {
    this.origpos = new Object();
    this.origpos.x = this._x;
    this.origpos.y = this._y;
    startDrag(this,false);
    this.onMouseMove = this.onDrag;
    this.swapDepths(100);
    }
    function onObjectRelease()
    {
    stopDrag();
    delete this.onMouseMove;
    this._x = this.origpos.x;
    this._y = this.origpos.y;
    this._lasttarget._alpha = 100;
    }

  • function820

    buttonSound = new Sound("beepNoise");
    buttonSound.attachSound("beep");
    buttonSound.start(0, 1);

    add a sound to the library and make its 'linkage' name beep

    put this code in whatever state you want to have noise (over, down, etc.)

    if you want to add code to it that can allow you to turn off sounds (event sound muting)
    check out this short tutorial i wrote:

    http://www.pingtalk.com/showthre…