Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-07-2006, 12:14 PM   #1
milohound
Registered User
 
Join Date: Jan 2002
Posts: 29
Default Building a Drag-and-Drop Shopping Cart

Im trying to create a very simple drag and drop style shopping cart in Flash.
The idea is to have a .asp page send a list of words to flash and using the words recieved, allow the user to drag and drop them into a shopping cart. Using hitTest() send the words that are in the shopping cart(movieClip) back to the .asp page.

Any help on how best to approach this will be much appreciated!!
milohound is offline   Reply With Quote
Old 03-08-2006, 07:54 AM   #2
Headshotz
TEAM INTERNET
 
Headshotz's Avatar
 
Join Date: Jul 2005
Location: Batcave
Posts: 2,761
Send a message via MSN to Headshotz
Default

Its a great idea, do you have existing code?
__________________
The author of windows file copy dialogue visits some friends:
"I'm just outside of town so I should be there in about 15 minutes"
"Actually it's looking more like 6 days"
"No, wait, 30 seconds"
Headshotz is offline   Reply With Quote
Old 03-22-2006, 12:55 AM   #3
GFlashMan
Registered User
 
Join Date: Mar 2006
Posts: 17
Default reply

I found a drag and drop Flash shopping cart at http://useinfotech.com

I sent them an email asking if they would send the code for the small one on their site and well:

//first frame
name_x = getProperty("/name", _x);
name_y = getProperty("/name", _y);


//create a button named item which can be an image, and create a movie clip called itemfader. The fader is a 3 frame clip that is invisible on the first frame, half visible on the second frame and full visible on the third frame. In the main timeline, stack the button on top of the fader.
Add this script to the button:

on (press) {
startDrag("/item");
tellTarget ("/item"){
nextFrame();
}
}
on (release, releaseOutside) {
stopDrag();
if (getProperty("/item", _droptarget) eq "/cart") {
/orderform:quantity1.text = Number(/orderform:quantity1.text)+1;
/orderform:total1.text = /orderform:quantity1.text*15;//price
setProperty("/item", _visible, 0);
tellTarget ("/itemfader"){
nextFrame();
}
} else {
setProperty("/item", _x, /:item_x);
setProperty("/item", _y, /:item_y);
tellTarget ("/itemfader"){
gotoAndStop(1);
}
}
}


Duplicate the above movieclip and button,name the instances item2, add the same above code to that button, but change item to item2.
Now create a movieclip and give an instance name of cart. Place that clip on the frame one timeline.
Create a movieclip and give an instance name of orderform. Inside the movie clip "orderform" is a dynamic text field named quantity1, a dynamic text field named total1, a dynamic text field named total2, and a dynamic text field named grandtotal. The actionscript in the "orderform" clip is:

grandtotal.text = Number(total1.text)+Number(total2.text)

You can add a submit button inside the "orderform" movieclip such as this paypal one:

on (release) {
paypal = new LoadVars();
paypal.cmd="_xclick";
paypal.item_name="Complete cart order";
paypal.upload="1";
paypal.business="[email protected]";
paypal.currency_code="USD";
paypal.amount=Number(total1.text)+Number(total2.te xt);
paypal.handling ="0";
paypal.send("https://www.paypal.com/cgi-bin/webscr","_blank","post");
}



I think that's everything, or at least it gives you the idea.
GFlashMan is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
drag and drop from a movie instance batgirl_sa ActionScript 1.0 (and below) 0 09-03-2005 10:24 AM
advanced drag and drop - available targets dependent upon previous drop robgobbler ActionScript 2.0 0 10-18-2004 08:48 PM
random drag and drop nicky ActionScript 1.0 (and below) 10 08-02-2004 09:23 AM
Drag & Drop Peculiar Problem apprentice ActionScript 1.0 (and below) 7 12-31-2003 11:14 AM
can't recreate Drag and Drop w/ target from tutorial Clay ActionScript 1.0 (and below) 2 02-07-2002 04:19 PM


All times are GMT. The time now is 04:00 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.