3 Replies Latest reply on Nov 23, 2008 6:46 PM by Ned Murphy

    how to position a flash movie within a web page?

    ducati1 Level 1
      Hi guys.
      I have a flash movie that is going to be loaded within another flash movie via an xml list.
      How can I set the position to load the inserted movie to the center of the page?
      At the moment it loads in the top left hand corner.
        • 1. Re: how to position a flash movie within a web page?
          Ned Murphy Adobe Community Professional & MVP
          What code are you using to load the movie?
          • 2. Re: how to position a flash movie within a web page?
            ducati1 Level 1
            Hi there.
            Thanks for replying.
            the website in question is www,ridethespiral.net and if you click on pilot map you will see the error.
            The main (Background) flash file is from a template site so I didn't write the code.
            But I think this is it.
            //Function used to load external SWF files and call the loader MC -------------------------------------------
            function loadMovieClip (externalTarget:String, targetRoot:MovieClip) {

            var mcLoader:MovieClipLoader = new MovieClipLoader ();
            var listenerLoad:Object = new Object ();

            listenerLoad.onLoadStart = function (target:MovieClip) {
            loader._visible = true;
            ZigoEngine.doTween (loader,'_alpha',100,0.5,"easeOutExpo");

            };
            //Loading Progress
            listenerLoad.onLoadProgress = function (target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
            percent = Math.round (bytesLoaded / bytesTotal * 100);
            loader.percentTxt.text = percent + "%";
            };
            //On Load Complete
            listenerLoad.onLoadComplete = function (target:MovieClip):Void {
            ZigoEngine.doTween (loader,'_alpha',0,0.5,"easeOutExpo",0,function () {
            loader._visible = false;
            });
            ZigoEngine.doTween (content_container,'_alpha',100,0.5,"easeOutExpo",0,function () {
            content_blocker._visible = false;
            });
            };

            mcLoader.addListener (listenerLoad);
            mcLoader.loadClip (externalTarget,targetRoot);
            }
            • 3. Re: how to position a flash movie within a web page?
              Ned Murphy Adobe Community Professional & MVP
              One reason I asked for the code was so I could determine what version of AS is being used. The other, to see where it's loading the movie. So it's AS2 and it appears to be targeted at the _root, which is what I suspected since it's aligning as you say. So what you probably need to do is create another target for it to load into, something that will center it. The variable that you want to revise is targetRoot, which appears in the following two lines of that function:

              function loadMovieClip (externalTarget:String, targetRoot:MovieClip) {
              .....
              mcLoader.loadClip (externalTarget,targetRoot);

              What you should be able to do is place a blank movieclip on the stage on the spot that will be the upper left corner of the centered file you're bringing in. Give it an instance name, and use that instance name in place of targetRoot in that function. Let's say you name it movieHolder... then the function code would change to...

              function loadMovieClip (externalTarget:String, movieHolder:MovieClip) {
              .....
              mcLoader.loadClip (externalTarget, movieHolder);

              I say "should" because I've no experience with AS2 as far as controlled loading goes, only AS3, but I figure it must be somewhat similar.