Hi All,
I’m trying to accomplish getting actionscript to load an independant .swf file into a MC at random every 20 secs? I’ve created the .swf files to be loaded into the MC to which I gave it an instance name of “rObject”. I created 3 layers:
“base” - bottom layer
“movie” - middle layer
“actions” - top layer
It’s pretty obvious that I placed the transparent MC in the “movie” layer, actionscript code into frame 1 of the “actions” layer, and the remaining “base” layer is what it states, a base or background.
Now, I don’t know if something is wrong or missing inside the code? Or, maybe i have to place additional code onto the “rObject” MC?
Here is the actionscript i placed in the “actions” layer:
var interval = 20.0;
// delay between rotating images (in seconds)
var random_display = 1;
// 0 = no, 1 = yes
interval *= 1000;
var object_index = 0;
object_list = new Array();
object_list[object_index++] = new objectItem("/services/pics/r_pic01.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic02.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic03.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic04.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic05.swf");
object_list[object_index++] = new ObjectItem("/services/pics/r_pic06.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic07.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic08.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic09.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic10.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic11.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic12.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic13.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic14.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic15.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic16.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic17.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic18.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic19.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic20.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic21.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic22.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic23.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic24.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic25.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic26.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic27.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic28.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic29.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic30.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic31.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic32.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic33.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic34.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic35.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic36.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic37.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic38.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic39.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic40.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic41.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic42.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic43.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic44.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic45.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic46.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic47.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic48.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic49.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic50.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic51.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic52.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic53.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic54.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic55.swf");
object_list[object_index++] = new objectItem("/services/pics/r_pic56.swf");
var number_of_object = object_list.length;
function objectItem(object_location) {
this.object_item = new Object();
this.object_item.rObject = object_location;
}
function get_ObjectItemLocation(objectObj) {
return (objectObj.object_item.rObject);
}
function generate(x, y) {
var range = y-x+1;
return Math.floor(Math.random()*range)+x;
}
function getNextObject() {
if (random_display) {
object_index = generate(0, number_of_object-1);
} else {
object_index = (object_index+1)%number_of_object;
}
var new_object = get_ObjectItemLocation(object_list[object_index]);
return (new_object);
}
function rotateObject(place) {
var new_object = getNextObject();
document[place].rObject = new_object;
var recur_call = "rotateObject('"+place+"')";
setTimeout(recur_call, interval);
}
If anyone knows my mistake, and can help, it’d greatly be appreciated!
Thanks,
Aaron