Skip to main content
November 15, 2006
Question

Loadmovie and center horizontally

  • November 15, 2006
  • 3 replies
  • 225 views
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?
This topic has been closed for replies.

3 replies

Known Participant
April 28, 2007
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!
November 15, 2006
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)
Marghoob Sulemaan
Inspiring
November 15, 2006
copy and paste below code to your fla on frame 1. it should work. i am using flash8.
//code