Using mx:states to create a Login system

Hi,
I'm very new to FLEX development and i would need some help.
I'm creating a Login page which would lead to the home page.
I found some examples, it is recommended to use
<mx:states>.
So when the user logs in succefully, we just need to switch
the state in Actionscript.
currentState = "Logged In";
So i have designed states (1 - Login; 2 - Logged in)
And the designer generates this code.
<mx:states>
<mx:State name="Logged In">
<mx:SetProperty target="{panel1}" name="width"
value="95%"/>
<mx:SetProperty target="{panel1}" name="height"
value="95%"/>
<mx:SetProperty target="{canvas1}" name="width"
value="95%"/>
<mx:SetProperty target="{canvas1}" name="height"
value="95%"/>
<mx:SetProperty target="{panel1}" name="title"
value="Welcome Members!"/>
<mx:RemoveChild target="{label1}"/>
<mx:RemoveChild target="{txtUserID}"/>
<mx:RemoveChild target="{label2}"/>
<mx:RemoveChild target="{txtPassword}"/>
<mx:RemoveChild target="{btnLogin}"/>
<mx:AddChild relativeTo="{panel1}"
position="lastChild">
<mx:Label x="61" y="42" text="This is for members only!"
width="168" height="53"/>
</mx:AddChild>
<mx:AddChild relativeTo="{panel1}"
position="lastChild">
<mx:LinkButton x="0" y="0" click="currentState = 'Login'"
label="Logout" labelPlacement="right" includeInLayout="true"/>
</mx:AddChild>
</mx:State>
<mx:State name="Login">
<mx:AddChild relativeTo="{panel1}"
position="lastChild">
<mx:ControlBar id="controlbar1">
</mx:ControlBar>
</mx:AddChild>
<mx:SetProperty target="{btnLogin}" name="x"/>
<mx:SetProperty target="{btnLogin}" name="y"/>
<mx:RemoveChild target="{btnLogin}"/>
<mx:AddChild relativeTo="{controlbar1}"
position="lastChild" target="{btnLogin}"/>
<mx:SetProperty target="{btnLogin}" name="labelPlacement"
value="right"/>
<mx:SetProperty target="{txtPassword}"
name="displayAsPassword" value="true"/>
</mx:State>
</mx:states>
This is fine, this works, but what if my application has lots
of pages, the designer would generate so much code to maintain
different states. And thatz not recommended.
I want to know if we could separate the Login Page code into
another file, the homepage code into another file.
and thus organize the files instead of having one big file
with so many <mx:states>
Any help/links would be appreciated.

Components and Modules are two topics that should start from
in the FB help.
Briefly, yes you can and should put these two into separate
files. Call components.
If you want to keep load time of your app short, you might as
well turn the view after successful login into a Module. A module
unlike a component can be loaded/unloaded on demand.

