Skip navigation
Currently Being Moderated

How can I make the Stock Market Panel load AFTER the User Enters correct password?

Apr 21, 2012 7:34 AM

Can someone PLEASE help me. I need the Second part of this code(the Stock Market Panel) to be display after the user enters the correct username and password I have predefine. I really need to complete this project for school, Last Semester and i want to finally graduate!

 

 

<?xml version="1.0"?>

 

 

<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                                 xmlns:mx="library://ns.adobe.com/flex/mx"

                                 xmlns:s="library://ns.adobe.com/flex/spark">

 

          <fx:Script>

                    <![CDATA[

                              import mx.controls.Alert;

                              public var u:String;

                              public var p:String;

                              public function log():void

                              {

                                        u=user.text.toLowerCase();

                                        p=pass.text.toLowerCase();

                                        if((u==''||u!='webmultimedia')||(p==''||p!='abc') )

                                        {

                                                  Alert.show('Wrong userid or Password','Sorry',Alert.OK | Alert.CANCEL);

                                        }

                                        else

                                        {

                                                  Alert.show('Hi','Welcome',mx.controls.Alert. OK);

                                        }

                              }

                              public function clear():void

                              {

                                        user.text='';

                                        pass.text='';

 

                              }

                    ]]>

          </fx:Script>

 

 

          <mx:Panel id="NewForm" title="Please Log In" height="214" width="285" horizontalAlign="center" verticalAlign="middle" horizontalCenter="23" verticalCenter="2">

                    <mx:Label id="User Name" text="User Name"/> 

                    <mx:TextInput id="user" />

                    <mx:Label id="password" text="Password"/>

                    <mx:TextInput id="pass" displayAsPassword="true"/>   

                    <mx:Button id="submit" label="Submit" click="log()"/>

          </mx:Panel>

 

 

          <mx:Panel width="349" height="383" chromeColor="#1B8905" color="#FFFFFF" focusColor="#0F3CFF"

                                fontFamily="Georgia" fontSize="21" fontWeight="bold" paddingBottom="10"

                                paddingLeft="10" paddingRight="10" paddingTop="10" title="Stock Market">

 

                    <!--First Pane Of TabNavigator-->

                    <mx:TabNavigator borderStyle="solid">

                              <mx:VBox y="71" width="371" height="334" label="Dow Jones"

                                                   chromeColor="#0A741C">

                                        <mx:Image id="loader1" source="http://dl.dropbox.com/u/8861424/stock1.png"/>

 

                                        <mx:RichTextEditor id="myRTE" width="355" height="286" borderVisible="true"

                                                                                   color="#000000" text="Enter Stock Comment"/>

 

                              </mx:VBox>

 

                              <!-- Second pane of TabNavigator -->

                              <mx:VBox label="SandP" width="500" height="350">

                                        <mx:Image id="loader2" source="http://dl.dropbox.com/u/8861424/Untitled.png"/>

 

 

                                        <mx:RichTextEditor id="myRTE2" width="355" height="286" borderVisible="true"

                                                                                   color="#000000" text="Enter Stock Comment"/>

 

                              </mx:VBox>

 

                              <!-- Second pane of TabNavigator -->

                              <mx:VBox label="Nasdaq" width="500" height="350">

                                        <mx:Image id="loader3" source="http://dl.dropbox.com/u/8861424/stock2.png"/>

 

                                        <mx:RichTextEditor id="myRTE3" width="355" height="286" borderVisible="true"

                                                                                   color="#000000" text="Enter Stock Comment"/>

                              </mx:VBox>

 

                    </mx:TabNavigator>

          </mx:Panel> 

