Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Error #2044 help

New Here ,
Apr 12, 2011 Apr 12, 2011

This is the error I'm getting with my code and I believe it has to do with the sounds needed to be played back.  If anyone could give me any help in fixing this I would appreciate it.

Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at workingg_fla::MainTimeline/stage_EnterFrame()

My code:

import flash.events.ActivityEvent;
import flash.events.StatusEvent;
import flash.media.Microphone;
//line code below
var container1:Sprite = new Sprite();
var container2:Sprite = new Sprite();
var container3:Sprite = new Sprite();
var container4:Sprite = new Sprite();
var container5:Sprite = new Sprite();
//random coordinates for container1
var corcon1x:Number = Math.round(Math.random()*600);
var corcon1y:Number = Math.round(Math.random()*600);
var corcon2x:Number = Math.round(Math.random()*600);
var corcon2y:Number = Math.round(Math.random()*600);
//random coordinates for container2
var corcon3x:Number = Math.round(Math.random()*600);
var corcon3y:Number = Math.round(Math.random()*600);
var corcon4x:Number = Math.round(Math.random()*600);
var corcon4y:Number = Math.round(Math.random()*600);
//random coordinates for container3
var corcon5x:Number = Math.round(Math.random()*600);
var corcon5y:Number = Math.round(Math.random()*600);
var corcon6x:Number = Math.round(Math.random()*600);
var corcon6y:Number = Math.round(Math.random()*600);
//random coordinates for container4
var corcon7x:Number = Math.round(Math.random()*600);
var corcon7y:Number = Math.round(Math.random()*600);
var corcon8x:Number = Math.round(Math.random()*600);
var corcon8y:Number = Math.round(Math.random()*600);
//random coordinates for container5
var corcon9x:Number = Math.round(Math.random()*600);
var corcon9y:Number = Math.round(Math.random()*600);
var corcon10x:Number = Math.round(Math.random()*600);
var corcon10y:Number = Math.round(Math.random()*600);
//microphone code follows below
var deviceArray:Array = Microphone.names;
trace("Available sound input devices:");
for (var i:int = 0; i < deviceArray.length; i++)
{
    trace(" " + deviceArray);
}
var mic:Microphone = Microphone.getMicrophone();
Security.showSettings(SecurityPanel.MICROPHONE); //we added this line because it didn't accept sound otherwise
mic.gain = 60;
mic.rate = 11;
mic.setUseEchoSuppression(true);
mic.setLoopBack(true);
mic.setSilenceLevel(5, 1000);

mic.soundTransform = new SoundTransform(0, 0);
mic.addEventListener(ActivityEvent.ACTIVITY, this.onMicActivity);
mic.addEventListener(StatusEvent.STATUS, this.onMicStatus);
    
var micDetails:String = "Sound input device name: " + mic.name + '\n';
micDetails += "Gain: " + mic.gain + '\n';
micDetails += "Rate: " + mic.rate + " kHz" + '\n';
micDetails += "Muted: " + mic.muted + '\n';
micDetails += "Silence level: " + mic.silenceLevel + '\n';
micDetails += "Silence timeout: " + mic.silenceTimeout + '\n';
micDetails += "Echo suppression: " + mic.useEchoSuppression + '\n';
trace(micDetails);

function onMicActivity(event:ActivityEvent):void

}
function onMicStatus(event:StatusEvent):void
{
}

