0 Replies Latest reply on Dec 7, 2007 2:26 PM by Tigomark

    A little debugging nedded

    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

      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:Script>
      <![CDATA[


      private function getDaysUntil():void {
      // creates a new five-minute Timer
      var minuteTimer:Timer = new Timer(1000, 300);

      // designates listeners for the interval and completion events
      minuteTimer.addEventListener(TimerEvent.TIMER, onTick);
      minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);

      // starts the timer ticking
      minuteTimer.start();

      }

      public function onTick(evt:TimerEvent):void {
      var minuteTimer:Timer = evt.target as Timer;
      lblTimeUntil.text = minuteTimer.currentCount.toString();
      }

      public function onTimerComplete(evt:TimerEvent):void
      {
      var minuteTimer:Timer = evt.target as Timer;
      minuteTimer.reset();

      minuteTimer.start();
      }





      ]]>
      </mx:Script>
      </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');

      }

      if(evt.result.code == "108")

      {

      mx.controls.Alert.show('Invalid customer code/username/password');

      }


      if(evt.result.code == "104")

      {

      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]

      Now the problems I am having are the flash player I think hates the script data for the countdown on login

      So is there a way of hiding this until they have logged in?

      Also my counter is supposed to count down and right now it counts up
      (besides this is there a way to format this my minutes and seconds?)

      The XML List that was showing data but now with the addition of the log in it is not showing up

      And once the timer is up it should refresh all of the XML data not just the timer.

      These are the problems I am running into. If any one has any ideas I would love to here them.

      Thanks