Getting the result of a Javascript function into Flash?

This is driving me nuts.

So, I have a site that has a button on it and someone did a little javascript so that each time you click the button you go to a randomly selected URL from an array of links.

Now, I was told to give my flash button the same functionality. I’m not really a coder, so instead of re-inventing the wheel, I’m trying to get the result of the javascript into my action script. So far, I’m completely unlucky.

Here’s the javascript:



<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
                    var uc = 4;    
                    var u = new Array(uc);    
                    u[0] = "http://blahblahblah.html";
                    u[1] = "http://blahblahblah.html";
                    u[2] = "http://blahblahblah.html";
                    u[3] = "http://blahblahblah.html";
                    function pickRandom(range) {
                        if (Math.random)
                            return Math.round(Math.random() * (range-1));
                        else {
                            var    now = new Date();
                            return (now.getTime() / 1000) % range;
                        }
                    }
                    function pickRandomURL() {
                        var choice = pickRandom(uc);
                        return u[choice];
                    }
                </SCRIPT>    


And here’s the link that calls it:


onClick="this.href=pickRandomURL()"

I’ve tried the basic GetURL(“javascript:pickRandomURL();”), but I guess the javascript isn’t reaching the flash. I tried a loadVar, but I’m probably not doing it right…Ditto for PassFlash().

Can anyone help me with this please?

Thanks,

Rick