Wednesday, February 18th, 2009 class - dice throws



roll_btn.addEventListener(MouseEvent.CLICK, rollEmClick);
  
function rollEmClick(evt:MouseEvent): void
{
	rollEm();	
}
  
function rollEm():void
{
	var r1:int;
	var r2:int;
	
	r1 = Math.floor(Math.random() * 6 + 1);
	r2 = Math.floor(Math.random() * 6 + 1);
	
	d1.gotoAndStop(r1);
	d2.gotoAndStop(r2);
}

keepRolling_btn.addEventListener(MouseEvent.CLICK, startStopTimer);
   
var tmr:Timer = new Timer(500);
   
function startStopTimer(evt:MouseEvent): void
{
	if (tmr.running)
	{
		tmr.stop();
	}
	else
	{
		tmr.start();
	}
}
  
tmr.addEventListener(TimerEvent.TIMER, rollEmTimer);
  
function rollEmTimer(et:TimerEvent):void
{
	rollEm();
}

Here are the commands and some sample output on sunny.uni.edu.

Note that cd stands for change directory.  cd feb09 moves down into
the directory or folder named feb09, which as created by using the
mkdir command.
                          mkdir feb09
                          cd feb09

  502  cd feb09/
  503  ls
  504  ls -l
  505  pwd
  506  history

bash-2.03$ 

bash-2.03$ ls

AC_RunActiveContent.js  DieFeb18th.html
DieFeb18th.fla          DieFeb18th.swf


bash-2.03$ ls -l

total 808
-rw-r--r--   1 jacobson faculty     8321 Mar  6  2007 AC_RunActiveContent.js
-rw-r--r--   1 jacobson faculty   376832 Feb 18 13:39 DieFeb18th.fla
-rw-r--r--   1 jacobson faculty     2905 Feb 18 15:21 DieFeb18th.html
-rw-r--r--   1 jacobson faculty    16367 Feb 18 13:42 DieFeb18th.swf

bash-2.03$ pwd

/export/home/jacobson/feb09