Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

position movie clips 2

Status
Not open for further replies.

ksbigfoot

Programmer
Apr 15, 2002
856
CA
I have a movie clip (swf) that loads two other movie clips (swf).
How can I position the movieclips onto my stage?
Also, can I position my movieclips on top of one another?

Here is how I am loading my movieclips so far
Code:
loadMovieNum("First.swf", 1);
loadMovieNum("Second.swf", 2);

thanks
 
You cannot easily position them from your main movie until they are fully loaded...
Workaround is to pre-position them within themselves, by adding the following on their first frames...

this._x = 150; // Offset from top-left corner (0,0) of main...
this._y = 200; // Offset from top-left corner (0,0) of main...

You can even use negative numbers...



Regards. Web Hosting - Web Design
03/13/05 -> OLDNEWBIE VS FLASHKIT
 
You can do something like this to move "First.swf" to (300, 300):
Code:
loadMovieNum("First.swf", 1);
loadMovieNum("Second.swf", 2);
this.onEnterFrame = function() {
	if (_level1 != undefined) {
		_level1._x = 300;
		_level1._y = 300;
		delete this.onEnterFrame;
	}
};
As for "on top of one another", higher level goes above lower level, so in this instance Second.swf goes on top of First.swf.

(loadMovieNum is for Flash 4 by the way and unless you need to do it in Flash 4 I wouldn't use it. Use loadMovie or loadClip instead!)

Kenneth Kawamoto
 
Howdy,

Thank you both, both of your examples work. I gave a star to both of you. I ended up using Kenneth's example, but I had to do it this way.

Code:
loadMovieNum("First.swf", 1);
loadMovieNum("Second.swf", 2);
this.onEnterFrame = function() {
    _level1._x = 300;
    _level1._y = 300;
};

Not sure I will get an error if First.swf is really large and takes a long time to load.

Thanks again,
ksbigfoot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top