PDA

View Full Version : Navigation / Co-ordinating Problems


Possessed
12-01-2003, 02:45 PM
I have a button in the root, with an actionscript to put a menu into a specific place on the stage, note the menu is outside the stage and then it directs to the co-ords. This is the script;

on (rollOver) {

_root.Menu._x += (387-_root.Block._x)*.42;
_root.Menu._y += (187-_root.Block._y)*.42;

};

on (rollOut) {

_root.Block._x += (-117.5-_root.Block._x)*.42;
_root.Block._y += (-317.5-_root.Block._y)*.42;

};

HOWEVER, it only pluses the co-ords on rollover to the current co-ords, then minuses the second set of co-ords on roll out. This gives a bizzare un-uniform positioning of the menu. I don't know how to configure load and unload so I don't know how to make it just 'appear' on screen, although that would be good. Basically I want the menu to appear in the centre of the stage on roll over then go off the stage on roll out.

All help is gratified =).

cubed
12-05-2003, 01:21 AM
Try this:
on (rollOver) {
setProperty("_root.block", _x, "250");
setProperty("_root.block", _y, "200");
}
on (rollOut) {
setProperty("_root.block", _x, "-250");
setProperty("_root.block", _y, "-200");
}
Just replace with your values :)

tenoch
12-05-2003, 10:07 AM
Hello!

The problem with your code is that the += operator is just adding to the existing _x/_y values. Use the = operator to give the properties a new value and not just add to it.

I've been working on a similar thing that you're trying to do. You can read more about it here: http://www.actionscript.org/forums/showthread.php3?threadid=38761

And here are som tuts you may want to read:
- attachMovie: http://www.actionscript.org/tutorials/beginner/attachMovie/index.shtml
- loadMovie: http://www.kirupa.com/developer/mx/loading.htm

:)

Possessed
12-06-2003, 08:19 AM
Thanks that has helped a lot. I have it working now =).