1 Reply Latest reply on Dec 12, 2007 6:42 PM by peterent

    Issues With States

    Tigomark Level 1
      Hello everyone,

      I have been working on this little project and it is almost complete but I am running into some problems with the way the states are interacting

      I will show you the code.

      [CODE]
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#040404, #040404]"
      initialize="getDaysUntil()">
      <mx:XML id="tempXML" source=" http://misitenet/interface.php?username=admin&amp;password=pass&amp;customer=63&amp;action =showopen&amp;operation=defects&amp;format=xml&amp;critcal=both" />

      <mx:Image source="@Embed('../images/title.jpg')" width="210" height="65" top="4" left="15"/>
      <mx:Image source="@Embed('../images/title1.jpg')" id="image1" horizontalAlign="right" verticalAlign="top" right="0" scaleContent="true" y="0"/>

      <mx:states>
      <mx:State name="Logged In">
      <mx:SetProperty target="{panel1}" name="width" value="98%"/>
      <mx:SetProperty target="{panel1}" name="height" value="75%"/>
      <mx:RemoveChild target="{password}"/>
      <mx:RemoveChild target="{customer}"/>
      <mx:RemoveChild target="{username}"/>
      <mx:RemoveChild target="{customerlbl}"/>
      <mx:RemoveChild target="{label1}"/>
      <mx:RemoveChild target="{Submit}"/>
      <mx:RemoveChild target="{label2}"/>
      <mx:SetProperty target="{panel1}" name="title" value="Current Red Board Information"/>
      <mx:AddChild relativeTo="{panel1}" position="lastChild">


      <mx:TileList dataProvider="{tempXML.defect.asset}"
      width="100%" backgroundColor="#000000" color="#ff0000" fontSize="27" borderColor="#000000" columnWidth="300" rowHeight="50" themeColor="#808080" fontWeight="bold" allowMultipleSelection="true" />
      <mx:XMLListCollection id="defectXMLList" source="{tempXML.defect}" />

      </mx:AddChild>
      <mx:AddChild relativeTo="{panel1}" position="lastChild">
      <mx:HBox horizontalGap="4" width="800">
      <mx:Label id="lblTimeUntilRefresh" text="Current Time:" color="#ff0000" fontSize="19" fontWeight="bold" />
      <mx:Label id="lblTimeUntil" color="#ff0000" fontSize="22" fontWeight="bold" toolTip="Page refreshes every 300 seconds" fontFamily="Arial" width="300"/>
      </mx:HBox>
      </mx:AddChild>
      </mx:State>
      </mx:states>


      <mx:Script>
      <![CDATA[
      import mx.rpc.events.ResultEvent;

      ]]>
      </mx:Script>


      <mx:Script>


      <![CDATA[

      private function checkLogin(evt:ResultEvent):void
      {

      if(evt.result.code == "200") {

      mx.controls.Alert.show('The page is not responding please try again');


      }else{

      currentState = "Logged In";

      }

      }

      ]]>

      </mx:Script>
      <mx:HTTPService id="login_user" result="checkLogin(event)" showBusyCursor="true" method="GET" url="https://mysite.net/interface.php" >
      <mx:request xmlns="">
      <customer>
      {customer.text}
      </customer>
      <username>
      {username.text}
      </username>
      <password>
      {password.text}
      </password>
      </mx:request>
      </mx:HTTPService>

      <mx:Panel resizeEffect="Resize" width="582" height="354" layout="absolute" title="Red Board Login" horizontalCenter="0" verticalCenter="-2" id="panel1" color="#FF0000" backgroundColor="#191919" cornerRadius="15" themeColor="#FFA800" borderColor="#9FA7B7">
      <mx:Label x="10" y="14" text="Customer Number" id="customerlbl" fontSize="20" width="542" textAlign="center"/>
      <mx:TextInput x="10" y="61" id="customer" width="542" borderColor="#F90404" backgroundColor="#D5D1D1" themeColor="#FFA800" color="#050505"/>
      <mx:Label x="10" y="91" text="Username" id="label1" fontSize="20" width="542" textAlign="center"/>
      <mx:TextInput x="10" y="138" id="username" width="542" borderColor="#F90404" backgroundColor="#D5D1D1" themeColor="#FFA800" color="#050505"/>
      <mx:Label x="10" y="175" text="Password" id="label2" fontSize="20" width="542" textAlign="center"/>
      <mx:TextInput x="11" y="217" id="password" displayAsPassword="true" width="542" borderColor="#F90404" backgroundColor="#D5D1D1" themeColor="#FFA800" color="#050505"/>
      <mx:Button x="10" y="282" label="Login" id="Submit" click="login_user.send();" fontSize="14" themeColor="#FFA800" borderColor="#FA0202"/>
      </mx:Panel>

      </mx:Application>



      [/CODE]


      The XML List was showing data but now with the addition of the log in screen in a state and panel view it is not showing up


      Thanks