3 Replies Latest reply on Apr 28, 2007 1:36 PM by Flash Cus

    Loadmovie and center horizontally

    Level 1
      How do I load a movie and then specify that it is center-justified on the screen regardless of how wide or tall the window is?
        • 1. Re: Loadmovie and center horizontally
          Marghoob Suleman Level 1
          copy and paste below code to your fla on frame 1. it should work. i am using flash8.
          //code

          • 2. Re: Loadmovie and center horizontally
            Level 1
            I tried your code and it worked great with the png file. However, when I substituted the swf file I wanted to center, it did not work. My modified code looked liked this:


            //System.security.allowDomain(" http://www.w3.org/")
            this.createEmptyMovieClip("img_mc", this.getNextHighestDepth())
            var imgListener:Object = new Object()
            var imgLoader:MovieClipLoader = new MovieClipLoader()
            imgListener.onLoadProgress = function(target_mc) {
            //you can show anything while loading
            }
            imgListener.onLoadComplete = function(target_mc) {
            //you can do when loading process is complete
            }
            imgListener.onLoadError = function(target_mc) {
            //you can do something if image not found.
            }
            imgListener.onLoadInit = function(target_mc) {
            //here you can do something when image is loaded successfully.
            //so you want to center your images
            target_mc._x = Stage.width/2 - target_mc._width/2;
            target_mc._y = Stage.height/2 - target_mc._height/2;
            }
            //add listerner object
            imgLoader.loadClip("flashshow7.swf",img_mc)
            imgLoader.addListener(imgListener)
            • 3. Re: Loadmovie and center horizontally
              Flash Cus
              Marghoob Sulemaan YOU ARE A GENIUS. After a few utterly boring days of trying to work this out, i stumble accross this thread and BANG, the solution hit me. And you were the one who threw it. CHEERS!