# Flash 8 Webcam/Audio data

**URL:** <https://forum.kirupa.com/t/flash-8-webcam-audio-data/216562>\
**Category:** flash\
**Created:** [February 18, 2007, 5:54am UTC](https://forum.kirupa.com/t/flash-8-webcam-audio-data/216562 "2007-02-18T05:54:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aug\_designer](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@aug\_designer](https://forum.kirupa.com/u/aug_designer)\
**Post date:** [February 18, 2007, 5:54am UTC](https://forum.kirupa.com/t/flash-8-webcam-audio-data/216562/1 "2007-02-18T05:54:14Z")

</div>

I am admittedly an amateur at Actionscript, but I’m trying to produce an example of Flash’s ability to process video/microphone data as a “jumping off” point for other projects. My problem is:

I am using some open source to pick up web cam movement and produce a matrix based on such. I have added the code to receive microphone input, which worked in the example (provided at [kirupa.com](http://kirupa.com)) that I composed on my machine. I am trying to replace the “dot\_mc.1=255” value with the microphone activity value (0-100?) yet I am getting a response of “The property being referenced does not have the static attribute.” I understand this statement, but I am unsure as how to re-form this statement to accept variable data.

Here is the code so far:

import flash.display.\*  
import flash.geom.\*

mic = Microphone.get();  
\_root.attachAudio(mic);  
mic.setUseEchoSuppression(false);

function initialize()  
{  
setInterval(this,“snap”,100)  
this.createEmptyMovieClip(“snap\_mc”,this.getNextHighestDepth())  
snap\_mc.\_x=(Stage.width/2)-(scale_w/2)  
snap\_mc.\_y=(Stage.height/2)-(scale_h/2)  
m=new Matrix()  
m.scale((output.\_xscale/100),(output.\_yscale/100))  
now=new BitmapData(w,h)  
rt=new Rectangle(0,0,w,h)  
n=0  
for(x=1;x\<w;x+=o)  
{  
for(y=1;y\<h;y+=o)  
{  
++n  
dot\_mc=snap\_mc.createEmptyMovieClip(“dot”+n,n)  
dot\_mc.\_x=x_scale  
dot\_mc.\_y=y_scale  
dot\_mc.lineStyle(dblo,0x000000)  
dot\_mc.lineTo(0,1)  
}  
}  
}

function snap()  
{  
var c=0  
now.draw(output,m)  
for(var x=1;x\<w;x+=o)  
{  
for(var y=1;y\<h;y+=o)  
{  
++c  
nc=now.getPixel(x,y)  
nr=nc\>\>16&0xff;  
ng=nc\>\>8&0xff;  
nb=nc&0xff;  
nl=Math.sqrt(nr_nr + ng_ng + nb_nb)  
bc=before.getPixel(x,y)  
br=bc\>\>16&0xff;  
bg=bc\>\>8&0xff  
bb=bc&0xff  
bl=Math.sqrt(br_br + bg_bg + bb_bb)  
d=Math.round(Math.abs(bl-nl))  
dot\_mc=snap\_mc[“dot”+c]  
if(d\>tolerance)  
{  
dot\_mc.clear()  
dot\_mc.l=255  
dot\_mc.lineStyle(dblo,255\<\<8)  
dot\_mc.lineTo(0,1)  
dot\_mc.onEnterFrame=fadePixel  
}  
}

```
}
updateAfterEvent()
before=now.clone()

```

}

function fadePixel()  
{  
this.clear()  
this.l-=this.\_parent.\_parent.ml  
this.lineStyle(this.\_parent.\_parent.dblo,this.l\<\<8)  
this.lineTo(0,1)  
if(this.l == 0)  
{  
delete this.onEnterFrame  
}  
}

* * *

Altering the dot\_mc value varies the colors of the webcam matrix dots, so I just need the activity level on the microphone to act as the value and perhaps multiply it by 2 (since the dot\_mc value can be up to 255).

Any Ideas on how to repair this?

Thanks in advance for help on my first post/thousandth visit.
