Hello,
I am trying to get sound to play after I drag a graphic onto its correct target (a drag/drop game). I have 2 .as files. One called DragGame.as which is the document class, and another one called DragDrop.as. Both are below. I have tried adding the sound with and without a loader, and I have checked the sound in the same folder with my fla. I am just testing locally and getting the error: "Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
". I have also checked the spelling of the file. I have tried with and without the .wav extension. I have also tried a .mp3 file, with and without the extension. No matter what I have tried, it will not play. Please help!
Thanks,
~rorose

This is the DragGame.as:

PHP Code:
package
{
    
import flash.display.MovieClip;
    
import flash.events.MouseEvent;
    
import flash.display.DisplayObject;
    
import flash.media.Sound;
    
import flash.net.URLRequest;

    
    
import DragDrop;
    
import TN;
    
import AP;
    
import CW;


    
    public class 
DragGame extends MovieClip
    
{
        private var 
tn:TN;
        private var 
ap:AP;
        private var 
cw:CW;
        private var 
correctsound:Sound;



        
        public function 
DragGame()
        {
            
createPieces();

        }
        
        private function 
createPieces():void
        
{
            

                    

            
            
tn = new TN();
            
addChild(tn);
            
tn.169.9;
            
tn.90.8;
            
tn.width 370.9;
            
tn.height 68;
            
tn.alpha 0.3;
            
            
            
ap = new AP();
            
addChild(ap);
            
ap.496.6;
            
ap.169.9;
            
ap.width 162.8;
            
ap.height 110.2;
            
ap.alpha 0.3;
            
            
            
cw = new CW();
            
addChild(cw);
            
cw.44.8;
            
cw.193.1;
            
cw.width 197.0;
            
cw.height 94;
            
cw.alpha 0.3;
            
        }
        
        public function 
setUpTargets():void
        
{


            
           
// trace(correctsound);
            
           //tn._targetPiece = ttn_mc;
           //tn.addEventListener(MouseEvent.MOUSE_UP, checkTarget);
           
           
trace(ttn_mc);

           
//ap._targetPiece = tap_mc;
           //ap.addEventListener(MouseEvent.MOUSE_UP, checkTarget);
           
trace(tap_mc);

          
// cw._targetPiece = tcw_mc;
           //cw.addEventListener(MouseEvent.MOUSE_UP, checkTarget);
           
trace(tcw_mc);
           
           
apm._targetPiece tap_mc;
           
apm.addEventListener(MouseEvent.MOUSE_UPcheckTarget);
           
trace(tap_mc);
           
           
cwm._targetPiece tcw_mc;
           
cwm.addEventListener(MouseEvent.MOUSE_UPcheckTarget);
           
trace(tcw_mc);
           
           
tnm._targetPiece ttn_mc;
           
tnm.addEventListener(MouseEvent.MOUSE_UPcheckTarget);
           
trace(ttn_mc);
           
        }
        

        
        public function 
checkTarget(event:MouseEvent):void
       
{

           
correctsound = new Sound(new URLRequest("correct1.wav"));
          

             
           if(
apm.hitTestObject(apm._targetPiece/*&& (cwm.hitTestObject(cwm._targetPiece))! && (tnm.hitTestObject(tnm._targetPiece)))!*/)
           {
               
trace("whooooot!");
               
trace(correctsound);
               
correctsound.play();
               
//ec.x = target.x;
               //ec.y = target.y;
               
apm.497.6;
               
apm.409.9;
               
//cwm.x = 200;
               //cwm.y = 200;
               //tnm.x = 181.9;
               //tnm.y = 295.8;
               
apm.removeEventListener(MouseEvent.MOUSE_UPcheckTarget);
               
apm.disable();
           }
           else
           {
              
               
apm.apm._origX;
               
apm.apm._origY;
           }
           
           
/*if(cwm.hitTestObject(cwm._targetPiece))
           {
               trace("whooooot!");
              // trace(correctsound);
              // correctsound.play();
               //ec.x = target.x;
               //ec.y = target.y;
               //apm.x = 497.6;
               //apm.y = 409.9;
               cwm.x = 50.3;
               cwm.y = 426.1;
               //tnm.x = 181.9;
               //tnm.y = 295.8;
               cwm.removeEventListener(MouseEvent.MOUSE_UP, checkTarget);
               cwm.disable();
           }
           else
           {
               //wrongsound.play();
               cwm.x = cw.x;
               cwm.y =cw.y;
           }
           
           if(tnm.hitTestObject(tnm._targetPiece))
           {
               trace("whooooot!");
               //trace(correctsound);
               //correctsound.play();
               //ec.x = target.x;
               //ec.y = target.y;
               //apm.x = 497.6;
               //apm.y = 409.9;
               //cwm.x = 50.3;
               //cwm.y = 426.1;
               tnm.x = 181.9;
               tnm.y = 295.8;
               tnm.removeEventListener(MouseEvent.MOUSE_UP, checkTarget);
               tnm.disable();
           }
           else
           {
              // wrongsound.play();
               tnm.x = tnm._origX;
               tnm.y = tnm._origY;
           }*/
       
}
   }
    

This is the DragDrop.as:

PHP Code:
package
{
    
import flash.display.MovieClip;
    
import flash.events.MouseEvent;
    
import flash.filters.DropShadowFilter;
    
import flash.display.DisplayObject;
        
import flash.events.Event;
        
import flash.media.Sound;
        
import flash.net.URLRequest;
        
import flash.media.SoundChannel;
    
    public class 
DragDrop extends MovieClip
    
{
        public var 
_targetPiece:*;
        public var 
_origX:Number;
        public var 
_origY:Number;

        
        public function 
DragDrop()
        {
            
_origX this.x;
            
_origY this.y;

            
this.buttonMode true;
            
this.addEventListener(MouseEvent.MOUSE_DOWN,dragMovie);
            
this.addEventListener(MouseEvent.MOUSE_UPdropMovie);


            
        }
        
        private function 
dragMovie(event:MouseEvent):void
        
{
            
this.startDrag();
            
_origX event.target.x;
            
_origY event.target.y;
            
this.filters = [new DropShadowFilter()];
            
this.parent.addChild(this);
            
        }
        
        private function 
dropMovie(event:MouseEvent):void
        
{
            
this.stopDrag();
            
this.filters = [];
            
stopDrag();
                    
trace(_targetPiece);
                    
trace(dropTarget);
            if ((
dropTarget != null) && (_targetPiece != null) && (_targetPiece.contains(dropTarget))){
                    
                       
removeEventListener(MouseEvent.MOUSE_DOWNdragMovie);
                       
removeEventListener(MouseEvent.MOUSE_UPdropMovie);
                       
buttonMode false;
                       
_targetPiece.x;
                       
_targetPiece.y;
             } else {
                       
_origX;
                       
_origY;
             }
        }
        
        
        public function 
disable():void
        
{
            
this.buttonMode false;
            
this.removeEventListener(MouseEvent.MOUSE_DOWN,dragMovie);
            
this.removeEventListener(MouseEvent.MOUSE_UPdropMovie);
        }
    }