[FONT=Arial][SIZE=2]Hey guys,[/SIZE][/FONT]
[FONT=Arial][SIZE=2]I’m very new to Actionscript 3.[/SIZE][/FONT]
[FONT=Arial][SIZE=2]I’m trying to make a Flash program that randomly plays small interactive SWF files.[/SIZE][/FONT]
[FONT=Arial][SIZE=2]It is intended to help me learn Japanese. Each small SWF in the program will have 3 screens which you click through for the pronunciation and the meaning of a word.[/SIZE][/FONT]
[FONT=Arial][SIZE=2]I need Actionscript to randomize these little SWF files so that you never know what word you’ll have to interact with next. Eventually there will be hundreds of them.[/SIZE][/FONT]
[FONT=Arial][SIZE=2]I’m fine to make an array, and add to it as I make more and more SWF interactives, but the script I’m using is just not up to this kind of functionality (please see below).[/SIZE][/FONT]
[FONT=Arial][SIZE=2]I need something other than a parent script that loads children SWF files, because the parent script ignores the stop functions in the children SWF files.[/SIZE][/FONT]
[FONT=Arial][SIZE=2]Is there a way for the parent script to randomly open an SWF file, and then unload itself (!). I could always add a script to the end of each small SWF file to send it back to the parent script which would then randomly play another SWF file.[/SIZE][/FONT]
[FONT=Arial][SIZE=2]Any help would be very much appreciated! Thanks in advance![/SIZE][/FONT]
[FONT=Arial][SIZE=2]Here’s the script that isn’t doing the job properly for me:[/SIZE][/FONT]
[FONT=Arial][SIZE=2]var movieArray:Array = [‘word001’,‘word002’,‘word003’];[/SIZE][/FONT]
[FONT=Arial][SIZE=2]var loader:Loader = new Loader(); [/SIZE][/FONT]
[FONT=Arial][SIZE=2]var index:int = movieArray.length * Math.random();[/SIZE][/FONT]
[FONT=Arial][SIZE=2]var url:String = movieArray[index] + ‘.swf’; [/SIZE][/FONT]
[FONT=Arial][SIZE=2]trace(“Attempting to load”, url); loader.load(new URLRequest(url)); [/SIZE][/FONT]
[FONT=Arial][SIZE=2]loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);[/SIZE][/FONT]
[FONT=Arial][SIZE=2]loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOError);[/SIZE][/FONT]
[FONT=Arial][SIZE=2]addChild(loader);[/SIZE][/FONT]
[FONT=Arial][SIZE=2]function loaderComplete(e:Event):void { [/SIZE][/FONT]
[FONT=Arial][SIZE=2]trace(“Successfully loaded”, url);[/SIZE][/FONT]
[FONT=Arial][SIZE=2]}[/SIZE][/FONT]
[FONT=Arial][SIZE=2]function loaderIOError(e:IOErrorEvent):void { [/SIZE][/FONT]
[FONT=Arial][SIZE=2]trace(“Failed to load”, url);[/SIZE][/FONT]
[FONT=Arial][SIZE=2]}[/SIZE][/FONT]
[FONT=Arial][SIZE=2]Attached is an example of the kind of SWF’s I want to randomize and have fully loaded so that they wait for you to interact with them, instead of play straight through because of a parent script.[/SIZE][/FONT]