Game: choose between two objects - problems with registration points and loadMovies

Hello everyone,

I’ll try to be as detailed as possible, so here goes:

I’m new to Flash (have done a couple of simple gotoAndPlay image sites but that’s it) and using Flash MX. I can get my head around some of the Actionscripts and how to code them.

I’m trying to put together a game, and here’s a small breadown of what the game does:
[LIST=1]
[]Using the left and right arrow keys to move from point to point closer to the object you prefer
[
]The closer you get to the object the larger it gets and the opposite object becomes smaller
[*]When you press the space bar - the game re-sets, two new objects load into were the old objects are and the pointer (currently a small box) returns to the centre position. Also the point at where the small box was when you pressed the spacebar is parsed to the text box.[/LIST]Here’s what it looks like so far:

www.lindles.f9.co.uk/test1.swf

And here’s the code:

//ok - we're starting all over again

//function MoveStuff
function moveStuff() {
if (Key.isDown(Key.SPACE)) {
var pairings = (this._x / Box_mc.speed) - 1
displayMouse_txt.text = displayMouse_txt.text + "P" +pairings;
Box_mc._x = BoxUpsideDown_mc._x = startPosition;
rockLeft_mc.holder.unloadMovie();
rockRight_mc.holder.unloadMovie();
//Here's where I would like to load new movies
} 
if (Key.isDown(Key.LEFT) && Box_mc._x == (Box_mc.speed * 2)) {
displayMouse_txt.text = "STOP - YOU CAN'T GO ANY FURTHER LEFT";
BoxUpsideDown_mc._x = Box_mc._x;
}
else if (Key.isDown(Key.LEFT)) {
this._x -= this.speed;
BoxUpsideDown_mc._x = Box_mc._x;
rockLeft_mc.holder._xscale = rockLeft_mc.holder._yscale += 10;
rockRight_mc.holder._xscale = rockRight_mc.holder._yscale -= 10;
//pairingLeft_mc._xscale = pairingLeft_mc._yscale += 10;
//pairingRight_mc._xscale = pairingRight_mc._yscale -= 10;
}
if (Key.isDown(Key.RIGHT) && Box_mc._x == (Box_mc.speed * (numOfLillys +1))) {
displayMouse_txt.text = "STOP - YOU CAN'T GO ANY FURTHER RIGHT";
BoxUpsideDown_mc._x = Box_mc._x;
}
else if (Key.isDown(Key.RIGHT)) {
this._x += this.speed;
BoxUpsideDown_mc._x = Box_mc._x;
rockLeft_mc.holder._xscale = rockLeft_mc.holder._yscale -= 10;
rockRight_mc.holder._xscale = rockRight_mc.holder._yscale += 10;
//pairingLeft_mc._xscale = pairingLeft_mc._yscale -= 10;
//pairingRight_mc._xscale = pairingRight_mc._yscale += 10;
}
}

// here we're just setting where Box will appear and the size of the 
//  jumps he will move + the number of lillypads and where the place holders 
//  for the items should appear 
Box_mc.speed = 100;
Box_mc._y = Stage.height - Box_mc._height * 3;
BoxUpsideDown_mc._y = Box_mc._y + Box_mc._height - 10;
var numOfLillys = 5;
var startPosition = Box_mc.speed * 4;
Box_mc._x = Box_mc.speed * 4;
BoxUpsideDown_mc._x = Box_mc._x;
displayMouse_txt._x = startPosition; 
displayMouse_txt._y = 100;
rockLeft_mc.holder.loadMovie("Pairing1.swf", 1);
rockRight_mc.holder.loadMovie("Pairing2.swf", 1);
//pairingLeft_mc._y = pairingRight_mc._y = (Box_mc._y) - 30;
rockLeft_mc._x = (Box_mc.speed);
rockRight_mc._x = (Box_mc.speed * (numOfLillys + 2));
rockLeft_mc._y = rockRight_mc._y = Box_mc._y;
Box_mc.onEnterFrame = moveStuff;

//setting position of lillypads_mc and copying how many pads we need
// and there positions
lillypad_mc._x = Box_mc.speed * 2
lillypad_mc._y = Box_mc._y + 20
for(i=0; i<(numOfLillys); i++) {
        duplicateMovieClip (lillypad_mc, "mc"+i, i);
        setProperty ("mc"+i, _x, Box_mc.speed + (Box_mc.speed * (i+1)));
        setProperty ("mc"+i, _y, Box_mc._y + 20);
        Box_mc.swapDepths(i)
        trace(*);
}


What I would like to know is:
[INDENT]1. Is my code clean, do I need to change anything
[/INDENT][INDENT]2. How do I bring in new swfs based on a number that should be in sequence when the spacebar is pressed (you will see a line in the code //Here’s where I would like to load new movies). [/INDENT][INDENT][LIST]
[]Each swf is named pairing(n).swf where n is a number from 1 to 10. There are 10 pairings in total
[
]The left side loads all odd numbers in sequence, the right loads even numbers. This functionallity will allow me to change the external swfs on request
[*]I tried to use the same code which re-produces the mats (the points on which the box sits when you move the box) but I couldn’t get it to loop just the once (for each press of the spacebar), it loaded all the swfs with all the pairing numbers, e.g. pairing1.swf, pairing2.swf, pairing3.swf[/LIST]3. Is there anyway of changing the registration point of the imported swfs or the movieholder, as the code I use to scale _xscale and _yscale scales from 0,0 and it doesn’t work well.
[/INDENT]I don’t want you to write the code for me, but if you could point me in the right direction or give examples I would really appreciate it.

Many thanks in advance as I know everyone on here gives their time for free. I hope later (when I’ve learnt a bit more) that I can forward my knowledge.

Cheers.