LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-05-2008, 01:15 PM
codeBeast codeBeast is offline
Registered User
 
Join Date: Jun 2008
Posts: 4
Rep Power: 0
codeBeast is on a distinguished road
drag and drop - sequence game

I have most of the code done - as I got it off the web via a forum. BUTthe droptarget bit doesn't work. ie I drag the hamburger to the box BUT nothing happens.
The following code is pasted into the mc hamburger2. I will have other instances of hamburgers and chips. It is a sequence darg and drop for kids - ie: They will have to drag the right combination. Three boxes will be filled already - hamburger, chips, chips - they will have to keep the secuence going. BUT I can't even get started if the box1 doesn't recognise the hamburger.

Actionscript:
onClipEvent (enterFrame) {
 dragSetup(_root.hamburger2,_root.box1); 
function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
this.beingDragged=true; 
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false; 
if (eval(this._droptarget) == targ) {
this.onTarget = true;
_root.targ.gotoAndStop(2);
} else {
this.onTarget = false;
_root.targ.gotoAndStop(1);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;
}
};
} 
}

Last edited by m. allen west : 06-05-2008 at 06:48 PM Reason: [AS]Tag needed[/AS]
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag and Drop Game Whitewizard Game Programming 1 10-04-2006 06:33 AM
Need help with drag and drop game, Urgent! shush1 Game Programming 2 07-02-2006 02:41 AM
drag and drop shapes in a particular sequence? brebsy Newbies 2 12-07-2005 03:46 PM
Drag & Drop Help! jmwebcenter Flash MX 2004 1 02-08-2004 07:27 PM
How to unable Drag and Drop movies. choi_kathryn Flash 5 Actionscript 1 11-30-2002 02:14 PM




All times are GMT. The time now is 07:15 AM.