Groups | Blog | Home
all groups > flash actionscript > september 2007 >

flash actionscript : FLash button and PayPal



micgamb
9/5/2007 8:51:12 PM
Hallo everybody,
I have created a flash site in Flash 8 where I wil sell some t-shirts.
Now I have created a "Shopping Cart" within PayPal.
PayPal gave me the HTML code that I can use for my "Buy" buttons and "Check
Out" button.
Because the buttons of my site are made with Flash which is the ActionScript
command that I have to use to include the belowed code?
This code is referred to a Tee called "crazy printer" which cost ?30 +?4 for
shipping fees
thank you so much for your precious help

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="image" src="https://www.paypal.com/it_IT/i/btn/x-click-but22.gif"
border="0" name="submit" alt="Effettua i tuoi pagamenti con PayPal. un sistema
rapido, gratuito e sicuro.">
<img alt="" border="0" src="https://www.paypal.com/it_IT/i/scr/pixel.gif"
width="1" height="1">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="info@studiosimultaneo.com">
<input type="hidden" name="item_name" value="crazy printer">
<input type="hidden" name="amount" value="30.00">
<input type="hidden" name="shipping" value="4.00">
<input type="hidden" name="buyer_credit_promo_code" value="">
<input type="hidden" name="buyer_credit_product_category" value="">
<input type="hidden" name="buyer_credit_shipping_method" value="">
<input type="hidden" name="buyer_credit_user_address_change" value="">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="lc" value="IT">
<input type="hidden" name="bn" value="PP-ShopCartBF">
</form>

kglad
9/5/2007 10:27:29 PM
micgamb
9/6/2007 6:09:22 PM
thank you for your reply. Could you be more specific?
let's say that the button that triggers the action is called "tee1_bt" how do
I use loadvar() comand? can you tell me where I can look to understand much
more how it works?
thank so much for your precious help

that code is:
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="image" src="https://www.paypal.com/it_IT/i/btn/x-click-but22.gif"
border="0" name="submit" alt="Effettua i tuoi pagamenti con PayPal. un sistema
rapido, gratuito e sicuro.">
<img alt="" border="0" src="https://www.paypal.com/it_IT/i/scr/pixel.gif"
width="1" height="1">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="info@studiosimultaneo.com">
<input type="hidden" name="item_name" value="crazy printer">
<input type="hidden" name="amount" value="30.00">
<input type="hidden" name="shipping" value="4.00">
<input type="hidden" name="buyer_credit_promo_code" value="">
<input type="hidden" name="buyer_credit_product_category" value="">
<input type="hidden" name="buyer_credit_shipping_method" value="">
<input type="hidden" name="buyer_credit_user_address_change" value="">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="lc" value="IT">
<input type="hidden" name="bn" value="PP-ShopCartBF">
</form>


kglad
9/6/2007 6:28:39 PM
:



sendLV=new LoadVars();
receiveLV=new LoadVars();
sendLV.cmd="_cart";
sendLV.business="info@studiosimultaneo.com";
.
.
.
sendLV.bn="PP-ShopCartBF";