stage.addEventListener(Event.ENTER_FRAME, stage_EnterFrame);
function stage_EnterFrame(e:Event)
{

if (mic.activityLevel < 20){
     test_text.text = "20";
  addChild(container5);
     container5.graphics.lineStyle(5,0x0000ff);
     container5.graphics.moveTo(corcon9x,corcon9y);
     container5.graphics.lineTo(corcon10x,corcon10y);
   if (container5.hitTestObject(container1)) {
        trace( "hit5.1" );
var snd1:Sound = new Sound();
snd1.load(new URLRequest("sound1.wav"));
snd1.play();
  }
   if (container5.hitTestObject(container2)) {
        trace( "hit5.2" );
var snd2:Sound = new Sound();
snd2.load(new URLRequest("sound2.wav"));
snd2.play();
  }
   if (container5.hitTestObject(container3)) {
        trace( "hit5.3" );
var snd3:Sound = new Sound();
snd3.load(new URLRequest("sound3.wav"));
snd3.play();
  }
   if (container5.hitTestObject(container4)) {
        trace( "hit5.4" );
var snd4:Sound = new Sound();
snd4.load(new URLRequest("sound4.wav"));
snd4.play();
  }
   if (container5.hitTestObject(container5)) {
        trace( "hit5.5" );
var snd5:Sound = new Sound();
snd5.load(new URLRequest("sound5.wav"));
snd5.play();
  }
   if (container4.hitTestObject(container1)) {
        trace( "hit4.1" );
var snd6:Sound = new Sound();
snd6.load(new URLRequest("sound6.wav"));
snd6.play();
  }
   if (container4.hitTestObject(container2)) {
        trace( "hit4.2" );
var snd7:Sound = new Sound();
snd7.load(new URLRequest("sound7.wav"));
snd7.play();
  }
   if (container4.hitTestObject(container3)) {
        trace( "hit4.3" );
var snd8:Sound = new Sound();
snd8.load(new URLRequest("sound8.wav"));
snd8.play();
  }
   if (container4.hitTestObject(container4)) {
        trace( "hit4.4" );
var snd9:Sound = new Sound();
snd9.load(new URLRequest("sound9.wav"));
snd9.play();
  }
   if (container3.hitTestObject(container1)) {
        trace( "hit3.1" );
var snd10:Sound = new Sound();
snd10.load(new URLRequest("sound10.wav"));
snd10.play();
  }
   if (container3.hitTestObject(container2)) {
        trace( "hit3.2" );
var snd11:Sound = new Sound();
snd11.load(new URLRequest("sound11.wav"));
snd11.play();
  }
   if (container3.hitTestObject(container3)) {
        trace( "hit3.3" );
var snd12:Sound = new Sound();
snd12.load(new URLRequest("sound12.wav"));
snd12.play();
  }
   if (container2.hitTestObject(container1)) {
        trace( "hit2.1" );
var snd13:Sound = new Sound();
snd13.load(new URLRequest("sound13.wav"));
snd13.play();
  }
   if (container2.hitTestObject(container2)) {
        trace( "hit2.2" );
var snd14:Sound = new Sound();
snd14.load(new URLRequest("sound14.wav"));
snd14.play();
  }
   if (container1.hitTestObject(container1)) {
        trace( "hit1.1" );
var snd15:Sound = new Sound();
snd15.load(new URLRequest("sound15.wav"));
snd15.play();
  }
}
else if (mic.activityLevel > 20 && mic.activityLevel < 40){
     test_text.text = "40";
  addChild(container4);
     container4.graphics.lineStyle(10,0x6600CC);
     container4.graphics.moveTo(corcon7x,corcon7y);
     container4.graphics.lineTo(corcon8x,corcon8y);
}
else if (mic.activityLevel > 40 && mic.activityLevel < 60){
     test_text.text = "60";
  addChild(container3);
     container3.graphics.lineStyle(15,0x009900);
     container3.graphics.moveTo(corcon5x,corcon5y);
     container3.graphics.lineTo(corcon6x,corcon6y);
}
else if (mic.activityLevel > 60 && mic.activityLevel < 80){
     test_text.text = "80";
  addChild(container2);
     container2.graphics.lineStyle(20,0xffff00);
     container2.graphics.moveTo(corcon3x,corcon3y);
     container2.graphics.lineTo(corcon4x,corcon4y);
}
else if (mic.activityLevel > 80 && mic.activityLevel < 100){
     test_text.text = "100";
  addChild(container1);
     container1.graphics.lineStyle(30,0xff0000);
     container1.graphics.moveTo(corcon1x,corcon1y);
     container1.graphics.lineTo(corcon2x,corcon2y);
}
trace(mic.activityLevel);
}
if (container1.x < 364) {
      container1.x = container1.x + 10;
}
if (container1.y < 243){
   container1.y = container1.y + 10;
}
if (container1.x > 34){
   container1.x = container1.x - 10;
}
if (container1.y > 23){
   container1.y = container1.y - 10;
}
if (container2.x < 364) {
      container2.x = container2.x + 10;
}
if (container2.y < 243){
   container2.y = container2.y + 10;
}
if (container2.x > 34){
   container2.x = container2.x - 10;
}
if (container2.y > 23){
   container2.y = container2.y - 10;
}
if (container3.x < 364) {
      container3.x = container3.x + 10;
}
if (container3.y < 243){
   container3.y = container3.y + 10;
}
if (container3.x > 34){
   container3.x = container3.x - 10;
}
if (container3.y > 23){
   container3.y = container3.y - 10;
}
if (container4.x < 364) {
      container4.x = container4.x + 10;
}
if (container4.y < 243){
   container4.y = container4.y + 10;
}
if (container4.x > 34){
   container4.x = container4.x - 10;
}
if (container4.y > 23){
   container4.y = container4.y - 10;
}
if (container5.x < 364) {
      container5.x = container5.x + 10;
}
if (container5.y < 243){
   container5.y = container5.y + 10;
}
if (container5.x > 34){
   container5.x = container5.x - 10;
}
if (container5.y > 23){
   container5.y = container5.y - 10;
}

