Dear jr1734
Your question seems straight forward to me. Let me try to break it
down - and supply snippets of code where that is pertinent.
1)
<<
I give our partners our URL in the following form:
http://www.mywebsite.com?rsrc=affiliate
>>
The customer finds your affiliate's site, sees a banner for your
service, and clicks the above mentioned link. Then the customer arrive
at your server.
2)
Your setup: You did not mention anything about your server, or the
kind of server side script options you have available, so I will
assume that you want this done without resorting to anything more than
the scripting available in Explorer / Netscape.
The Buyer downloads a HTML document with this URL from your server.
http://www.mywebsite.com?rsrc=affiliate
First you need to extract the part after the question mark from the
URL. This part is called the "query string", and if the query string
consist of any non-ascii letters, they are URL-encoded. Extracting
the query string can be very eaily done with Javascript. Here are some
lines of code for extracting the query string and making sure that :
Javascript Code:
function getQueryString()
{
str = document.location.search;
return str;
}
(Note: If you use the Apache web server, this can be very easily done
with something called SSI - server side includes. And other servers
have other options. But as I said, it can be done perfectly well with
Javascript, so if you don't know about server side scripting, you do
not have to worry.)
3)
Now you have the query string. All that remains is to get that string
into you flash movie. To do that you need to ADD the query string to
the path pointing to your flash movie:
Let us say that your movie is named "mymovie.swf". You need to embed
"mymovie.swf?rsrc=affiliate" in the HTML code. Let us further say that
the movie has background color #000000 (black), it is 600 pixels wide
and 400 pixels tall. Then the final embedded code should look like
this:
<object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
width="600" height="400">
<param name="movie" value="mymovie.swf?rsrc=affiliate">
<param name="quality" value="best">
<param name="menu" value="false">
<param name="align" value="lt">
<param name="scale" value="exactfit">
<param name="bgcolor" value="#000000">
<embed
src="mymovie.swf?rsrc=affiliate"
quality="best" scale="exactfit" salign="lt" menu="false"
bgcolor="#000000"
width="600"
height="400"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash">
</embed></object>
Are you with me so far? This is the way Macromedia recommends solving
the problems of using flash in banner campaigns etc.
Here is a link to the Macromedia Training Center for rich media
banners:
http://www.macromedia.com/resources/richmedia/tracking/
4)
You need to generate the code above on the fly, and that too can be
done with Javascript:
Javascript Code:
function flash4EmbedCode (mov_src, mov_wdt, mov_hgt, mov_col)
{
embed_code = '<object \n';
embed_code += ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
\n';
embed_code += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"\n';
embed_code += ' width="' + mov_wdt + '" height="' + mov_hgt +
'">\n';
embed_code += ' <param name="movie" value="' + mov_src + '">\n';
embed_code += ' <param name="quality" value="best">\n';
embed_code += ' <param name="menu" value="false">\n';
embed_code += ' <param name="align" value="lt">\n';
embed_code += ' <param name="scale" value="exactfit" \n';
embed_code += ' <param name="bgcolor" value="' + mov_col + '">\n';
embed_code += '<embed \n';
embed_code += ' src="' + mov_src + '" \n';
embed_code += ' quality="best" scale="exactfit" salign="lt"
menu="false" \n';
embed_code += ' bgcolor=' + mov_col + ' \n';
embed_code += ' width="' + mov_wdt + '" \n';
embed_code += ' height="' + mov_hgt + '" \n';
embed_code += ' type="application/x-shockwave-flash" \n';
embed_code += ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash">\n';
embed_code += '</embed></object>';
return embed_code;
}
5)
Bringing the javascript together.
All you need to do is to embed this chunk of code in an HTML document
wher you want the movie to appear:
<script type="text/javascript><!--
// this you have to set
var src = "mymovie.swf";
var wdt = "600";
var hgt = "400";
var col = "#000000";
function getQueryString()
{
str = document.location.search;
return str;
}
// gets the query information
src = src + getQueryString();
function flash4EmbedCode (mov_src, mov_wdt, mov_hgt, mov_col)
{
embed_code = '<object \n';
embed_code += ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
\n';
embed_code += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"\n';
embed_code += ' width="' + mov_wdt + '" height="' + mov_hgt +
'">\n';
embed_code += ' <param name="movie" value="' + mov_src + '">\n';
embed_code += ' <param name="quality" value="best">\n';
embed_code += ' <param name="menu" value="false">\n';
embed_code += ' <param name="align" value="lt">\n';
embed_code += ' <param name="scale" value="exactfit" \n';
embed_code += ' <param name="bgcolor" value="' + mov_col + '">\n';
embed_code += '<embed \n';
embed_code += ' src="' + mov_src + '" \n';
embed_code += ' quality="best" scale="exactfit" salign="lt"
menu="false" \n';
embed_code += ' bgcolor=' + mov_col + ' \n';
embed_code += ' width="' + mov_wdt + '" \n';
embed_code += ' height="' + mov_hgt + '" \n';
embed_code += ' type="application/x-shockwave-flash" \n';
embed_code += ' pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash">\n';
embed_code += '</embed></object>';
return embed_code;
}
// generates the embed code
var embed_code = flash4EmbedCode (src, wdt, hgt, col);
// actally embeds the movie
document.write (embed_code);
//--></script>
Phew! Are you with me so far ?
6)
At this moment the information we need actually resides on the main
timeline (what you would call '_level0' in action script terminology).
I assume that you have some kind of actionscripting to keep track of
what the customers order (that would be the pcode part below).
Actually opening the URL that confirms the order is the easy part. All
you need is to append the 'affiliate code' (that resides in level 0)
to the other information generated by the flash movie. The
actionscript command would look like this:
Flash actinscript (on a button)
on (release)
{
getURL ("http://www.blank.com/blankpass/index.html?" add
"pcode=pcode&" add "rsrc=" add _level0:rsrc);
}
7)
You are done!
This solution works in Flash 4 movies, in Netscape and Explorer and
Mozilla and Opera, on a Mac and on a PC.
Good luck! |