</mx:Application>


 
Replies
  • Currently Being Moderated
    Apr 23, 2012 8:55 AM   in reply to maycokidd

    it's probably not the correct way to do it but I am more familiar with Flex4 (which use states) but this works

     

    however i had to remove your Alert they were throwing an error

     

    <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                            xmlns:mx="library://ns.adobe.com/flex/mx"
                                            xmlns:s="library://ns.adobe.com/flex/spark">
     
     
              <fx:Script>
                        <![CDATA[
                                  import mx.controls.Alert;
                                  public var u:String;
                                  public var p:String;
      
                                  public function log():void
                                  {
                                            u = user.text.toLowerCase();
                                            p = pass.text.toLowerCase();
                                            if ((u == '' || u != 'webmultimedia') || (p == '' || p != 'abc'))
                                            {
                                                      //Alert.show('Wrong userid or Password', 'Sorry', Alert.OK | Alert.CANCEL);
                                            }
                                            else
                                            {
                                                      //Alert.show('Hi', 'Welcome', mx.controls.Alert.OK);
                                                      stockMarket.visible = true;
                                                      NewForm.visible = false;
                                            }
                                  }
      
                                  public function clear():void
                                  {
                                            user.text = '';
                                            pass.text = '';
      
                                  }
                        ]]>
              </fx:Script>
     
     
     
     
              <mx:Panel id="NewForm"
                                    title="Please Log In"
                                    height="214"
                                    width="285"
                                    horizontalAlign="center"
                                    verticalAlign="middle"
                                    horizontalCenter="23"
                                    verticalCenter="2">
                        <mx:Label id="UserName"
                                              text="User Name" />
                        <mx:TextInput id="user" />
                        <mx:Label id="password"
                                              text="Password" />
                        <mx:TextInput id="pass"
                                                        displayAsPassword="true" />
                        <mx:Button id="submit"
                                               label="Submit"
                                               click="log()" />
              </mx:Panel>
     
     
     
     
              <mx:Panel id="stockMarket"
                                    visible="false"
                                    width="349"
                                    height="383"
                                    chromeColor="#1B8905"
                                    color="#FFFFFF"
                                    focusColor="#0F3CFF"
                                    fontFamily="Georgia"
                                    fontSize="21"
                                    fontWeight="bold"
                                    paddingBottom="10"
                                    paddingLeft="10"
                                    paddingRight="10"
                                    paddingTop="10"
                                    title="Stock Market">
     
     
                        <!--First Pane Of TabNavigator-->
                        <mx:TabNavigator borderStyle="solid">
                                  <mx:VBox y="71"
                                                       width="371"
                                                       height="334"
                                                       label="Dow Jones"
                                                       chromeColor="#0A741C">
                                            <mx:Image id="loader1"
                                                                  source="http://dl.dropbox.com/u/8861424/stock1.png" />
     
     
                                            <mx:RichTextEditor id="myRTE"
                                                                                       width="355"
                                                                                       height="286"
                                                                                       borderVisible="true"
                                                                                       color="#000000"
                                                                                       text="Enter Stock Comment" />
     
     
                                  </mx:VBox>
     
     
                                  <!-- Second pane of TabNavigator -->
                                  <mx:VBox label="SandP"
                                                       width="500"
                                                       height="350">
                                            <mx:Image id="loader2"
                                                                  source="http://dl.dropbox.com/u/8861424/Untitled.png" />
     
     
     
     
                                            <mx:RichTextEditor id="myRTE2"
                                                                                       width="355"
                                                                                       height="286"
                                                                                       borderVisible="true"
                                                                                       color="#000000"
                                                                                       text="Enter Stock Comment" />
     
     
                                  </mx:VBox>
     
     
                                  <!-- Second pane of TabNavigator -->
                                  <mx:VBox label="Nasdaq"
                                                       width="500"
                                                       height="350">
                                            <mx:Image id="loader3"
                                                                  source="http://dl.dropbox.com/u/8861424/stock2.png" />
     
     
                                            <mx:RichTextEditor id="myRTE3"
                                                                                       width="355"
                                                                                       height="286"
                                                                                       borderVisible="true"
                                                                                       color="#000000"
                                                                                       text="Enter Stock Comment" />
                                  </mx:VBox>
     
     
                        </mx:TabNavigator>
              </mx:Panel>
    </mx:Application>
     
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points