Apparently, there has been much discussion concerning singletons
here already, but the search feature of this site doesn't seem to
ever return complete results. Coming from a .NET background, I've
had to change a lot my thinking in regards to objects. This is a
good thing. However, in .NET (VB.NET, C#.NET Java.NET) when an
object is instantiated, let's say a class in this case, as soon as
the object goes out of scope, it is automatically disposed of by the
garbageCollector. This doesn't seem to be the case in AS3. I've
patterned an application on the Cairngorm samples that have been
provided so far. The samples are great and I really appreciate
them, but none of them make multiple calls to the back-end. Using
the code provided, if I execute multiple search commands (let's say
getAuthors), each one of the command instances, along with the
associated event listeners and objects, still exist after the result
or fault is returned. Thus, when an error is displayed
like: "Sorry, no authors found.", since all of the
commands/delegates are still listening to the data service, a
separate alert box appears for each instance of the command. Three
calls, three alert boxes.
I'm not sure if I should make the commands and delegates singletons,
or manually dispose (delete _oSingleton) of the instances. Since
the application is Cairngorm based, I don't want to stray too far
from best practices. I was just wondering if anyone else had
experienced this problem and if there were some links or advice that
could be offered? I also want to say that I think that the Adobe
team is doing a great job. I can't wait for the release of Flex2.
It's going to turn a lot of heads.
Many thanks,
Tim Hoff
P.S. It would be nice to have something like the following:
public singleton class myClass {}
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/