I am trying to create a button in flash which when clicked allows the buyer
to
purchase a bands CD, but has one cost for UK residents and another for
elsewhere. So far i have the button working so that it will charge one set
fee
and i have coded the flash button as follows: on (release) {
getURL('www.oosterdok.com&cancel_return=http%3A//www.oosterdok.com&n
o_no
te=1?cy_code=GBP'
target='_blank'>[url]https://www.paypal.com/xclick/business=info%40brownhouserecords.[/
url]
com&undefined_quantity=1&item_name=Some+day+we+will+part+forever+%28
EP%2
9&item_number=BHR00001&amount=4.00&page_style=PayPal&no_ship
ping
=2&return=http%3A//www.oosterdok.com&cancel_return=http%3A//www.oost
erdo
k.com&no_note=1?cy_code=GBP'); } any ideas how to add a drop down so
that the user can choose UK or Rest of World which updates the price from ?4
to
?5 accordingly thanx
You would have to create an event handler that "listens" for when the combob
ox
is changed. There is a copy/paste example in the help files. It is approx
in
this path. component dictionary > combobox > using the combobox in an
application > there is the example.
Just set a variable in the listener, that is read when the button is clicked
.
You will have an if statement in your button code to handle the different ra
tes.
You could do the same thing with radiobuttons, which might be more user
friendly/smaller since you only have 2 options.
Post back if you don't have success with the example.
Cheers ulitmateCF.....I haven't managed to find the source of the path you
described, but i did a search on google and found this link..
[url]http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/[/
url]
wwhelp.htm?context=Flash_MX_2004&file=00002142.html is this describing
what you are referring to? And I would add this event handler code to the co
de
i already had included (as listed in my previous post) for the button? Would
this sufficiently alter to the price when the buyer was taken to the paypal
page? Sorry this is my first attempt at this so have little experience. I d
id
go down another route using the web snap-in from web assist. I have pretty m
uch
achieved the same thing that we are talking about above with a combobox that
you choose UK or Rest of World from and it updates the price accordingly.
However for some reason the currency will not shift from dollars within
paypal, and I want it to be in pounds. is it possible for me to send you the
fla file for you to look at? many thanx
Yes that is the exact code from the help files. This code does not get
attached to your button, but rather the timeline. This code will control th
e
setting of a variable. The button then reads that variable to set the corre
ct
price. Here is how the code should work in your file.
//assigns the value of a variable to the label that was selected in a combob
ox
function change(evt){
_global.myPrice = evt.target.selectedItem.label;
trace(evt.target.selectedItem.label);
}
myComboBox.addEventListener("change", this);
//this gets attached to your button, just incorporate the variable into your
link to run your pricing logic. i think in paypal you have two different li
nks
for the different prices
on(release){
if(myPrice == "Price A"){
//put link to paypal price a here
}else if (myPrice == "Price B"){
//put link to paypal price b here
}else{
//display an error, because they did not select anything
}
}
ps: I typed this out fast online, so double check for any goof ups.
Cheers ulitmateCF.....I haven't managed to find the source of the path you
described, but i did a search on google and found this link..
[url]http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/[/
url]
wwhelp.htm?context=Flash_MX_2004&file=00002142.html is this describing
what you are referring to? And I would add this event handler code to the co
de
i already had included (as listed in my previous post) for the button? Would
this sufficiently alter to the price when the buyer was taken to the paypal
page? Sorry this is my first attempt at this so have little experience. I d
id
go down another route using the web snap-in from web assist. I have pretty m
uch
achieved the same thing that we are talking about above with a combobox that
you choose UK or Rest of World from and it updates the price accordingly.
However for some reason the currency will not shift from dollars within
paypal, and I want it to be in pounds. is it possible for me to send you the
fla file for you to look at? many thanx
thanks, i think i am almost there. I have got the paypal button/movie to sen
d
you to the paypal purchase screen, however if i change the location from uk
to
rest of world it doesn't update the price when you are taken to paypal. I ha
ve
obviously missed something. My flash file is under 400kb, could i send this
to
you so you could see t first hand? I'll list the code below just for referen
ce.
In the timeline i have.. // Set the initial price for when the movie loads
setPrice(); function setPrice() { // Get the price (based on locati
on)
var newPrice = location.getValue(); // Set visible price on page thePr
ice
= '?' + location.getValue(); } //assigns the value of a variable to the lab
el
that was selected in a combobox function change(evt){ _global.newPri
ce =
evt.target.selectedItem.label; trace(evt.target.selectedItem.label); }
newPrice.addEventListener('change', this); For the button I have..
on(release){ if(newPrice =
'4'){getURL('https://www.paypal.com/xclick/business=info%40brownhousere
cords.com
&undefined_quantity=1&item_name=Some+day+we+will+part+forever+%28EP%
29&a
mp;item_number=BHR00001&amount=4.00&page_style=PayPal&no_shippin
g=2&
amp;return=http%3A//www.oosterdok.com&cancel_return=http%3A//www.oosterd
ok.c
om&no_note=1¤cy_code=GBP'); }else if(newPrice =
'5'){getURL('https://www.paypal.com/xclick/business=info%40brownhousere
cords.com
&undefined_quantity=1&item_name=Some+day+we+will+part+forever+%28EP%
29&a
mp;item_number=BHR00001&amount=5.00&page_style=PayPal&no_shippin
g=2&
amp;return=http%3A//www.oosterdok.com&cancel_return=http%3A//www.oosterd
ok.c
om&no_note=1¤cy_code=GBP'); } } the combobox is called
'location' and the dynamic text that displays the price has the variable
'thePrice'. thanks again...
Post it somewhere and I will dl it. In the meantime you can troubleshoot as
well. Put trace statements inside of your if statement so you know if eithe
r
logic path is being triggered. That will help you isolate what is broken an
d
aide you in fixing this and future movies.
if(myPrice == "4"){
trace("A is true");
}else if(myPrice == "5"){
trace("B is true");
}else{
trace("error could not evaluate if");
}
Post it somewhere and I will dl it. In the meantime you can troubleshoot as
well. Put trace statements inside of your if statement so you know if eithe
r
logic path is being triggered. That will help you isolate what is broken an
d
aide you in fixing this and future movies.
if(myPrice == "4"){
trace("A is true");
}else if(myPrice == "5"){
trace("B is true");
}else{
trace("error could not evaluate if");
}
Cheers ulitmateCF.....I haven't managed to find the source of the path you
described, but i did a search on google and found this link..
[url]http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/[/
url]
wwhelp.htm?context=Flash_MX_2004&file=00002142.html is this describing
what you are referring to? And I would add this event handler code to the co
de
i already had included (as listed in my previous post) for the button? Would
this sufficiently alter to the price when the buyer was taken to the paypal
page? Sorry this is my first attempt at this so have little experience. I d
id
go down another route using the web snap-in from web assist. I have pretty m
uch
achieved the same thing that we are talking about above with a combobox that
you choose UK or Rest of World from and it updates the price accordingly.
However for some reason the currency will not shift from dollars within
paypal, and I want it to be in pounds. is it possible for me to send you the
fla file for you to look at? many thanx
Hi, you can download my flash file from the site address of the website I am
creating www.oosterdok.com hope you have better luck than me. Let me know as
soon as you have downloaded it as i need to put the site back up - cheers