Using getTime() isn't ideal since that's creating a timestamp based on
milliseconds, which would be unique. The first option is probably the safer
bet to be able to index things by a specific date (as opposed to a time). If
you're using AS3, then I'd say use a Dictionary object (same as a hash,
except you're not using a generic Object).


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
Sent: Sunday, July 29, 2007 12:42 AM
To: [email protected]
Subject: Re: [Flashcoders] Q:optimizing a Calendar app

That is a very expensive way to do it.

You should, instead, make a hash and the keys would be the date, and the 
values would be an array of appointments for that date.

events = {};
events[month + "/" + day + "/" + year] = [];
events[month + "/" + day + "/" + year].push(appointment);

Then each day of the calendar would just do a look up of itself in the hash.

events[calendarDate];

You could also store the key as a new Date().getTime() instead of a 
string with month/day/year.  It's entirely up to you.

HTH!

Steven Sacks
Flash Maestro
Los Angeles, CA
--
blog: http://www.stevensacks.net
_______________________________________________
[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

Reply via email to