What kind of object do you need to save?
The nice thing about this approach is that you can create any object
that you need and put it in the queue.
If you only need a list of buttons pressed, you can have a very simple
object. If you need to include internally generated events, you may need
an object with more properties.
You do not even have store the same type of object each time as long as
you can figure out what object is being returned when you ask for the
next one.
Ron
black59mga wrote:
Ron,
Thanks very much for your response. You asked " What is wrong with this?". Probably nothing.. Just lack of experience on my part. The class is now actionscript. I'm trying to figure out what's the right kind of Object to pass to the insert(obj:Object) method. Thoughts?
Thanks!
The class:
class Mailbox {
private var numMessages:Number = 0;
private var mailbox:Array = new Array();
public function insert(obj:Object):Void {
trace("Mailbox:: Insert")
mailbox.addElement(obj);
numMessages++;
// notify();
}
public function remove() {
while (numMessages == 0) {
try {
//wait();
} catch (e:Error) {
}
}
var obj:Object = mailbox.firstElement();
mailbox.removeElementAt(0);
numMessages--;
return obj;
}
public function numobj():Number {
return numMessages;
}
public function flush():Array {
var array:Array = null;
if (numMessages > 0)
array = new Array();
while (numMessages > 0) {
var obj:Object = mailbox.firstElement();
array.addElement(obj);
mailbox.removeElementAt(0);
numMessages--;
}
return array;
}
}
Ron Wheeler <[EMAIL PROTECTED]> wrote:
The code is pretty simple. Have you tried to code and test it under
ActionScript?
It looks like you add objects to a list and take the first one off the
list. It provides a function to find out if there are any objects in the
queue. What is wrong with this?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com