so ive started to embrace AS3 and im trying to learn the OOP aspects abt it which is DOCUMENT CLASS.
i went thru this tutorial:
http://www.gotoandlearn.com/play?id=43
so erm well u basically make stars with random scale and coordinates every 10 secs on timer event.
And i think i got the hang of private public and all that crap.
So i was thinking is it possible to store variables in that star as private so i dun have to like make an array to store all those stars variables in public? And erm so yeah i think the only way to do that is to make a Star class. and i was liek WOOHOO ok lets go. and then there was 30seconds of awkward silence between AS3 and me. =(
so basically how do i make classes of the star and stuffs o_O im not quite sure how to summarise what im doing but yeah can someone help plox.
Jus in case u want teh code:
package
{
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class DocumentClass extends MovieClip{
private var timer:Timer = new Timer(100);
public function DocumentClass():void{
timer.addEventListener(TimerEvent.TIMER,makeStar);
timer.start();
}
private function makeStar(e:TimerEvent):void{
var star:Star= new Star();
star.scaleX = star.scaleY=Math.random();
star.x = Math.random()*this.stage.stageWidth
star.y = Math.random()*this.stage.stageHeight
star.rotation=Math.random()*360
this.addChild(star);
}
}
}