5 Replies Latest reply on Oct 16, 2013 6:53 AM by rjgalido

    Problem with loaded SWF AS2

    rjgalido

      HI guys,

       

      My name is Richard. May I ask something cause I have a problem with AS2.0

       

      My question is I have a loaded swf to my Main SWF. The problem is the loaded SWF has multiple movieclips in it and dynamic textfields too.

      Is there any way I could change the alpha or other attributes of some movie clips, also dynamically put texts in the dynamic text field?

       

      Thanks in advance.

       

      Regards.

        • 1. Re: Problem with loaded SWF AS2
          Ned Murphy Adobe Community Professional & MVP

          When you load the swf you should be creating an instance thru which you can target it and whatever objects it contains that are also targetable.  What code are you using to load the swf?

          • 2. Re: Problem with loaded SWF AS2
            rjgalido Level 1

            Hi Ned,

             

            My code looks like this :

             

             

             

            var container_mc:MovieClip = createEmptyMovieClip("container_mc", _getNextHighestDepth());

            var swfLoader:MovieClipLoader = new MovieClipLoader();

            var loadingListener:Object=new Object();

             

            swfLoader.addListener(loadingListener);

             

            loadingListener.onLoadComplete = function(container:MovieClip):Void

            {

                trace("The MovieClip " + container + " has completed loading");

                      trace(container.stage.width + ", " + container.stage.height);

              

             

             

                      //sample: change alpha of box movieclip with instance named box1 of the loaded swf file myswf

             

                      container.box1._alpha=0;

             

             

              //change text of the dynamic text with instance name text1 of the loaded swf file myswf

             

             

                      container.text1.text="my Text";

            };

             

            loadingListener.onLoadError = function(container:MovieClip, errorCode:String):Void

            {

                trace("Error loading the file. Error code = " + errorCode);

            };

             

             

            swfLoader.loadClip("myswf.swf",container_mc);

             

             

            Thanks.

            • 3. Re: Problem with loaded SWF AS2
              Ned Murphy Adobe Community Professional & MVP

              You should be able to target the loaded swf using container_mc

              • 4. Re: Problem with loaded SWF AS2
                rjgalido Level 1

                Yes, this does not work as well Ned...

                Im thinking of loadClipNum using levels, will that work?

                • 5. Re: Problem with loaded SWF AS2
                  rjgalido Level 1

                  Hi Ned,

                   

                  I got everything worked at onLoadInit..

                   

                  Thanks