I don’t know what’s going on here. I have some onRelease functions on movieclips that work fine. However one of them takes the user to a contact form in another frame but after selecting another button to go back to the first frame of the movieclip none of the functions work again.
Here’s a link to my swf so you can see what I mean:
It’s kind of glitchy because it’s on deviantart and I took out a lot of stuff so the .swf would be smaller.
And here is the action script I’m using:
stop();
Stage.scaleMode="noScale";
Stage.align="TL";
onLoad = function() :Void {
definedMove(img, 50, -1300, -2150);
};
img.explore.onRelease = function():Void {
onMouseMove = function ():Void {
constrainedMove(img, 5, 0, 0, _xmouse, _ymouse);
};
};
img.contact.onRelease = function():Void {
onMouseMove = null;
definedMove(img, 100, -1300, -2150);
img.gotoAndPlay(2);
};
///////////////////functions////////////////
function constrainedMove(target:MovieClip, speed:Number, dir:Number, dir2:Number):Void {
var mousePercent:Number = _xmouse/Stage.width;
var mousePercent2:Number = _ymouse/Stage.height;
var mSpeed:Number;
var mSpeed2:Number;
if (dir == 1) {
mSpeed = 1-mousePercent;
} else {
mSpeed = mousePercent;
}
/////////////////////////////
if (dir2 == 1) {
mSpeed2 = 1-mousePercent2;
} else {
mSpeed2 = mousePercent2;
}
////////////////////////
target.destX = Math.round(-((target._width-Stage.width)*mSpeed));
target.destY = Math.round(-((target._height-Stage.height)*mSpeed2));
target.onEnterFrame = function() {
if (target._x == target.destX) {
delete target.onEnterFrame;
} else {
target._x += Math.ceil((target.destX-target._x)*(speed/75));
}
if (target._y == target.destY) {
delete target.onEnterFrame;
} else {
target._y += Math.ceil((target.destY-target._y)*(speed/75));
}
};
}
function definedMove(target:MovieClip, speed:Number, destination:Number, destination2:Number):Void {
target.onEnterFrame = function() {
if (target._x == destination) {
delete target.onEnterFrame;
} else if ((destination-target._x)>0) {
target._x += Math.ceil((destination-target._x)*(speed/100));
} else {
target._x += Math.floor((destination-target._x)*(speed/100));
};
if (target._y == destination2) {
delete target.onEnterFrame;
} else if ((destination2-target._y)>0) {
target._y += Math.ceil((destination2-target._y)*(speed/100));
} else {
target._y += Math.floor((destination2-target._y)*(speed/100));
};
};
};
I’m thinking because the actionscript is located in the _root of the whole .fla and all the action is happening in the img movieclip that something is off. I just don’t know what else to do. Any help would be greatly appreciated. Thanks!