Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Flex Singleton in Flex
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


bikrantsingh
Singleton in Flex
1 Answer(s)      3 years and 11 months ago
Posted in : Flex


hi.....

please tell me about
How can you implement Singleton in Flex Application?
please give me the procedure so i can implement.......

Thanks


Advertisement
View Answers

October 19, 2010 at 5:32 PM


Ans:

The singleton pattern is a design pattern that is used to restrict instantiation of a class to one object. If you create the class as a singleton then no way to create more than one instance. But, you can get that single instance in any number of classes. So all the classes will share the same properties and behaviours of that singleton object.

For example:

<SettingsDialog xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>

        private static var singleton:SettingDialog;

        public static function getInstance():SettingsDialog
        {
            if ( SettingsDialog.singleton )
            {
                return SettingsDialog.singleton;
            }else{
                SettingsDialog.singleton = new SettingsDialog();
                return SettingsDialog.singleton;
            }            
        }

    </mx:Script>

    <mx:TextInput id="name" width="100">
    <mx:TextInput id="age" width="100">
    <mx:TextInput id="rank" width="100">
    <mx:TextInput id="serial" width="100">
    <mx:ColorPicker id="uiColor" >

<SettingsDialog>


Usage:
//call popupmanager with getInstance
mx.managers.PopUpManager.addPopUp( SettingsDialog.getInstance() , basePanel , true );


Related Tutorials/Questions & Answers:
Singleton in Flex
Singleton in Flex  hi..... please tell me about How can you implement Singleton in Flex Application? please give me the procedure so i can implement....... Thanks
singleton class
singleton class  What is singleton class
Advertisements
Java singleton
Java singleton  What is singleton
singleton program
singleton program  import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; public class Emp{ public
singleton pattern - Java Beginners
singleton pattern  how i use singleton pattern in my web aplication project.plz give an example.its urgent
Singleton & Threadsafe in struts - Struts
Singleton & Threadsafe in struts  Hi, How to implement singleton and threadsafe in struts . same in jsp and servlet. Thanks in advance
What is singleton? - Java Beginners
What is singleton?   Hi, I want to know more about the singleton in Java. Please explain me what is singleton in Java? Give me example of Singleton class. Thanks   hello, Singleton is a concept in which you
Java Singleton Pattern
In this section, you will learn about singleton pattern in Java
singleton - Java Interview Questions
singleton  what is singleton class.give one example of implementation of singleton class?  hi friend, import java.io.*; public class SingletonExam implements Serializable { public static SingletonExam single
Is Singleton Default in Struts - Struts
Is Singleton Default in Struts   Hi Friend, Is Singleton default in Struts ,or should we force any technique Thanks Prakash  Hi friend, Use of singletons is normally
J2EE Singleton Pattern - Design Pattern Tutorials
J2EE Singleton Pattern Singleton Design Pattern This design pattern governs... only one instance of object is required. The Constructor in a Singleton class is private and a public static method is used to get the Object of the Singleton
singleton class in struts - Java Beginners
singleton class in struts  hi, This balakrishna, I want to retrive data from database on first hit to home page in struts frame work
singleton class in struts - Java Beginners
singleton class in struts  hi, This balakrishna, I want to retrive data from database on first hit to home page in struts frame work
singleton class in struts - Java Beginners
singleton class in struts  hi, This balakrishna, I want to retrive data from database on first hit to home page in struts frame work
singleton class in struts - Java Beginners
singleton class in struts  hi, This balakrishna, I want to retrive data from database on first hit to home page in struts frame work
Singleton class
Singleton class       Singleton Design Pattern: The singleton design pattern allows to have one... be achieved in java by making a Singleton  class Benefits:  Singleton
What is an efficient way to implement a singleton pattern in Java?
What is an efficient way to implement a singleton pattern in Java?  What is an efficient way to implement a singleton pattern in Java
What is difference between singleton and prototype bean?
What is difference between singleton and prototype bean?  Hi, What is difference between singleton and prototype bean? Thanks
How singleton in struts - Java Interview Questions
How singleton in struts  Hi, How to implement singleton and threadsafe in struts . same in jsp and servlet. Thanks Prakash
Why we use singleton class in hibernate sessionfactory?
Why we use singleton class in hibernate sessionfactory?  Hello, Please tell me why we use singleton class in hibernate sessionfactory? hibernate sessionfactory singleton example would be very helpful. Thanks
Singleton Pattern
Singleton Pattern       Singleton Pattern:  The singleton design pattern deals with one... the singleton pattern. But take care to set the variable whenever destroying during
Java singleton program - Java Interview Questions
Java singleton program  Hi All, Can you please explain me in brife with an example how the singleton program works, i did see some documents but was not able to unerstand except one object can be used. this was a java
PHP Singleton Method
PHP Singleton Method: Many application resources are exclusive like database... to a database is exclusive. The singleton pattern is exactly the same, it uses for creating single object. To get an instance of the singleton pattern we must have
where singleton class used in java - Java Interview Questions
where singleton class used in java  where singleton classes are used in j2ee web application.can we use it for connection pooling. Thanks Prakash
Flex Looping
Flex Looping  I need example for flex looping mechanisam example
Flex - Framework
Flex  database conectivity in flex
Flex Combobox
Flex Combobox  flex combobox with database as dataprovider   You can visit the following link for detailed tutorial on the topic. May this will be helpful to you. http://www.roseindia.net/flex/flex-combo-box.shtml
Flex event
Flex event  Hi.... Please tell me about How to create your own event in flex? Thanks
Flex and Java
Flex and Java  hi..... Please give similiarities between Java and Flex. Thanks
Flex basic
Flex basic  Hi...... please just tell me about Can we run Flex applications in MAC? Thanks
 

 

 

DMCA.com