One of the first things I ran into was the lack on an onEnterFrame. It seems that event listeners are the way to go.
Here's what I did today. There is no analysis yet, but it tracks the x and y locations of the mouse for a period of thirty seconds (when running at 30 frames/second).
I just wanted to check that I am using the best approximation of an onEnterFrame function.
----------
var xLocations:Array=new Array();
var yLocations:Array=new Array();
var testFreq=3;
var counter=0;
//300 at 10 sample per second is 30 seconds
for (var i=0; i<300; i++) {
xLocations.push(0);
yLocations.push(0);
}
addEventListener(Event.ENTER_FRAME,TrackMouse);
function TrackMouse(event:Event) {
counter++;
if (counter>=testFreq) {
counter=0;
xLocations.push(mouseX);
xLocations.splice(0,1);
yLocations.push(mouseY);
yLocations.splice(0,1);
}
}
-------------
-Andy
Subscribe to:
Post Comments (Atom)
Yep. You're right that the AS3 structure uses a lot of event listeners. The event listener class provides a lot of control over examining starting and stopping events. It is much easier to use than the correspondent JAVA threads.
ReplyDeleteI've got to get us a shared repository for you to be able to upload files. Will work on it this week.