Hi Donald,

Only trying to help so please don't take this wrong, but I doubt
you're going to get (m)any responses to a post like this. Its simply
too long and hard to follow. If you can state your problem more
concisely and show a smaller snippet of the problem area in the code
you will be much more likely to find someone who can help you.

Ben


--- In [email protected], "donvoltz" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> Would someone help me troubleshoot the following code. I seeing some
> behaviors I can not figure out.
> 
> I start by building a custom component in a scheduling application,
> one that contains a calendar selection and 2 HTTPRequests, one to
> obtain the locations that need to be filled on a given day and the
> other to obtain the people who are already scheduled on that day. When
> I return this information, I dynamically add another component to the
> panal. This second component is used to display the name of the
> location as well the name of the person, if there is one scheduled for
> the selected day. Then using drag and drop, I am able to add or update
> who is scheduled on the given day.
> 
> Since I am dynamically adding the locations based on what is returned
> from the database, I am using an array to hold each of the custom
> components that I add to the panal. I use this so I can keep track of
> which component is added and then be able to update the properties of
> that component when I return the data about the people who are
> scheduled in the location.
> 
> When I run the application for the first time, I am able to do what I
> want to do with the app, however, this is where the problem comes in.
> When I close the app and rerun it, I am no longer able to access data
> in the array from the callScheduleHandler method. As I trace this out
> in debug mode, the  callLabel array is built as data is returned to
> the callLocationHandler but then it disappears. I can not find why
> this runs fine the first time, but then I am unable to construct the
> custom component on subsequent runs.
> 
> Any thoughts on this would be greatly appreciated.
> 
> Thanks
> 
> Don
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml";
> xmlns:comp="components.*" layout="vertical"
> title="{selectedDisplayDate}"  creationComplete="initComp()" 
> horizontalAlign="center"  width="350" height="800">
>       <mx:Script>
>               <![CDATA[
>                       import mx.collections.ArrayCollection;
>                       import mx.controls.Label;
>                       import mx.rpc.events.ResultEvent;
>                       import mx.controls.Alert;
>                       
>                       
>                       [Bindable]
>                       private var selectedDisplayDate:String;
>                       [Bindable]
>                       private var selectedDate:Date = new Date(); 
>                       [Bindable]
>                       private var locationData:XMLList;
>                       [Bindable]
>                       private var callScheduleData:XMLList;
>                       private var callLabel:Array= new Array;
>                       private var callAssignment:Array = new Array;
>                       [Bindable]
>                       private var callUserXML:XMLList;
>                       
>                       
>                       
>                       private function initComp():void {
>                               callLocations.send();
>                               selectedDisplayDate =
> displayDate.format(calendarSelector.selectedDate) + " Call Schedule";
>                               dailyCallSchedule.send();
>                       }
>                       private function dateSelected(event:Event):void {
>                               selectedDisplayDate =
> displayDate.format(calendarSelector.selectedDate) + " Call Schedule";
>                               selectedDate = calendarSelector.selectedDate;
>                               
>                       }
>                       private function 
> callLocationHandler(event:ResultEvent):void {
>                               var locationXML:XML = event.result as XML;
>                               locationData = locationXML.row as XMLList;
>                               
>                               for each (var item:XML in locationData){
>                                       
>                                       callLabel[item..callLocation_id] = new 
> formField();
>                                       
> callLabel[item..callLocation_id].labelText =
> item..callLocation_DisplayName;
>                                       
> callLabel[item..callLocation_id].callLocationId =
> item..callLocation_id;
>                                       
> callLabel[item..callLocation_id].allowableDataFlag =
> item..deptCategory;
>                                       
> callLabel[item..callLocation_id].callSelectedDate =
> mysqlDate.format(calendarSelector.selectedDate);
>                                       
> addChild(callLabel[item..callLocation_id]);
>                                       
>                               }       
>                       }
>                       private function resetCallLocations():void {
>                               //remove all children
>                               
>                       }
>                       private function 
> callScheduleHandler(event:ResultEvent):void {
>                               var callScheduleXML:XML = event.result as XML;
>                               callScheduleData = callScheduleXML.row as 
> XMLList;
>                       
>                               for each (var item:XML in callScheduleData){
>                                       
>                                       
> callLabel[item..callLocation_id].inputText = item..last_name;
>                                       
> callLabel[item..callLocation_id].hasData = true;
>                                       
> //Alert.show(callLabel[item..callLocation_id].labelText);
>                               }               
>                       }
>                       private function 
> callUsersHandler(event:ResultEvent):void {
>                               var callXML:XML = event.result as XML;
>                               callUserXML = callXML.row as XMLList;
>                               
>                       }
>               ]]>
>       </mx:Script>
>       
>       <mx:DateFormatter id="displayDate" formatString="EEEE MMMM DD YYYY"/>
>       <mx:DateFormatter id="mysqlDate" formatString="YYYY-MM-DD"/>
>       
>       <mx:HTTPService id="callLocations"
> url="http://localhost/flex/html/callLocationsXML.php"; useProxy="false"
> method="POST" resultFormat="e4x" result="callLocationHandler(event)"/>
>       <mx:HTTPService id="dailyCallSchedule"
> url="http://localhost/flex/html/callScheduleDaily.php";
> useProxy="false" method="GET" resultFormat="e4x"
> result="callScheduleHandler(event)">
>               <mx:request xmlns="">
>               
<callDate>{mysqlDate.format(calendarSelector.selectedDate)}</callDate>
>               </mx:request>
>       </mx:HTTPService>
>       <mx:HTTPService id="callUsers"
> url="http://localhost/flex/html/callUsers.php"; useProxy="false"
> method="POST" resultFormat="e4x" result="callUsersHandler(event)"/>
>       
>       
>       <mx:DateChooser id="calendarSelector" click="dateSelected(event)"
> selectedDate="{selectedDate}" fontFamily="Georgia"/>
>       
> </mx:Panel>
> 
> 
> 
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml";
> creationComplete="initComp()">
> <mx:Metadata>
>       [Event(name="formChange", type="events.FormChangeEvent")]
> </mx:Metadata>
> <mx:Script>
>       <![CDATA[
>               import mx.rpc.events.FaultEvent;
>               import mx.rpc.events.ResultEvent;
>               import mx.charts.chartClasses.DataDescription;
>               import events.FormChangeEvent;
>               import mx.controls.Alert;
>               import flash.events.Event;
>               import mx.core.DragSource;
>               import mx.managers.DragManager;
>               import mx.events.DragEvent;
>               import mx.core.IUIComponent;
>               import mx.controls.Alert;
>               import classes.UserLogin;
>               import classes.UserInformation;
>               
>               [Bindable]
>               public var labelText:String = "Label";
>               [Bindable]
>               public var inputText:String = "Input";
>               [Bindable]
>               public var imageSource:String = "";
>               [Bindable]
>               private var hasContentChanged:Boolean = false;
>               [Bindable]
>               public var callLocationId:int = 0;
>               [Bindable]
>               public var callAssignedUserId:int = 0;
>               [Bindable]
>               public var callSelectedDate:String;
>               public var hasData:Boolean; //flagged true if record set already
> exists in callTable. This will trip either insert or update mysql query
>               [Bindable]
>               private var currentUser:UserInformation =
> UserLogin.getInstance().UserInfo;
>               [Bindable]
>               public var allowableDataFlag:String = ''; //place to store user
> category that is allowed to take this call
>               
>               private function initComp():void {
>                       
> parent.addEventListener('formChange',formChangeEventHandler);
>               }
>               private function 
> formChangeEventHandler(event:FormChangeEvent):void {
>                       Alert.show('field has been changed, id of field is = ' 
> + hasData);
>               }
>               private function formDataChangeHandler():void {
>                       
>                       //need to send event in this function updating data if
> hasContentChaned == true
>               }
>               private function doDragEnter(event:DragEvent, 
> format:String):void {
>                       
>                               if(event.dragSource.hasFormat(format)){
>                                       
> DragManager.acceptDragDrop(IUIComponent(event.target));
>                               }
>               }
>                       
>               private function doDragDrop(event:DragEvent, 
> format:String):void {
>                       
>                       var dragData:Object = new Object();
>                       dragData=event.dragSource.dataForFormat(format);
>                       event.currentTarget.text = String(dragData.lastname + 
> ', ' +
> dragData.firstname);
>                       callAssignedUserId = int(dragData.id);
>                       //Alert.show('user id = ' + dragData.id);
>                       //need to send data change back to server for update
>                       addUpdateCallAssignment.send();
>                       
>               }
>               private function confirmTableEntry(event:ResultEvent):void {
>                       var updateResultsXML:XML = event.result as XML;
>                       if (updateResultsXML..success == '1'){
>                               imageSource = "icons/accept.png";
>                       }
>                       //trace(event);
>                       //trigger icon
>                       //update user list
>                       //
>               }
>               private function errorTableEntry(event:FaultEvent):void {
>                       trace(event);
>                       imageSource = "icons/cancel.png";
>                       Alert.show('Error in updating the database');
>               }
>       ]]>
> </mx:Script>
>               
>       <mx:HTTPService id="addUpdateCallAssignment"
> url="http://localhost/flex/callScheduleEntry.php"; method="POST"
> resultFormat="e4x" result="confirmTableEntry(event)"
> fault="errorTableEntry(event)">
>               <mx:request xmlns="">
>                       <userid>{callAssignedUserId}</userid>
>                       <calldate>{callSelectedDate}</calldate>
>                       <calllocation>{callLocationId}</calllocation>
>                       <enteredby>{currentUser.userID}</enteredby>
>               </mx:request>
>       </mx:HTTPService>
>       <mx:Label text="{labelText}" toolTip="{callSelectedDate}"/>
>       <mx:TextInput id="inputData" text="{inputText}" editable="false"
> focusOut="formDataChangeHandler()" dragDrop="doDragDrop(event,
> allowableDataFlag)" dragEnter="doDragEnter(event, allowableDataFlag)"/>
>       <mx:Image id="imageID" source="{imageSource}" enabled="false"/>
>       
> </mx:HBox>
>


Reply via email to