2 Replies Latest reply on Feb 5, 2010 5:35 AM by Francisc

    Loading a swf into an as3 project.

    Gil1982

      Hi,

       

      I'm trying to load a swf into an as3 project for two days now and I haven´t been successfull.

      I have a movieclip with some actionscript, that i have to load to the as3 project and add it several times to the stage.

      I've tried loading it with the Loader, but then it doesn't allow me to add it several times.

      I also tried embeding the movieclip as a symbol inside a swf, but this allways ignores the actionscript and runs the movieclip in a loop.

        • 1. Re: Loading a swf into an as3 project.
          Gil1982 Level 1

          I clicked 'post message' by mistake. So, my question is : Is there anyway, and there must be, to load a SWF with actionscript and add it several times to the stage. I know this must be a newbie question, but I searched the internet and can't find an answer.

           

          I apreciate any help you can give me in advance.

           

          Gil.

          • 2. Re: Loading a swf into an as3 project.
            Francisc Level 3

            Use a loader but a different one everytime.

             

            var myLoader:SWFLoader=new SWFLoader();
            myLoader.source="etc.swf";
            addChild(myLoader);

             

            If you want to reference them later on, add each loader to an ArrayCollection so you can then remove them, hide them, change size or source, whatever, using holderAC[something].

             

            If you want to add 10 loaders and "remember" them:

             

            private var holderAC:ArrayCollection=new ArrayCollection();

             

            (...)

             

            for(var i:uint=9;i<10;i++)

            {

                 var myLoader:SWFLoader=new SWFLoader();
                 myLoader.source="etc.swf";

                 addChild(myLoader);

                 holderAC.addItem(myLoader);

            }