class - ActionScript 3, Creating Instances of Library's Movie Clip for appropriate Scene -


hello stackoverflow gurus.
new as3, , sorry if questions naive, but...

i have movie clip progress_mc in library.
have 3 scenes, 50-framed motion tweens.
, control buttons play appropriate scene.

question 1. how can create instance of progress_mc using documentclass?
i've tried in class:

public class progressmc extends movieclip   {     public function addinstance():void   {       var progress_mc:movieclip = new movieclip();     this.addchild(progress_mc);   }   } 

then put

addinstance();
1 frame of scene1.
doesn't work. no instance appears.

maybe such approach wrong... show me correct, please.

question 2. , how create instance appropriate scene?
should put call of public function @ every 1-st frame of each scene?
or there correct decision?

edit-1:
ok, found answer.
step1. mitim described.
step2. using code @ timeline:

var p1:progress_mc = new progress_mc();  p1.name = "p1"; p1.x = 50; p1.y = 50;  addchild(p1); 

however, still not evident

.scene
possibilities. wrapping scene in 1 movie clip variant.

(i making assumption you're using flash ide)

for question 1, need set class linkage name of "progress_mc" movieclip in library. go it's properties in library , check "export actionscript" , set it's class name. instead of going:

new movieclip() 

which make new empty movieclip object, you'd go

new myclassname() 

to create new instance of library clip. can add stage you're doing so.

for question 2, i'm not sure in scene...but if frame animation, scenes wrapped in movieclips , treated same.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -