Flash Code 4th December '08

This is some code typed to enable various functions on flash. I will upload the .swf once completed.

drag.onPress = function() {
drag.startDrag();
};
//////////////////this is for contol by mouse///////////////////////
drag.onRelease = function() {
drag.stopDrag();
};
//////////////////this is for contol by mouse///////////////////////
drag.onReleaseOutside = function() {
drag.stopDrag();
};
//////////////////Button Control///////////////////////
left.onPress = function() {
left.onEnterFrame = function () {
drag._x-=10;
};
};
left.onRelease = function() {
left.onEnterFrame = null;
};
left.onReleaseOutside = function() {
left.onEnterFrame = null;
};

right.onPress = function() {
right.onEnterFrame = function () {
drag._x+=10;
};
};
right.onRelease = function() {
right.onEnterFrame = null;
};
right.onReleaseOutside = function() {
right.onEnterFrame = null;
};

up.onPress = function() {
up.onEnterFrame = function () {
drag._y-=10;
};
};
up.onRelease = function() {
up.onEnterFrame = null;
};
up.onReleaseOutside = function() {
up.onEnterFrame = null;
};

down.onPress = function() {
down.onEnterFrame = function () {
drag._y+=10;
};
};
down.onRelease = function() {
down.onEnterFrame = null;
};
down.onReleaseOutside = function() {
down.onEnterFrame = null;
};
//////////////////this is for contol by mouse///////////////////////
object.onEnterFrame = function() {
if (this.hitTest(hit_object)) {
drag._yscale = 160;
drag._xscale = 160;
drag._rotation = -20;
} else {
hit._yscale = 100;
hit._xscale = 100;
hit._rotation = -10;
}
};

No comments:

Post a Comment