i have this script shortened:
public class Main extends MovieClip {
var news_mc:NEWS = new NEWS();
var studio_mc:STUDIO = new STUDIO();
var webworks_mc:WEBWORKS = new WEBWORKS();
var print_mc:PRINT = new PRINT();
var contact_mc:CONTACT = new CONTACT();
public function Main() {
}
}
I quickly realize that all the custom classes is already loaded in the first frame, but i have to declare them at the start of the package because i want to use the variable anywhere in the class file.
the problem is, i have some scripted animation on the custom classes, and once i addChild anyone of the custom class, it immediately go to the part where the scripted animation is finished(it was already loaded in the first frame, i think the animation is already played on the background).
so i created a new private function so that the animation would be reseted:
private function Reset(num:uint) {
switch (num) {
case 1 :
news_mc = new NEWS();
break;
case 2 :
studio_mc = new STUDIO();
break;
case 3 :
webworks_mc = new WEBWORKS();
break;
case 4 :
print_mc = new PRINT();
break;
case 5 :
blog_mc = new BLOG();
break;
case 6 :
contact_mc = new CONTACT();
break;
}
}
it’s working good and all, but it seem to get laggish after a while, i got a feeling that it’s taking up too much resources. I’m new to AS3, i’m not even sure if tis is the best way to do it, help~~