You can define an internal class in the file that you can pass to the
constructor. Since the "SingletonEnforcer" class is only accessible from
this file, so you cannot call the constructor from any other
file.......effectively making this class a singleton class. Sample code is
given below.
====================================================
package abc
{
public class SingletonClass
{
private static var _instance:SingletonClass
public function SingletonClass(enforcer:SingletonEnforcer)
{
}
public static function getInstance():SystemProcess
{
if (SingletonClass._instance == null)
{
SingletonClass._instance = new SingletonClass(new
SingletonEnforcer());
}
return SingletonClass._instance;
}
}
class SingletonEnforcer { };
============================================================
On Thu, Jul 15, 2010 at 11:15 PM, Sidhu Vijay Sidhu <[email protected]>wrote:
> How will u make singleton in Action Script as there is no private
> constructor. If some on can send a code with small example that will be
> fine. thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<flex_india%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.