So i have a problem. I found a cool old tv grain code (here :http://www.republicofcode.com/tutori…ash/old_grain/), but its written in AS2, and i want to convert it to AS3. So heres the original script
onClipEvent (enterFrame) {
_x = random(640);
_y = random(480);
_rotation = random(360);
_alpha = random(100);
_xscale = nue;
_yscale = nue;
nue = random(65);
}
My re-wrote version:
addEventListener(Event.ENTER_FRAME,start);
function start (e:Event):void{
x = Math. random()*640;
y = Math.random()*480;
rotation = Math.random()*360;
alpha = Math.random()*100;
scaleX = nue;
scaleY = nue;
nue = Math.random()*65;
But it says : 1120: Access of undefined property nue. Do you have any idea how to fix it?
Thanks in advance!
Hey guys!
Thank you for your help! I’m “working” with flash for 2 days so you both saved my life. I tried to solve my problem, and read about it but since my first language is not English it was a bit complicated! So thanks again,
A girl from Hungary
BTW. this is the final code
var nue:Number= 65;
addEventListener(Event.ENTER_FRAME, update);
function update(event:Event):void {
x = Math. random()*640;
y = Math.random()*480;
rotation = Math.random()*360;
alpha = Math.random()*10;
nue = Math.random()*65;
scaleX = nue;
scaleY = nue;
}
Yes, you have to declare
nueas a variable: