Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

random getUrl?

Status
Not open for further replies.

fowlerlfc

MIS
Mar 20, 2002
136
US
hello all!

please forgive me, because this is probably a basic question:

i'm trying to create a button that will go to a random (by random i mean randomly selected from my array of urls) url. here's what i've tried:

on frame 1 of main timeline i've created an array. here it is:

urls(" "
on my button, i've placed the following action:

on (release) {
getURL (random(urls()));
}

when i try the button it goes to the following web address:

first of all, is what i'm trying possible? if so, where have i gone wrong?
 
I just tested this and it works...

Code:
urls = new Array("[URL unfurl="true"]http://www.google.com",[/URL] "[URL unfurl="true"]http://www.achq.org",[/URL] "[URL unfurl="true"]http://www.wangbar.co.uk");[/URL]
num = Math.ceil(Math.random()*3);
targetUrl = urls[num];
getURL(targetURL,"_blank");
stop();
Slainte

 
Try this in root :

Code:
var urls = new array ("[URL unfurl="true"]www.soccer.com",[/URL]
                            "[URL unfurl="true"]www.soccernet.com",[/URL]
                            "[URL unfurl="true"]www.site.com",[/URL]
                            "[URL unfurl="true"]www.site2.com",[/URL]
                            "www.site3.com");
And on button :

Code:
on (press) {
    getURL (urls[random (urls.length)]);
}
Regards

David Byng

spider.gif


davidbyng@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top