Loading a SWF into a constrained area

Hello again lovley Kirupa people :slight_smile:

I’m having some technical difficulties with a bit of flash I’m working on (I bet you’ve heard that one before) - let me outline what’s going on here…

First off I have a little movie called “background.swf”, which is a lovley scrolling background affair which uses the following actionscript to operate:

onClipEvent (enterFrame) {
    if (_parent.mainVar == 0) {
        homeX = (-_parent._xmouse*1.4);
    } else {
        homeX = (-_parent.mainVar*1.4);
    }
    thisX = _x;
    diffX = homeX-thisX;
    if (_parent.mainVar == 0) {
        moveX = diffX/40;
    } else {
        moveX = diffX/5;
    }
    _x = thisX+moveX;
}

This all works just fine, when you move the mouse, the background scrolls perfectly, and when exported it looks like this…

[center]
*[size=1]exported ‘background.swf’ – 460 x 380 pixels

[/size]* [left][size=2]I also have a second movie, which is the main movie. I wish to load the background movie into the main movie, so I used the following actionscript:

	_root.createEmptyMovieClip("container", 1);
	loadMovie("background.swf", "container");
	container._x = 150 ;
	container._y = 20 ; 

This does indeed load the background.swf movie clip into the the main one, but it doesn’t ‘constrain’ it to the correct dimensions (460x380) and it spills out over the edges (see below)

[/size] [center]
[size=1]*the ‘main.swf’ movie exported – see how the background.swf spills out…

*[/size] [left]Now what appears to be happening is that my actionscript for the scrolling background appears to be working on the main.swf’s document dimensions rather than the background.swf’s document dimensions.

So, what I am asking is - is there a way for me to load a movie into a container which it will not spill out over from, or do I need to modify my actionscript for the background scoller?

Any help will be greatly appreciated, if you need me to post my fla files I can…

Thanks
jonny.
[/left]
[/center]
[/left]
[/center]