I've tried altering it to this:

import flash.events.ActivityEvent;
import flash.events.StatusEvent;
import flash.media.Microphone;

//array for playback
var a:Array=[];

//line code below --> adds var sprites
var container1:Sprite = new Sprite();
var container2:Sprite = new Sprite();
var container3:Sprite = new Sprite();
var container4:Sprite = new Sprite();
var container5:Sprite = new Sprite();

//timer to end lines --> don't take out
var t:Timer=new Timer(60000,1);
t.addEventListener(TimerEvent.TIMER,f);
t.start();
function f(e:Event):void{
stage.removeEventListener(Event.ENTER_FRAME, stage_EnterFrame);
container1.graphics.clear();
container2.graphics.clear();
container3.graphics.clear();
container4.graphics.clear();
container5.graphics.clear();
container1=null;
}

//microphone code follows below
var deviceArray:Array = Microphone.names;
trace("Available sound input devices:");
for (var i:int = 0; i < deviceArray.length; i++)
{
    trace(" " + deviceArray);
}
var mic:Microphone = Microphone.getMicrophone();
Security.showSettings(SecurityPanel.MICROPHONE); //we added this line because it didn't accept sound otherwise
mic.gain = 60;
mic.rate = 11;
mic.setUseEchoSuppression(true);
mic.setLoopBack(true);
mic.setSilenceLevel(5, 1000);

mic.soundTransform = new SoundTransform(0, 0);
mic.addEventListener(ActivityEvent.ACTIVITY, this.onMicActivity);
mic.addEventListener(StatusEvent.STATUS, this.onMicStatus);
    
var micDetails:String = "Sound input device name: " + mic.name + '\n';
micDetails += "Gain: " + mic.gain + '\n';
micDetails += "Rate: " + mic.rate + " kHz" + '\n';
micDetails += "Muted: " + mic.muted + '\n';
micDetails += "Silence level: " + mic.silenceLevel + '\n';
micDetails += "Silence timeout: " + mic.silenceTimeout + '\n';
micDetails += "Echo suppression: " + mic.useEchoSuppression + '\n';
trace(micDetails);

function onMicActivity(event:ActivityEvent):void

}
function onMicStatus(event:StatusEvent):void
{
}