sendLV.sendAndLoad("https://www.paypal.com/cgi-bin/webscr?add=1",receiveLV,"POST
");
micgamb72
9/6/2007 9:19:17 PM
thanks again,
I have written your code like this:
tee1_bt.onRelease = function () {
sendLV=new LoadVars();
receiveLV=new LoadVars();
sendLV.cmd="_cart";
sendLV.business="info@studiosimultaneo.com";
sendLV.bn="PP-ShopCartBF";

sendLV.sendAndLoad("https://www.paypal.com/cgi-bin/webscr?add=1",receiveLV,"POST
");
};
stop();

The button tries to connec to to PayPal but nothing happen. Where do I attach
the whole PayPal code ?
sorry if I hassle you but I'am a sort of beginner of ActionScript

kglad
9/7/2007 4:17:07 AM
micgamb72
10/16/2007 8:41:24 PM
help!!
I have been trying to understand what to write on the "dots, dots, dots" part
and think I have missed a comand.

I did tried like this (I put some space between the right code that klad gave
me and my "dots, dots" one:
i do not think is a Paypal wrong code but if it is please let me know.
thank you so much

taglia_s.onRelease = function () {
sendLV=new LoadVars();
receiveLV=new LoadVars();
sendLV.cmd="_cart";
sendLV.business="info@studiosimultaneo.com";


sendLV=new LoadVars("<form target="paypal"
action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com/it_IT/i/btn/x-click-but22.gif"
border="0" name="submit" alt="Effettua i tuoi pagamenti con PayPal. un sistema
rapido, gratuito e sicuro.">
<img alt="" border="0" src="https://www.paypal.com/it_IT/i/scr/pixel.gif"
width="1" height="1">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="info@studiosimultaneo.com">
<input type="hidden" name="item_name" value="crazy printer">
<input type="hidden" name="amount" value="30.00">
<input type="hidden" name="shipping" value="4.00">
<input type="hidden" name="buyer_credit_promo_code" value="">
<input type="hidden" name="buyer_credit_product_category" value="">
<input type="hidden" name="buyer_credit_shipping_method" value="">
<input type="hidden" name="buyer_credit_user_address_change" value="">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="lc" value="IT">
<input type="hidden" name="bn" value="PP-ShopCartBF">
</form>");


sendLV.bn="PP-ShopCartBF";

sendLV.sendAndLoad("https://www.paypal.com/cgi-bin/webscr?add=1",receiveLV,"POST
");
};
stop();
micgamb72
10/16/2007 10:23:57 PM
after a few trial we came up with this code . Flash states that it has not
errors in it but still it does not connect with paypal when published on th
net. When we paly the swf in remote computer it tries to connect to the Paypal
website. following I attached the code given from Paypal related to a button
called "taglia_s":

taglia_s.onRelease = function (){
sendLV=new LoadVars();
receiveLV=new LoadVars();
sendLV.cmd="_cart";
sendLV.business="info@studiosimultaneo.com";
sendLV.item_name ="crazy printer";
sendLV.amount ="32.00";
sendLV.shipping ="4.00";
sendLV.buyer_credit_promo_code ="";
sendLV.buyer_credit_product_category ="";
sendLV.buyer_credit_shipping_method ="";
sendLV.buyer_credit_user_address_change ="";
sendLV.no_shipping ="0";
sendLV.no_note ="1";
sendLV.currency_code ="EUR";
sendLV.lc ="IT";
sendLV.bn="PP-ShopCartBF";

sendLV.sendAndLoad("https://www.paypal.com/cgi-bin/webscr?add=1",receiveLV,"POST
");
};
stop();

could somebody tell me where I make the mistake? Thank you so much
kglad
10/16/2007 10:26:08 PM
no, that's not going to work. look, i already encoded:



/* html code begin
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="info@studiosimultaneo.com">
*/ html code end

// translates to:

sendLV.cmd="_cart";
sendLV.business="info@studiosimultaneo.com";

// now you need to translate the html code below to actionscript:
/* begin
<input type="hidden" name="item_name" value="crazy printer">
<input type="hidden" name="amount" value="30.00">
<input type="hidden" name="shipping" value="4.00">
<input type="hidden" name="buyer_credit_promo_code" value="">
<input type="hidden" name="buyer_credit_product_category" value="">
<input type="hidden" name="buyer_credit_shipping_method" value="">
<input type="hidden" name="buyer_credit_user_address_change" value="">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="lc" value="IT">
<input type="hidden" name="bn" value="PP-ShopCartBF">
*/ end
micgamb72
10/17/2007 12:00:00 AM
thank you so much for the reply..but what do you mean by "encoding"?
sorry to be so "dull" but it is a bit hard to understand how it works..
I have translated the HTML code in a similar way that you had done the first
bit.

this is yours:

/* html code begin
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="info@studiosimultaneo.com">
*/ html code end

// translates to:

sendLV.cmd="_cart";
sendLV.business="info@studiosimultaneo.com";

and this is mine:
<input type="hidden" name="item_name" value="crazy printer">
<input type="hidden" name="amount" value="30.00">
<input type="hidden" name="shipping" value="4.00">

translates to:
sendLV.item_name ="crazy printer";
sendLV.amount ="32.00";
sendLV.shipping ="4.00";

so..what the is the complete right code that I have to use starting from the
trigging "comand taglia_s . onRelease = function..."and so on ?

thank you so much you have been very helpful . this part of my website is the
most important one, without this nothing will "work". thank you again


kglad
10/17/2007 5:57:18 PM
by "encoding" i meant translating the html form to actionscript.

and you did that perfectly in your above message and also in a message
dated/timed 10/16/2007 03:23:56 PM that i hadn't seen before.

try changing your sendAndLoad() to a send so you can open a new window to
paypal:





sendLV.send("https://www.paypal.com/cgi-bin/webscr?add=1","_blank","POST");
micgamb72
10/17/2007 8:29:43 PM
kglad
10/17/2007 10:58:54 PM
AddThis Social Bookmark Button