The array class does not have addElement or removeElement methods.
Read the docs for push and splice.
Scott
-----Original Message-----
From: [EMAIL PROTECTED] on behalf of black59mga
Sent: Mon 5/15/2006 6:16 PM
To: Flashcoders mailing list
Cc:
Subject: Re: [Flashcoders] How to serialize key events?
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