PDA

View Full Version : Are you up for a challenge?



nykol86
November 3rd, 2007, 12:27 AM
Any bored AS3 pros wanna convert this AS2 tutorial?

http://www.flashkit.com/tutorials/Special_Effects/Old_Scra-Black-754/index.php

I really want to use it in my movie.

Dazzer
November 3rd, 2007, 12:36 AM
public function Main():void
{
var temp:Sprite = new Sprite();
this.addChild(temp);
temp.addEventListener(Event.ENTER_FRAME, onEnterFrame, false, 0 , true);
}

private function onEnterFrame(e:Event):void{
var temp:Sprite = e.currentTarget as Sprite
var xpos:int = Math.round(Math.random() * 300);

temp.graphics.clear();
temp.graphics.lineStyle(1,0x333333);
temp.graphics.moveTo(xpos,0);
temp.graphics.lineTo(xpos,300);

temp.graphics.drawCircle(Math.random()*300, Math.random()*300,1);
temp.graphics.drawCircle(Math.random()*300, Math.random()*300,1);
}

nykol86
November 3rd, 2007, 01:04 AM
ooh speedy reply, thank you.
but how do I make it work? (I'm a newbie.)
...I'd like it as a movieclip.

Dazzer
November 3rd, 2007, 01:10 AM
Well sorry I'm only going that far.

You can use that as a MovieClip class. the Main() class is the constructor. So if you had a class called "Thing" you call it "Thing()". If you don't know how to link a class to a MovieClip, and to create a class, then you might be in the wrong place ^^

Basically all that code there is enough for you to do what you need to do.

nykol86
November 3rd, 2007, 01:55 AM
you're right, its mine to figure out from here on.
i've had a long day and i'm just being lazy.

thank you :)