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




 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-16-2011, 11:40 AM
ahidam ahidam is offline
Registered User
 
Join Date: May 2011
Posts: 1
Rep Power: 0
ahidam is on a distinguished road
Drag&Drop game

Hey,

I want to make game which will work as i am going to have 6 foodstuff both healthy and unhealthy. When we throw a healthy food on a table we will get a point for it.

I am very confuse how and where to begin. I have searched on google but cant find anything that can helps so much.

Here i have a code i have tried with, but its not working.

I will be very thankfull if anyone of you can help me.

Actionscript:
var startX:Number;
var startY:Number;
var counter:Number = 0;
 
healthy1.addEventListener(MouseEvent.MOUSE_DOWN, drag);
healthy1.addEventListener(MouseEvent.MOUSE_UP, drop);
healthy2.addEventListener(MouseEvent.MOUSE_DOWN, drag);
healthy2.addEventListener(MouseEvent.MOUSE_UP, drop);
healthy3.addEventListener(MouseEvent.MOUSE_DOWN, drag);
healthy3.addEventListener(MouseEvent.MOUSE_UP, drop);
 
function drag(event:MouseEvent):void {
 
event.target.startDrag(true);
reply_txt.text = "";
event.target.parent.addChild(event.target);
startX = event.target.x;
startY = event.target.y;
}
 
function drop(event:MouseEvent):void {
event.target.stopDrag();
 
var myTargetName:String = "target" + event.target.name;
var myTarget:DisplayObject = getChildByName(myTargetName);
if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
reply_txt.text = "******";
 
event.target.removeEventListener(MouseEvent.MOUSE_DOWN, drag);
event.target.removeEventListener(MouseEvent.MOUSE_UP, drop);
 
event.target.buttonMode = false;
event.target.x = myTarget.x;
event.target.y = myTarget.y;
counter++;
} else {
reply_txt.text = "******";
event.target.x = startX;
event.target.y = startY;
}
if(counter == 4){
reply_txt.text = "*******";
}
}
 
healthy1.buttonMode = true;
healthy2.buttonMode = true;
healthy3.buttonMode = true;
I I have also been given idea for another different code:
healthy1.healthy = true;
healthy2.healthy = true;

if (event.target.healthy == true)......

and then use hittesting or dropTarget.

But i am not sure how to use this code.

PLz help anyone, its urgent

Last edited by FlashMove : 06-03-2011 at 01:58 AM
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
An Interesting Office Game maomao85 Flash Games 1 12-04-2010 07:23 PM
Details in Collaborating and Developing our first game BlueMonkeyFlash Flash Games 0 03-27-2010 11:21 PM
Text Based Game - Already Built & Established - At Least $100 a Day JoRd Work/Job Opportunities 1 10-12-2007 10:53 PM
$$$ We're paying to sponsor game designers! $$$ Westech Work/Job Opportunities 7 03-27-2007 01:09 AM
Using Screens for Flash game Isekream Flash Games 0 04-02-2006 03:05 PM




All times are GMT. The time now is 11:30 AM.