Errors in AS need help ASAP

can anybody help me with this: I made a MAC X menu that doesn’t work I am pretty sure there are some errors in AS, can anybody can go through this and fix my errors or tell me what the problem that I am having.

I have 10 icons, my stage size is 850 x 100px… i have 2 MC drag and control the first frame of my movie has this code:

startDrag ("_parent.drag", true);
stop ();

and control MC has the code below: and my meny doesn’t wotk at all


onClipEvent (load) {
function checkOffset(coffset) {
if (coffset<-175) {
coffset = -175;
} else if (coffset>175) {
coffset = 175;
}
return coffset;
}
function setScale(soffset) {
return 100*(3-(2*(Math.abs(soffset)/175)));
}
}
onClipEvent (mouseMove) {
// Get cursor x and y coordinates
y = getProperty("_parent.drag", _y);
x = getProperty("_parent.drag", _x);
// Find cursor offset for each icon based on icon’s starting location
soundOffset = x-160;
aboutEventsOffset = x-220;
newsOffset = x-280;
productsOffset = x-340;
guestOffset = x-400;
howtoOffset = x-460;
inventionsOffset = x-520;
contactOffset = x-580;
linksOffset = x-640;
homeOffset = x-700;
// If cursor is inside menu
if (y>=0 and y<=50 and x>=175and x<=700) {
// Make sure the offsets are within acceptable limits
soundOffset = checkOffset(soundOffset);
aboutOffset = checkOffset(aboutOffset);
newsOffset = checkOffset(newsOffset);
productsOffset = checkOffset(productsOffset);
guestOffset = checkOffset(guestOffset);
howtoOffset = checkOffset(howtoOffset);
inventionsOffset = checkOffset(inventionsOffset);
contactOffset = checkOffset(contactOffset);
linksOffset = checkOffset(linksOffset);
homeOffset = checkOffset(homeOffset);
// Move the sound Icon
setProperty("_parent.sound", _x, 160-soundOffset);
setProperty("_parent.sound", _xscale, setScale(soundOffset));
setProperty("_parent.sound", _yscale, setScale(soundOffset));
// Move the about icon
setProperty("_parent.about", _x, 220-aboutOffset);
setProperty("_parent.about", _xscale, setScale(aboutOffset));
setProperty("_parent.about", _yscale, setScale(aboutOffset));
// Move the news icon
setProperty("_parent.news", _x, 280-newsOffset);
setProperty("_parent.news", _xscale, setScale(newsOffset));
setProperty("_parent.news", _yscale, setScale(newsOffset));
// Move the productsIcon
setProperty("_parent.products", _x, 340-productsOffset);
setProperty("_parent.products", _xscale, setScale(productsOffset));
setProperty("_parent.products", _yscale, setScale(productsOffset));
// Move the guest Icon
setProperty("_parent.guest", _x, 400-guestOffset);
setProperty("_parent.guest", _xscale, setScale(guestOffset));
setProperty("_parent.guest", _yscale, setScale(guestOffset));
// Move the howto Icon
setProperty("_parent.howto", _x, 460-howtoOffset);
setProperty("_parent.howto", _xscale, setScale(howtoOffset));
setProperty("_parent.howto", _yscale, setScale(howtoOffset));
// Move the inventions Icon
setProperty("_parent.inventions", _x, 520-inventionsOffset);
setProperty("_parent.inventions", _xscale, setScale(inventionsOffset));
setProperty("_parent.inventions", _yscale, setScale(inventionsOffset));
// Move the contact Icon
setProperty("_parent.contact", _x, 580-contactOffset);
setProperty("_parent.contact", _xscale, setScale(contactOffset));
setProperty("_parent.contact", _yscale, setScale(contactOffset));
// Move the linksIcon
setProperty("_parent.links", _x, 640-linksOffset);
setProperty("_parent.links", _xscale, setScale(linksOffset));
setProperty("_parent.links", _yscale, setScale(linksOffset));
// Move the home Icon
setProperty("_parent.home", _x, 700-homeOffset);
setProperty("_parent.home", _xscale, setScale(homeOffset));
setProperty("_parent.home", _yscale, setScale(homeOffset));
} else {
setProperty("_parent.sound", _x, 160);
setProperty("_parent.sound", _xscale, 100);
setProperty("_parent.sound", _yscale, 100);
setProperty("_parent.about", _x, 220);
setProperty("_parent.about", _xscale, 100);
setProperty("_parent.about", _yscale, 100);
setProperty("_parent.news", _x, 280);
setProperty("_parent.news", _xscale, 100);
setProperty("_parent.news", _yscale, 100);
setProperty("_parent.products", _x, 340);
setProperty("_parent.products", _xscale, 100);
setProperty("_parent.products", _yscale, 100);
setProperty("_parent.guest", _x, 400);
setProperty("_parent.guest", _xscale, 100);
setProperty("_parent.guest", _yscale, 100);
setProperty("_parent.howto", _x, 460);
setProperty("_parent.howto", _xscale, 100);
setProperty("_parent.howto", _yscale, 100);
setProperty("_parent.inventions", _x, 520);
setProperty("_parent.inventions", _xscale, 100);
setProperty("_parent.inventions", _yscale, 100);
setProperty("_parent.contact", _x, 580);
setProperty("_parent.contact", _xscale, 100);
setProperty("_parent.contact", _yscale, 100);
setProperty("_parent.links", _x, 640);
setProperty("_parent.links", _xscale, 100);
setProperty("_parent.links", _yscale, 100);
setProperty("_parent.home", _x, 700);
setProperty("_parent.home", _xscale, 100);
setProperty("_parent.home", _yscale, 100);
}
}


thanks

hm… what flash version are you on…?

I am using flash MX

simple test example: drag clip is at _x=0;
so: as x = getProperty("_parent.drag", _x);
you get x=0
which means that in
if (y>=0 and y<=50 and x>=175and x<=700)
x is not >=175 so it evaluates to false…
and all the rest never gets executed…until the else

Use lots of trace(variable); to check on the returned values…

Next: supposing the if(){…did execute, we have:
soundOffset = x-160;
as x=0, you get soundOffset = 0-160; so soundOffset = -160;

which means that
soundOffset = checkOffset(soundOffset);
equals
soundOffset = checkOffset(-160);
your function now:
function checkOffset(-160) {
if (coffset<-175) { //false
coffset = -175;
} else if (coffset>175) { //false
coffset = 175;
}
return coffset; //returns the same value -160
and using that, here
setProperty("_parent.sound", _x, 160-soundOffset);
you get setProperty("_parent.sound", _x, 160–160);
is that what you want?
anyway, it’ll just go straight to else, and you get
setProperty("_parent.sound", _x, 160);
with a scale of 100…

as much as a quick read seemed to return :wink: