I am building a flash banner ad that contains a dropdown list of US states. Once the list is clicked I want to pass the state code onto the end of the url for the ad.
I used to be ok with actionscript but it was several years ago, and I'm wondering if its possible to have the ad grab the URL from the parent <a href>
and just tack the state code onto it. I assume this is how clickTags work?
on (release) {
if (clickTAG.substr(0,5) == "http:") {
getURL(clickTAG, "_top");
}
}
Can anyone offer any tips on how best to do this? I'm fine with building the actual ad, its just I'm not sure if I need to hard code 50 urls into my dropdown? It seems a bad way of doing things, and I'm sure theres a better way?
Many thanks.
clickTAG is a string which is the URL that has been put as a parameter in the embed code, and is the URL to click through to.
Since, it's just a string, you can add whatever you need to it programmatically.
I would do it this way:
Say you want to add argument to the end of the URL like ?state=NY
on (release) {
if (clickTAG.substr(0,5) == "http:") {
var url:String;
url = clickTAG + dropDownMenu.getCurrentStateCode() // I'm not sure how your drop down works, so this last part is just pseudocode.
getURL(url, "_top");
}
}