//lines enter the stage
stage.addEventListener(Event.ENTER_FRAME, stage_EnterFrame);
function stage_EnterFrame(e:Event)
{
//this is important!  this stops the lines appearing when there is no sound.
if (mic.activityLevel > 2 && mic.activityLevel < 20){
     test_text.text = "20";
  addChild(container5);
     container5.graphics.lineStyle(5,0x0000ff);
   if (container5.hitTestObject(container1)) {
        trace( "hit5.1" );
var snd1:Sound = new Sound();
snd1.load(new URLRequest("sound1.wav"));
snd1.play();
  }
   if (container5.hitTestObject(container2)) {
        trace( "hit5.2" );
var snd2:Sound = new Sound();
snd2.load(new URLRequest("sound2.wav"));
snd2.play();
  }
   if (container5.hitTestObject(container3)) {
        trace( "hit5.3" );
var snd3:Sound = new Sound();
snd3.load(new URLRequest("sound3.wav"));
snd3.play();
  }
   if (container5.hitTestObject(container4)) {
        trace( "hit5.4" );
var snd4:Sound = new Sound();
snd4.load(new URLRequest("sound4.wav"));
snd4.play();
  }
   if (container5.hitTestObject(container5)) {
        trace( "hit5.5" );
var snd5:Sound = new Sound();
snd5.load(new URLRequest("sound5.wav"));
snd5.play();
  }
   if (container4.hitTestObject(container1)) {
        trace( "hit4.1" );
var snd6:Sound = new Sound();
snd6.load(new URLRequest("sound6.wav"));
snd6.play();
  }
   if (container4.hitTestObject(container2)) {
        trace( "hit4.2" );
var snd7:Sound = new Sound();
snd7.load(new URLRequest("sound7.wav"));
snd7.play();
  }
   if (container4.hitTestObject(container3)) {
        trace( "hit4.3" );
var snd8:Sound = new Sound();
snd8.load(new URLRequest("sound8.wav"));
snd8.play();
  }
   if (container4.hitTestObject(container4)) {
        trace( "hit4.4" );
var snd9:Sound = new Sound();
snd9.load(new URLRequest("sound9.wav"));
snd9.play();
  }
   if (container3.hitTestObject(container1)) {
        trace( "hit3.1" );
var snd10:Sound = new Sound();
snd10.load(new URLRequest("sound10.wav"));
snd10.play();
  }
   if (container3.hitTestObject(container2)) {
        trace( "hit3.2" );
var snd11:Sound = new Sound();
snd11.load(new URLRequest("sound11.wav"));
snd11.play();
  }
   if (container3.hitTestObject(container3)) {
        trace( "hit3.3" );
var snd12:Sound = new Sound();
snd12.load(new URLRequest("sound12.wav"));
snd12.play();
  }
   if (container2.hitTestObject(container1)) {
        trace( "hit2.1" );
var snd13:Sound = new Sound();
snd13.load(new URLRequest("sound13.wav"));
snd13.play();
  }
   if (container2.hitTestObject(container2)) {
        trace( "hit2.2" );
var snd14:Sound = new Sound();
snd14.load(new URLRequest("sound14.wav"));
snd14.play();
  }
   if (container1.hitTestObject(container1)) {
        trace( "hit1.1" );
var snd15:Sound = new Sound();
snd15.load(new URLRequest("sound15.wav"));
snd15.play();
  }
}
else if (mic.activityLevel > 20 && mic.activityLevel < 40){
     test_text.text = "40";
  addChild(container4);
     container4.graphics.lineStyle(10,0x6600CC);
}
else if (mic.activityLevel > 40 && mic.activityLevel < 60){
     test_text.text = "60";
  addChild(container3);
     container3.graphics.lineStyle(15,0x009900);
}
else if (mic.activityLevel > 60 && mic.activityLevel < 80){
     test_text.text = "80";
  addChild(container2);
     container2.graphics.lineStyle(20,0xffff00);
}
else if (mic.activityLevel > 80 && mic.activityLevel < 100){
     test_text.text = "100";
  addChild(container1);
     container1.graphics.lineStyle(30,0xff0000);
}
trace(mic.activityLevel);
}
if (container1.x < 364) {
      container1.x = container1.x + 10;
}
if (container1.y < 243){
   container1.y = container1.y + 10;
}
if (container1.x > 34){
   container1.x = container1.x - 10;
}
if (container1.y > 23){
   container1.y = container1.y - 10;
}
if (container2.x < 364) {
      container2.x = container2.x + 10;
}
if (container2.y < 243){
   container2.y = container2.y + 10;
}
if (container2.x > 34){
   container2.x = container2.x - 10;
}
if (container2.y > 23){
   container2.y = container2.y - 10;
}
if (container3.x < 364) {
      container3.x = container3.x + 10;
}
if (container3.y < 243){
   container3.y = container3.y + 10;
}
if (container3.x > 34){
   container3.x = container3.x - 10;
}
if (container3.y > 23){
   container3.y = container3.y - 10;
}
if (container4.x < 364) {
      container4.x = container4.x + 10;
}
if (container4.y < 243){
   container4.y = container4.y + 10;
}
if (container4.x > 34){
   container4.x = container4.x - 10;
}
if (container4.y > 23){
   container4.y = container4.y - 10;
}
if (container5.x < 364) {
      container5.x = container5.x + 10;
}
if (container5.y < 243){
   container5.y = container5.y + 10;
}
if (container5.x > 34){
   container5.x = container5.x - 10;
}
if (container5.y > 23){
   container5.y = container5.y - 10;
}

