View Full Version : dragging an image across the screen.....
ifty40
01-05-2005, 01:01 AM
Hi i am trying to drag an image across the screen so when that image has been dragged to it's target the target frame should appear with a message....Below is the code i am using.
can it be done on a mouse release ?
onrelease(mouseUp) {
if (this.hitTest(_root.t1)) {
_x = _root.t1._x;
_y = _root.t1._y;
nextFrame ();
_root.score += 10;
stopDrag ();
} else {
_x = myX;
_y = myY;
stopDrag ();
}
}
onClipEvent (load) {
myX = _x;
myY = _y;
}
Hi,
You cant use a mouseup event inside an onrelease event. Maybe something like this.....
onClipEvent (load) {
myX = this._x;
myY = this._y;
}
onClipEvent (enterFrame) {
this.onPress = function() {
startDrag(this);
}
this.onRelease = this.onReleaseOutside=function () {
if (this.hitTest(_root.t1)) {
_x = _root.t1._x;
_y = _root.t1._y;
nextFrame();
_root.score += 10;
stopDrag();
} else {
this._x = myX;
this._y = myY;
stopDrag();
}
}
}
ifty40
01-05-2005, 03:53 AM
hi, from the code you posted how do i make it go to another frame?
Basically what i'm trying to do is like before the score will add or decreae by 10 but instead of the user typing in the answer i want the answer to be dragged from a list of options (buttons) and when the right button is dragged in, the clip should move to a different fram using "goto" so it can move on to the next question. And i would prefer this to take place in the same scene.
Hi,
Change the nextFrame function in the code to whatever you need.....
ex...
_root.gotoAndPlay('frameLabel');
or
_root.mcName.gotoAndPlay('frameLabel');
Powered by vBulletin™ Version 4.1.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.