You probably can using some sort of Singleton Manager.
http://code.ericfeminella.com/classes/as3/SingletonManager.as.html

But you can't change a sealed class's constructor such as UIComponent
therefore you will not be able to manage the amount of instances
created without the use of the manager class.

But using a singleton for the veiw does not really sound like a good
solution for the problem you are trying to solve.

Better off looking at some other type of pattern.




--- In flexcoders@yahoogroups.com, "David Ham" <[EMAIL PROTECTED]> wrote:
>
> I've been having trouble with multiple instances of my views being
> created when I change states. I have two RoomView classes that each
> subclass the same BaseRoomView superclass, and which contain an
> instance of a Room view class. Since I only ever want one of them on
> the screen at a time, I thought I'd try doing them as singletons. 
> 
> I tried it with my Room class. It extends UIComponent, with singleton
> access control implemented the way Cairngorm ModelLocators are done.
> But  When I run the profiler in Flex Builder, there are still multiple
> instances of it. Can views be done as singletons?
> 
> Many thanks,
> 
> OK
> DAH
>


Reply via email to