//play back code
var startX:Number=Math.round(Math.random()*600);
var startY:Number=Math.round(Math.random()*600);
var endX:Number=Math.round(Math.random()*600);
var endY:Number=Math.round(Math.random()*600);

container1.graphics.moveTo(startX,startY);    
container1.graphics.lineTo(endX,endY);
container2.graphics.moveTo(startX,startY);    
container2.graphics.lineTo(endX,endY);
container3.graphics.moveTo(startX,startY);    
container3.graphics.lineTo(endX,endY);
container4.graphics.moveTo(startX,startY);    
container4.graphics.lineTo(endX,endY);
container5.graphics.moveTo(startX,startY);    
container5.graphics.lineTo(endX,endY);
a.push([mic.activityLevel,startX,startY,endX,endY]);

What I need from this code is the following:

a. to pick up the mic activity level, read it, and based on the number put out a line

b. it to be kept to a minute, after the minute the screen is cleared and it plays back the lines and sounds that had been generated.

c. that nothing appears when the mic.activityLevel is 0

d.  that when lines hit each other, a sound is made

I don't care if there is no playback, but right now I can't even get the lines to appear and I need the sounds to play when the lines hit each other.  Any ideas would be helpful.

TOPICS
ActionScript
824
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 12, 2011 Apr 12, 2011

if your wav files are in your swf's library, right click each sound, click properties, tick export for actionscript and assign a unique class to each.  you can then use actionscript to play those library sounds.

for example, if you have a sound with class Sound1, you can use:

var s1:Sound=new Sound1();

s1.play();  // to play that sound

Translate
Community Expert ,
Apr 12, 2011 Apr 12, 2011

you're trying to load something flash can't find.  depending on whether testing is local or online, there are different things to check.

but bottomline:  check your code and check your file names.  there's an error somewhere in one of your load methods.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 12, 2011 Apr 12, 2011

this error:

Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error. at workingg_fla::MainTimeline/stage_EnterFrame()

...indicates that something is trying to load into flash but cannot be found at the path indicated in the code. Check to make sure all your .wav files exist, and that they are all sitting in the same directory as your swf (since that is what your code indicates), i.e.: If you have your .wav files in a subdirectory, the path to the .wav files would be incorrect and would be producing this error.

I don't see you trying to load anything besides the .wav files in the code, so they must be the culprit.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 12, 2011 Apr 12, 2011

Do I need to have the .wav files not just in the library but on the computer itself?  Is that the problem?  Because all the

.wav files are in the main library, no sub folder or anything of the sort.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 12, 2011 Apr 12, 2011

The way you have set up your code does not utilize files in the library. Flash is looking f

or the .wav files in the folder location where the swf resides(if that makes any sense)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 12, 2011 Apr 12, 2011
LATEST

if your wav files are in your swf's library, right click each sound, click properties, tick export for actionscript and assign a unique class to each.  you can then use actionscript to play those library sounds.

for example, if you have a sound with class Sound1, you can use:

var s1:Sound=new Sound1();

s1.play();  // to play that sound

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines