flashdunce
Technical User
Hi again Now that i have suuccessfully loaded my jpeg into the movieclip the jpeg seems to load in the corner of the movie clip. Is there a way to have the jpeg file centered inside the movie clip?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
stop();
// create this movie clip, and storing it as a variable container
var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
// centralising it to stage
container._x = Stage.width / 2;
container._y = Stage.height / 2;
// create a second movie clip within container, this is to manipulate the _x and _y properties
var image:MovieClip = container.createEmptyMovieClip("image", container.getNextHighestDepth());
// create a movie clip loader for checking of loading progress
var mcLoader:MovieClipLoader = new MovieClipLoader();
// a listener to listen to events of mcLoader
var listener:Object = new Object();
listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
// tracing out the progress, do your preloader here
trace(target + ".onLoadProgress with " + bytesLoaded + " bytes of " + bytesTotal);
}
listener.onLoadInit = function (Void):Void {
// once the image is loaded, we will offset it's _x and _y according to it's _width & _height
image._x = 0 - image._width / 2;
image._y = 0 - image._height / 2;
}
// registers the listener to mcLoader
mcLoader.addListener(listener);
// load the image
mcLoader.loadClip("[URL unfurl="true"]http://www.google.com.sg/intl/en_com/images/logo_plain.png",[/URL] image);