Wednesday, April 20, 2011

CRITIC 2(CODING AND PROGRAMMING)

This is the code that i will be using; so far i have tested it and it works with just few errors that i am trying to fix at the moment. After consulting with the lecturer he advised i use the key presss counters to call out the animations(swf files ) that i created using both after effects and flash.


CODE

var k = new Object(this);
var listen = true;
var r;
var counter = 0;
var t;
t = setInterval(resetcounter, 10000);
function resetcounter(){
counter = 0;
emc.unloadMovie(this);
}
k.onKeyDown = function(){
//if(listen == true){
if(Key.isDown(65)){ //code for A is 65
trace("Key A");
counter++;
emc.loadMovie(counter+".swf");
//listen = false;
}
if(Key.isDown(66)){ 
trace("Key B");
counter++;
emc.loadMovie(counter+".swf");
//listen = false;
}
if(Key.isDown(67)){ 
trace("Key C");
counter++;
emc.loadMovie(counter+".swf");
//listen = false;
}
if(Key.isDown(68)){ 
trace("Key D");
counter++;
emc.loadMovie(counter+".swf");
//listen = false;
}
if(Key.isDown(69)){ 
trace("Key E");
counter++;
emc.loadMovie(counter+".swf");
//listen = false;
}
if(Key.isDown(70)){ 
trace("Key F");
counter++;
emc.loadMovie(counter+".swf");
//listen = false;
}
if(Key.isDown(71)){ 
trace("Key G");
counter++;
emc.loadMovie(counter+".swf");
//listen = false;
}
//}
}
Key.addListener(k);

No comments:

Post a Comment