Similar Messages

  • How to create a login system

    I need to create a login system for an application.  The application will be a Flex front-end connecting to a Postgres database through ColdFusion.  I can connect to my database but cannot find a good way to check user credentials and save data in a session.  Can someone provide some sample code or suggestions (I have already reviewd Bruce Phillips blog on the subject).  I assume this is a standard activity in Flex but cannot find a lot of guidance.  Any help would be appreciated.  Details follow:
    The use case is quite simple:
    Assumptions:
    -the user has an account and supplies correct information
    -Flex can connect to the Postgres databse through ColdFusion datasource.
    Actions:
    User supplies username, password and role and clicks submit button.  System validates that the username/password/role combination matches and displays a viewstack based on the role provided.
    Thanks!

    After some more seraching and playing around, I found a pretty useful example out there on the Flex Cookbook beta site.
    The post by stinasius is located at http://www.adobe.com/cfusion/communityengine/index.cfm?event=showDetails&postId=12346&prod uctId=2&loc=en_US

  • Can I create a login system in Form Central?

    Dear,
    I am looking for an online program where you can create a professional online forms but protected with a login system. Can this with Adobe Form Central or collaboration with another program? I have been working already with dreamweaver.
    With friendly greetings

    Hi,
    You may create a web site and embed your forms into web pages and then use Dreamweaver to create a log in page.
    Thanks,
    Wenlan

  • Using insert statements for creating objects..pls help

    Hello all,
    I have 2 databases DB1 (which is running on 8i) and DB2( Running on 10G).
    How can I copy all the objects of a particular schema (user1) from DB1 to DB2, only by using INSERT statements. I do not want to use import/export since it is taking huge time for the operation.
    Could anybody help me on this?
    Regards,
    chotu

    Since I have allready imported indexes,procedures etc , now I need only to copy tables from DB1 to DB2.
    I have truncated all the tables of user1 in DB2
    Now I am using,
    insert into my_tab as select * from user1.my_tab@DB2_db_link;
    Thanks for the help...
    chotu.

  • Crating login System useing DC

    I want to make a application for domain users. can any buddy tell me how can create a login system which checkes the user/password from domain controler so all the users who has domain account can login in this system.

    Hello all,
    Just so you know... you are not alone!
    We are experiencing this exact same issue. Domain in mixed mode with 2003 R2 DC and 2012 R2 DC.
    We have a case with MS.
    It seems the issue occurs on Windows 2008 R2 only (in fact it happened to a Windows 8.1 also)
    It occurs after computer account reset password and the only way to fix is a reboot.
    We are working with MS at the time and they tell us they have other case in progress with same issue. But that it is really difficult to reproduce. In fact, in our environnement, we are not able to reproduce. It happens here and there without warning.
    So if any of you have a step-by-step recipe we can follow to reproduce each and every time.... please share! It could help a lot MS engineers.
    I'll try to keep you posted.
    David

  • SQL injection on login system by Adobe?

    Hello everybody!
    I recently bought a wonderful book "Adobe Dreamweaver CS5 with PHP - Training from the source" by Daivid Powers.
    In the book is described how you can create a login system.
    What I would like to ask is: Have the dreamweaver server behaviors any kind of protection against SQL injection?
    Unfortunately I do not know PHP in order to recognize the code generated by server behaviors and be able to answer this question by myself..
    I just want to know how safe is to publish a website based on the dreamweaver server behaviors..
    Thank you in advance!

    Any form values and inbound URL parameters will be sanitized (via the function GetSQLValueString) based on several criteria:
    a) generally applied sanitizing functions: stripslashes, mysql_real_escape_string
    b) in case of a numeric value (integer, double) the function GetSQLValueString will additionally apply the PHP function intval respectively doubleval

  • How to create a file-system repository

    I am tring to find the path 
    Content Management>Repository Managers>File System Repository.
    I cannot find this under Content Management.
    I am trying to create an external repository on a UNIX filesystem
    Thanks
    JB

    hi Jeremy,
    If you are using EP 6, for creating the file system repository go to the following path.
    System Administration->System Configuration->Knowledge Management->Configuration->Content Management -> Repository Manager -> File System Repository.
    Regards,
    Moiz Khan

  • I m using ms access as database and i want to create a login page in java

    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Login extends JFrame
    //Component Declarations
    JLabel jlb1,jlb2;
         JTextField jtf1;
         JPasswordField jpf1;
         JButton jb1,jb2;
         //Constructor
         Login()
         //frame settings
              setTitle("Login Dialog");
              setLayout(new GridBagLayout());
              GridBagConstraints gbc = new GridBagConstraints();
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
              setBounds(d.width/2-175,d.height/2-100,350,200);
              gbc.insets=new Insets(7,7,7,7);
         //adding components
              jlb1=new JLabel("User ID");
              gbc.gridx=0;
              gbc.gridy=0;
              add(jlb1,gbc);
              jlb2=new JLabel("Password");
              gbc.gridx=0;
              gbc.gridy=1;
              add(jlb2,gbc);
              jtf1=new JTextField(10);
              gbc.gridx=1;
              gbc.gridy=0;
              add(jtf1,gbc);
              jpf1=new JPasswordField(10);
              gbc.gridx=1;
              gbc.gridy=1;
              add(jpf1,gbc);
              jb1=new JButton("Login");
              gbc.gridx=0;
              gbc.gridy=2;
              add(jb1,gbc);
              jb1.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                   Connection conn=null;
                        Statement stmt=null;
                        boolean found=false;
                   try
                             Class.forName("sun.jdbc.driver.JdbcOdbcDriver");
                             String dataSourceName = "Inventory";
                             String dbURL = "jdbc:odbc:" + dataSourceName;
                             conn=DriverManager.getConnection(dbURL, "","");
                             stmt=conn.createStatement();
                             ResultSet rst=stmt.executeQuery("Select * from User");
                             System.out.println(jtf1.getText()+"/t"+jpf1.getPassword());
                             while(rst.next())
                                  System.out.println( rst.getString(1) +"/t"+ rst.getString(2));
              if(jtf1.getText().equals(rst.getString(1).trim()) && new String(jpf1.getPassword()).equals(rst.getString(2).trim()))
                                       found=true;
                                       rst.close();
                                       dispose();
                                       MainWindow mw= new MainWindow();     /*created min window object created to be opend after login but not working*/     
                                       break;
                             rst.close();
                             stmt.close();
                             conn.close();                    
                        catch(ClassNotFoundException e){System.out.print(e);}
                        catch(Exception e){System.out.print(e);}
                        if(found==false) /*this portion is executing and dialog box appears invalid name and pw with class not found exception sun:jdbc.......on console */
                             JOptionPane.showMessageDialog(null,"Invalid username or password",
                                  "Error Message",JOptionPane.ERROR_MESSAGE);
              jb2=new JButton("Clear");
              gbc.gridx=1;
              gbc.gridy=2;
              add(jb2,gbc);
              jb2.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        jtf1.setText("");
                        jpf1.setText("");
                        jtf1.requestFocus();
              setSize(350,200);
              setVisible(true);
              jtf1.requestFocus();
         public static void main(String args[])
    Login l=new Login();
    }

    http://forums.oracle.com/forums/ann.jspa?annID=599
    Oh, and by the way, your keyboard seems to be broken as your words are not getting spelled correctly.

  • Plz help using ms access as database,i want to create a login page in java

    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Login extends JFrame
    //Component Declarations
    JLabel jlb1,jlb2;
         JTextField jtf1;
         JPasswordField jpf1;
         JButton jb1,jb2;
         //Constructor
         Login()
         //frame settings
              setTitle("Login Dialog");
              setLayout(new GridBagLayout());
              GridBagConstraints gbc = new GridBagConstraints();
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
              setBounds(d.width/2-175,d.height/2-100,350,200);
              gbc.insets=new Insets(7,7,7,7);
         //adding components
              jlb1=new JLabel("User ID");
              gbc.gridx=0;
              gbc.gridy=0;
              add(jlb1,gbc);
              jlb2=new JLabel("Password");
              gbc.gridx=0;
              gbc.gridy=1;
              add(jlb2,gbc);
              jtf1=new JTextField(10);
              gbc.gridx=1;
              gbc.gridy=0;
              add(jtf1,gbc);
              jpf1=new JPasswordField(10);
              gbc.gridx=1;
              gbc.gridy=1;
              add(jpf1,gbc);
              jb1=new JButton("Login");
              gbc.gridx=0;
              gbc.gridy=2;
              add(jb1,gbc);
              jb1.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                   Connection conn=null;
                        Statement stmt=null;
                        boolean found=false;
                   try
                             Class.forName("sun.jdbc.driver.JdbcOdbcDriver");
                             String dataSourceName = "Inventory";
                             String dbURL = "jdbc:odbc:" + dataSourceName;
                             conn=DriverManager.getConnection(dbURL, "","");
                             stmt=conn.createStatement();
                             ResultSet rst=stmt.executeQuery("Select * from User");
                             System.out.println(jtf1.getText()+"/t"+jpf1.getPassword());
                             while(rst.next())
                                  System.out.println( rst.getString(1) +"/t"+ rst.getString(2));
              if(jtf1.getText().equals(rst.getString(1).trim()) && new String(jpf1.getPassword()).equals(rst.getString(2).trim()))
                                       found=true;
                                       rst.close();
                                       dispose();
                                       MainWindow mw= new MainWindow();     /*created min window object created to be opend after login but not working*/     
                                       break;
                             rst.close();
                             stmt.close();
                             conn.close();                    
                        catch(ClassNotFoundException e){System.out.print(e);}
                        catch(Exception e){System.out.print(e);}
                        if(found==false) /*this portion is executing and dialog box appears invalid name and pw with class not found exception sun:jdbc.......on console */
                             JOptionPane.showMessageDialog(null,"Invalid username or password",
                                  "Error Message",JOptionPane.ERROR_MESSAGE);
              jb2=new JButton("Clear");
              gbc.gridx=1;
              gbc.gridy=2;
              add(jb2,gbc);
              jb2.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        jtf1.setText("");
                        jpf1.setText("");
                        jtf1.requestFocus();
              setSize(350,200);
              setVisible(true);
              jtf1.requestFocus();
         public static void main(String args[])
    Login l=new Login();
    Edited by: 795772 on Sep 19, 2010 4:44 AM

    795772 wrote:
    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    <snip>The subject of this forum is Oracle databases. How does your problem relate to that subject?
    Two bits of advice:
    1) Make sure you ask questions in a forum related to your problem.
    2) If you want to be taken seriously as a professional, drop the MS IM Speak and use the language of the forum. In this forum it is English, which is successfully used by many people for whom English is far from their native language.

  • How do you create a login page using dashcode for the iPhone's mobile safari that will transfer you to the next page?

         Hey I have created a login page in Dashcode for a mobile safari app (aka iphone web app) and I am having trouble since I can not find any useful info about multiple pages. I don't want to use a stack layout view because it is only a login page and I need to check with a database to make sure the user's login info is correct. Right now I have it set up so that it loads another iphone web app project once it validates the info.
         The only problem with this is I am having a good bit of trouble trying to pass values from my php code to javascript or html. For some reason calling the javascript inside the php code makes the actual code inside the app not be called and same with the echo statment for the html.
    So I would like to be able to create the app in this way:
    Login page > PHP > MS SQL > PHP > UNKNOWN (if I can't get the javascript or html to output both) > Secure info on the next page
         I believe It would be a lot easier if I had the option for a multiple page but instead I am having to load up an entirely new dashcode project. If anyone knows a better way please let me know. Or if anyone knows a link to good information on passing values from php to javascript, because I couldn't get any of the code I tried to work, I would really appreciate it.

    Addendum to previous reply:
    OK.  This is weird--but I should be used to that, and just grateful that it seems to work (for now).
    What I had done is FTPd some image files to my site using Filezilla, but when I had tried to access them, I was unsuccessful.  I am almost sure that I used the same url (and variations of it) as you suggested, namely,  http://mysite.verizon.net/username/filename , and it either did not work, or gave me the "Page under construction", or, in some cases asked me for my username and password.
    But, when I did it this time, it worked.  So I probably had something off, but I can now do what I want.
    By the way, if you'll permit another question, while on the site-builder site, it said that there was a "Web Photo Manager", and said that "To download the Web Photo Manager: Open the Site Builder application and go to the All My Sites page. Click on the Web Photo Manager link (listed under Advanced Building Tools )."  I can't find it--would you happen to know where it is?
    In any case, thanks a lot for all your help--it solved my problem. 

  • Create spool for background jobs which uses submit statement

    Hi Gurus,
                 I have a quick question regarding the backgroud jobs. When we run a program in the background , it should create a spool for us, but, the problem comes when I am running a program in the background, its not creating the spool. This program uses SUBMIT statement. This program collects the data and it will submit to the other program and then retuen. In this case, its not creating a spool. Its very important for us to look at the spool for this program. Does anybody cam across this kind of problem? I need ur inputs.
    Thanks in advance, <REMOVED BY MODERATOR>
    Regards,
    Srinivas.
    Edited by: Alvaro Tejada Galindo on Mar 18, 2008 4:31 PM

    hi check this link ...
    Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately.
    DATA: number TYPE tbtcjob-jobcount,
          name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
          print_parameters TYPE pri_params.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = name
      IMPORTING
        jobcount         = number
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    IF sy-subrc = 0.
      SUBMIT submitable TO SAP-SPOOL
                        SPOOL PARAMETERS print_parameters
                        WITHOUT SPOOL DYNPRO
                        VIA JOB name NUMBER number
                        AND RETURN.
      IF sy-subrc = 0.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = number
            jobname              = name
            strtimmed            = 'X'
          EXCEPTIONS
            cant_start_immediate = 1
            invalid_startdate    = 2
            jobname_missing      = 3
            job_close_failed     = 4
            job_nosteps          = 5
            job_notex            = 6
            lock_failed          = 7
            OTHERS               = 8.
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    ENDIF.
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=backgroundsubmit&adv=false&sortby=cm_rnd_rankvalue
    sy-subrc  Meaning
    0            Background task scheduled successfully.
    4            Scheduling cancelled by user on the selection screen.
    8            Error during scheduling, i.e. when accessing JOB_SUBMIT internally.
    12          Error in internal number assignment.
    regards,
    venkat.
    Edited by: venkat  appikonda on Mar 18, 2008 6:32 PM

  • Cannot create class in system package while Using Sprite class

    Hi i developed a game using Sprite class & imported
    javax.microedition.lcdui.game.*; package. But when i tried to build this project it gave me "Cannot create class in system package" error. Worst thing is that now again if i build, then it displays error "package javax.microedition.lcdui.game.*; does not exist" . Pls help me

    First exception means that you tried to create a class with the package name equaling one from the predefined libraries in midp/cldc.
    For your second error, add all the jars you are using into the project's classpath.
    Mihai

  • Creating Query using Financial Statement version (Hierarchy)

    Hi All,
    I've created a Query using Finacial Statement version (0GLACCEXT) against the 0FIGL_VC2 Remote cube.I'm not familiar with Hierarchies. Now I want to run the query based on the 0GLACCEXT .It has revenue nodes .Under the revenue nodes there are some g/l accounts.I want to restrict the revenue node and some of the g/l accounts from that  node. When I restrict the InfoObject based on the Revenue node,I'm getting the correct result.But when I combine the revenue node with some g/l accounts ,It's giving the same result i.e. without filtering the g/l accounts.
    But in the workbook ,I can able to filter the query based on the g/l account.
    Now my question is how should I do the restriction in the query designer itself for getting values based on the g/l accounts
    Pls.let me know the solution, &
    I'll assign the points
    Thanks,
    Raji..

    Hello Srinivas,
    The Hierarchy for 0GLACCEXT is getting loaded from tables T011 & RFDT.
    Under this Hierarchy there will be many node.. Under each node there will be GL Accounts..
    If i am correct you want to restrict the query based on GL accounts in the query designer itself.
    the Infoprovider 0FIGL_VC2 contains 0GL_ACCOUNT, you can use that. Use 0GL_ACCOUNT in the Free Characteristics and attach variable to it.
    I hope this information will helps you..
    Thanks & Regards,
    NK.A
    Dont forget to assign points

  • I wanted to use verizon hotspot wifi with my ipad, but verizon states not compatible with operating system. States that needs windows 7 , Vista, or windows xp. Any ways around this? Any ideas?

    I wanted to use verizon hotspot wifi with my ipad (it searaches for hotspots when ur on the go) but verizon states not compatible with operating system. States that it needs windows 7, Vista, or windows XP. Any ways around this? Any ideas?

    Thank you everyone for reaching out and apologize for being unclear. Let me rephrase. There is NO MiFi.
    I have an ipad3 and a PC
    I am trying to connect the iPad3 to the PC for HotSpotting reason (the ability to use the internet on the PC)
    Turning on HOT SPOT on the Apple ipad works GREAT when using it through WI-Fi and through Blue Tooth. But connecting it directly through the included iPad 3 USB Cable to the USB side of the PC does NOT work. I tried several PCs, and several Cables. Any other ideas

  • How to make a login system using xCode?

    Hello guys!
    I'm trying to make a login system;
    Is it possible to make it like this:
    Put a text box for the username and password and a label called "Sign in"
    How can I make so that the username and password box get's my input box on my PHP website and that "Sign In" will be the Submit?
    I don't want to use the HTTP way...
    Thank you !

    Thanks for your answer !
    Before I made this topic I tried to find a tutorial here and I didn't find any...
    Can you please redirect me to one of them?
    Thank you

Maybe you are looking for