Problem getting random SWF files to be fully interactive

  • nova929
  • Born
  • Born
  • nova929
  • Posts: 1

Post 3+ Months Ago

Hey guys,

I'm very new to Actionscript 3.

I'm trying to make a Flash program that randomly plays small interactive SWF files.

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.

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.

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).

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.

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.

Any help would be very much appreciated! Thanks in advance!

Here's the script that isn't doing the job properly for me:


Code: [ Select ]
var movieArray:Array = ['word001','word002','word003'];
var loader:Loader = new Loader();
var index:int = movieArray.length * Math.random();
var url:String = movieArray[index] + '.swf'; 
trace("Attempting to load", url); loader.load(new URLRequest(url)); 
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOError);
addChild(loader);
function loaderComplete(e:Event):void { 
      trace("Successfully loaded", url);

}
function loaderIOError(e:IOErrorEvent):void { 
       trace("Failed to load", url);
}
  1. var movieArray:Array = ['word001','word002','word003'];
  2. var loader:Loader = new Loader();
  3. var index:int = movieArray.length * Math.random();
  4. var url:String = movieArray[index] + '.swf'; 
  5. trace("Attempting to load", url); loader.load(new URLRequest(url)); 
  6. loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
  7. loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOError);
  8. addChild(loader);
  9. function loaderComplete(e:Event):void { 
  10.       trace("Successfully loaded", url);
  11. }
  12. function loaderIOError(e:IOErrorEvent):void { 
  13.        trace("Failed to load", url);
  14. }



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.
Attachments:
word001.zip

(121.43 KiB) Downloaded 229 times

An example of an SWF that I will be using. I need many of these to load randomly and to be fully interactive.

  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.