Sorry Satish ... got the name wrong :)
Utkarsh.

On Wed, Jun 22, 2011 at 12:06 PM, Utkarsh Chachad <[email protected]>wrote:

> Hi Santosh,
>
> Ur singleton is completely messed up.
> Firstly the constructor is public with no parameters which means I can
> create an object of XYZ directly. Secondly in the getInstance method u are
> returning an object of GybModel and not XYZ which is not what u want.
>
> Honest mistake i hope ...
>
> Here is the proper code
>
> package
> {
>        public class XYZ
>        {
>                private static var _instance : XYZ      ;
>                public function XYZ (gybm:GybModel)
>
>                {
>                }
>
>                public static function getInstance(): XYZ
>     {
>                        if(_instance == null)
>                        {
>                                _instance = new XYZ( new GybModel() ) ;
>                        }
>                        return _instance;
>        }
> }
>
> class GybModel
> {
>            public function GybModel()
>            {}
> }
>
> Utkarsh.
>
>
>
> On Tue, Jun 21, 2011 at 6:11 PM, Satish Pawar <[email protected]>wrote:
>
>> Just create class with static var and one static function to check for
>> the class instance
>> Example:
>>
>> public class XYZ        {
>>                private static var _instance : XYZ      ;
>>                public function XYZ     ()
>>                {
>>                }
>>
>>                public static function getInstance(): XYZ
>>     {
>>                        if(_instance == null)
>>                        {
>>                                _instance = new GybModel();
>>                        }
>>                        return _instance
>>                 }
>>        }
>>
>> On 21/06/2011, Akshar Kaul <[email protected]> wrote:
>> > do you mean you want to implement singleton pattern ?
>> >
>> > ---> Akshar Kaul <---
>> >
>> >
>> >
>> > On Tue, Jun 21, 2011 at 17:45, Flex based developments <
>> > [email protected]> wrote:
>> >
>> >> Hello,
>> >>
>> >> I want to create single instance of MXML,please do let me know if it
>> >> is possible.
>> >>
>> >> Thanks.
>> >>
>> >> Sincerely,
>> >>
>> >> Abhilash
>> >>
>> >> --
>> >> 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.
>> >>
>> >>
>> >
>> > --
>> > 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.
>> >
>> >
>>
>>
>> --
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------
>> *Thanks&Regards*
>> *
>> Satish Pawar
>> IBM-Flex Developer*
>>
>> --
>> 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.
>>
>>
>

-- 
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.

Reply via email to