Does anyone know a good example of timeline control, For example if I create a movieclip then link a class to that movieclip could I make a function in the parent class that would stop at every frame in the children of this class, or must I control only the timeline of each child after I instantiate them?
Ok, I'm not sure if I understand what you are asking. Do you mean like stopping the MovieClip from the main timeline?
//Create the movieclip var mov:MyClip = new MyClip(); //This is the code that stops the movieclip. mov.stop(); //add that **** to the stage addChild(mov);
If not, please explain more, and i'll be happy to help.
well I figured it out why my code wasn't working :P the Movieclip in my library wasn't linked to the correct class...anyways thanks for the help I will show ya'll my code
What is does is whenever you create an instance of MC on the stage it will stop the Timeline for that particular instance the function with the same name as the class(the constructor function, which also the same name as my movieclip but this isn't nesecssary) runs the exact same time when an instance is made. Idk I know a little about programming, still kinda new to Flash and AS3
The Movieclip Class which is linked to the Movieclip in the Library
package {
import flash.display.*;
public class MC extends MovieClip {
public function MC() { this.stop();
} }
}
The Document Class
package { import flash.display.*;
public class Main extends MovieClip {
public function Main() { var mcInstance: MC= new MC(); mcInstance.x = 100; mcInstance.y = 100; addChild(mcInstance); } } }
quick note though: if you want to be able to contact your MC instance again from the document class (or elsewhere) you may want to move the property declaration (var) outside of the Document Class constructor - that way you store a reference to the object which you can use down the road - for instance:
package { import flash.display.*;
public class Main extends MovieClip {
public var hero:MovieClip;
public function Main():void { hero = new Hero(); addChild( hero ); }
public function quit():void { removeChild( hero ); }