How to add a movie to the stage
The code below is used to make a slideshow. It works as long as I load my content into container_mc. container_mc is a movieclip that is created on the stage and it contains a simple shape for a background.
Instead of creating the movieclip on the stage I want to generate the movieclip dynamically as follows:
container_mc1=new MovieClip;
container_mc1.width=100;
container_mc1.height=100;
s=new Shape;
container_mc1.addChild(s);
this.addChild(container_mc1);
However, the movieclip does not seem to be added to the stage. It does not work when I uncomment the line:
//slideView = new SlideshowView(container_mc1);
How should I connect container_mc1 to the stage? Thank you!
package{
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import mvc.SlideshowModel;
import mvc.SlideshowView;
public class SlideshowDocument extends MovieClip{
private var slideModel:SlideshowModel;
private var slideView:SlideshowView;
private var req:URLRequest=new URLRequest("data.xml");
private var container_mc1:MovieClip;
private var s:Shape;
public function SlideshowDocument(){
container_mc1=new MovieClip;
container_mc1.width=100;
container_mc1.height=100;
s=new Shape;
container_mc1.addChild(s)
this.addChild(container_mc1)
slideView = new SlideshowView(container_mc);
//slideView = new SlideshowView(container_mc1);
slideModel = new SlideshowModel();
slideView.model = slideModel;
slideModel.load(req);
}
}
}