Previous Tip  |  Next Tip  |  Design Tips   | [Bill's Home]

Reuse is As-It-Is

I've previously explain who you can reuse media component with XML. Obviously XML can be rather difficult to program with, so a good alternative solution is to include AS files which replace the reusable elements in the content. A good example is in the Who Wants to be a Network-aire? movie. For this I have created an AS file with the following:

// million_test01.as

title="Who Wants to be a Network-aire?";

function myquests(q,a,b,c,d,ans)
{
this.q=q;
this.a= a;
this.b= b;
this.c= c;
this.d=d;
this.ans=ans;
}
var question1 = new Array();
var question2 = new Array();
var question3 = new Array();
var question4 = new Array();
var question5 = new Array();
var question6 = new Array();
var question7 = new Array();
var question8 = new Array();
var question9 = new Array();
var question10 = new Array();
var question11 = new Array();
var question12 = new Array();
var question13 = new Array();
var question14 = new Array();


question1[0]=new myquests("What does IP stand for?","Inkwell Protocol","Igloo Protocol","Iggy Protocol", "Internet Protocol","D");
question1[1]=new myquests("How many computers are there on the Internet?","10","1000","10,000","Over 100 million","D");

question1[2]=new myquests("What does WWW stand for?","World Wide Web","Wild West Wonder","Wiggle Waggle Wopple", "Where's Wally Where?", "A");
question1[3]=new myquests("What does bps stand for?","Best Possible Section","Bits Per Second","Beat People Silly","Bring Polly Silly","B");
question1[4]=new myquests("What does RFC stand for?","Rangers Football Club","Request For Comment","Rangers For the Cup","Rangers Are Cool","B");
question1[5]=new myquests("Who invented logarithms?","Jimmy Napier","Jack Napier","John Napier","Oli Napier","C");
question1[6]=new myquests("Which bridge is the Cisco logo based on?","Golden Gate Bridge","Forth Road Bridge","Kincardine Bridge","South Bridge Edin","A");
question1[7]=new myquests("Which of the following is not taught on CNDS?","Needlework","Ethernet","Security","Wireless","A");
question1[8]=new myquests("Which of the following is not a Napier campus?","Edinburgh Castle","Merchiston","Craiglockhart","Craighouse","A");
question1[9]=new myquests("What does TCP stand for?","Termite Castle Pool","Tandori Curry Pasta","Temporary Cat Polish","Transport Control Protocol","D");
question1[10]=new myquests("What are the main functions of the network layer?","Addressing and routing","Addressing and session control","Routing and networking","Network tolopogy and addressing","A");
question1[11]=new myquests("What network address is used by Novell NetWare?","Postal address","E-mail address","Public address","IPX address","D");
question1[12]=new myquests("Which organisation developed the OSI model?","ISO","Marks & Spencer","Edinburgh District Council","SFA","A");
question1[13]=new myquests("Which best defines a WAN?","The number 1 (in Scotland)","Connects a large geographic area","NAW, in reverse","Where Any Network?","B");
question1[14]=new myquests("Which one of the following is not an Edinburger?","Sir Arthur Conan Doyle","Robert Louis Stevenson","Sean Connery","Nelson Mandela","D");
question1[15]=new myquests("Which one of the following is not an Edinburger?","David Hume","Muriel Spark","Sir Walter Scott","Michael Jordan","D");
question1[16]=new myquests("What was the first artifical satellite?","Telstar","Sputnik 1","Explorer-1","Apache-1","B");

; ;

 

and then we can create another AS file for our Flash movie:

// million_test02.as

title="Who Wants a Test for Test 2?";

function myquests(q,a,b,c,d,ans)
{
this.q=q;
this.a= a;
this.b= b;
this.c= c;
this.d=d;
this.ans=ans;
}
var question1 = new Array();
var question2 = new Array();
var question3 = new Array();
var question4 = new Array();
var question5 = new Array();
var question6 = new Array();
var question7 = new Array();
var question8 = new Array();
var question9 = new Array();
var question10 = new Array();
var question11 = new Array();
var question12 = new Array();
var question13 = new Array();
var question14 = new Array();

question1[0]=new myquests("Which OSI layer does the IP layer correspond to?, ","Data link, ","Network","Transport, ","Session, ","B");
question1[1]=new myquests("Which is the function of the session layer?","Formats into a data frame","Creates data segments","Establishes, manages and terminates communication","Routes data packets","C");
question1[2]=new myquests("Which TCP port does FTP use?","21","23","25","80","A");
question1[3]=new myquests("Which TCP port does TELNET use?","21","23","25","80","B");
question1[4]=new myquests("Which TCP port does SMTP use?","21","23","25","80","C");
question1[5]=new myquests("Which TCP port does HTTP use?","21","23","25","80","D");
question1[6]=new myquests("Which TCP port does DNS use?","21","23","53","110","C");
question1[7]=new myquests("Which TCP port does POP-3 use?","21","23","110","120","C");
question1[8]=new myquests("Which TCP port does echo use?","7","13","110","161","A");
question1[9]=new myquests("Which TCP port does DAYTIME use?","7","13","110","161","B");
question1[10]=new myquests("Which TCP port does SNMP use?","7","13","110","161","D");
question1[11]=new myquests("Which OSI layer does the IPX layer correspond to?","Data link, ","Network","Transport, ","Session","B");
question1[12]=new myquests("Which OSI layer does the TCP layer correspond to?","Data link","Network","Transport, ","Session","C");
question1[13]=new myquests("Which OSI layer does the SPX layer correspond to?","Data link","Network","Transport","Session","C");

; ;

 

[Expand] The movies then become:

[Expand] and for the second one:

Thus we can develop strong generic components, which can be used for many different types of application.