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) 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)-(scalew/2)
snap_mc._y=(Stage.height/2)-(scaleh/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=xscale
dot_mc._y=yscale
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(nrnr + ngng + nbnb)
bc=before.getPixel(x,y)
br=bc>>16&0xff;
bg=bc>>8&0xff
bb=bc&0xff
bl=Math.sqrt(brbr + bgbg + bbbb)
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.