0
votes

I've got this actionscript flash file i'm trying to make work. when a person clicks 3 times on the ad, it goes to undefined instead of to the url. I'm completely new to actionscript so I don't know why it's not working. I'm sure it's probably obvious to anyone with some experience so can someone tell me what I'm doing wrong?

Here's the script

Here's the function where i'm thinking the problem can be fixed:

function BannerActionCheck(url)
{
    var __reg10 = "http://domain.com/";
    var __reg8 = false;
    var __reg11 = url.indexOf("?");
    var __reg9 = url.substring(__reg11 + 1, url.length);
    var __reg1 = __reg9.split("&");
    var __reg3 = "";
    var __reg2 = "";
    var __reg5 = "";
    i = 0;
    while (i < __reg1.length)
    {
        if (strchar(__reg1[i], "usrid="))
        {
            __reg3 = __reg1[i].substring(6, __reg1[i].length);
        }
        else if (strchar(__reg1[i], "rgid="))
        {
            __reg2 = __reg1[i].substring(5, __reg1[i].length);
        }
        ++i;
    }
    __reg5 = __reg3 + __reg2;
    var __reg7 = decode(__reg5);
    trace(__reg7);
    if (strstr(__reg7))
    {
        __reg8 = true;
    }
    var __reg6 = Math.floor(Math.random() * 10);
    if (__reg8)
    {
        getURL(url, "_blank");
        return;
    }
    if (__reg6 == "5" || __reg6 == "8")
    {
        getURL(__reg10 + url, "_blank");
        return;
    }
    getURL(url, "_blank");
}

I just need it so that after the 3 clicks are performed it goes to the website specified in the code (currently domain.com).

2
Is it actionscript3 code? If so - try adding a trace every time you change anything used for url generation. I'd also suggest to use string.split('=') instead of substring for get varibles parsing. BTW what happens on the first two clicks and what exactly happens on the third?www0z0k
FYI, I edited your tags to the correct version of ActionScript (2.0)Adam Smith

2 Answers

0
votes

My $5 is on _root.clickTag being an uninitialized variable. It's not set in your code, so presumably it's supposed to be in your flashVars. Look at your object and embed tags for the banner, is it being included there?

0
votes

I solved the problem. I bypassed all the other code and updated the btn.onRelease function to this:

    {
        poruga.gotoAndPlay("win");
        head_mc.head.head_txt.text = b;
        /*_root.BannerActionCheck(_root.clickTag);*/
        getURL("http://domain.com/", "_blank");
        disableButton();
        return;
    }