A question about loading a movie into location?

when loading a movie into the main timeline is there a way to tell the movie to load into the center? instead of a set x,y postion? im sure its just a few extra lines of math… any help?

thanks!

It would be easier to just set it using x and y, but anyway. Let’s say you have a stage of w700 and h500:


mc.loadMovie("something.swf");
mc.onEnterFrame = function(){
if(this.getBytesLoaded() == this.getBytesTotal()){
this._x = 700-(this._width/2);
this._y = 500-(this._height/2);
delete this.onEnterFrame;
}
}

it would be easier to use a simple x/y point, however what if you dont know the center of the movie, say when the swf is at 100%x100% in the browser… thats what I am trying to figure out how to do.

I don’t think that’ll make a difference because when you set your animation to 100% you’ll be stretching it, not making it wider. I’ml not sure though, but why don’t you test it ? :slight_smile:

not if the whole movie is not being stretched to 100% :wink:

assuming reg point is in center.


gizmo._x=(stage.width)/2;
gizmo._y=(stage.height)/2;

Montoya – No offense, but if you load an swf into a movieclip, won’t the registration point will be in the top-left ? Oh, and stage would be with a capital :slight_smile:

Xmattx – Then don’t place it at 100% :stuck_out_tongue:

Voets,

No offense taken… To clarify,

when loading a movie into the main timeline is there a way to tell the movie to load into the center?

This was his request. And the answer satisfies that.

On the capitalization… the capitalization is required for MX2004, MX does not require it, although I agree it is a good practice.

You’re right about the loading of the swf. The swf that you are loading loads from the top/right. However, the empty movie clip or parent movie clip still has the registration in the center… (that was the assumption made above).

Oh I see :slight_smile:

About stage: you’re right, I always thought it had to be Stage … thanks for that, always learning :slight_smile:

Me too :slight_smile:

thanks :slight_smile: