views:

25

answers:

2

i want to add to stage a movieclip in another class not the .as file as the same name of .fla file how can i get this.

When i run same code in main.as i get the result but in another class it runs but no result.

A: 

Either you need to pass Stage object to the other class or make this other class a DisplayObject and add it to the Stage then stage object will be accessible to this class and you can add new DisplayObject to the stage.

bhups
A: 

First add the other class to the stage using an addChild from the document class (main class). Now just call this.addChild(whatever) from the other class - it will work.

Adding the new child to self

Stage
|
|__DocumentClass - this.addChild(another_class)
   |
   | 
   |
   |__AnotherClass - this.addChild(new movieclip)
      |
      | 
      |
      |__ NewMovieClip      

Adding the new child to the main movieclip

Stage
|
|__DocumentClass - this.addChild(another_class)
   |
   | 
   |
   |__AnotherClass - this.root.addChild(new movieclip)
   |
   | 
   |
   |__ NewMovieClip      

Adding the new child to the stage

Stage
|
|__DocumentClass - this.addChild(another_class)
|  |
|  | 
|  |
|  |__AnotherClass - this.stage.addChild(new movieclip)
|
| 
|
|__ NewMovieClip 
Amarghosh