unfortunately i have to work locally as i dont have access to the work
servers right now and I had to fly home for the holidays. I can either
include the main file here and the class that is giving me fits or send
you the whole shebang in a zip via email?  SORRY!

here is the main:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
     xmlns:flexlib="flexlib.scheduling.*"
     verticalGap="1"
     creationComplete="onCreationComplete();"
     layout="absolute"
     width='100%' >

    <!-- STYLPROCLAMATION -->
     <!--<mx:Style source="../css/style.css" />-->

    <!-- SCRIPT INSTANTIATION-->
    <mx:Script>
        <![CDATA[

            import flexlib.scheduling.ScheduleViewer;
            import flexlib.scheduling.Timeline;
            import mx.controls.LinkButton;
            import mx.rpc.events.ResultEvent;
            import mx.containers.TitleWindow;
         import flash.events.Event;
         import mx.managers.PopUpManager;
         import mx.managers.IFocusManager;
         import mx.core.IFlexDisplayObject;
         import flexlib.scheduling.samples.ScheduleData;
         import flexlib.scheduling.scheduleClasses.SimpleScheduleEntry;
         import flexlib.scheduling.scheduleClasses.ColoredScheduleEntry;
         import flexlib.scheduling.scheduleClasses.BackgroundItem;
         import flexlib.scheduling.scheduleClasses.LayoutScrollEvent;
         import flexlib.scheduling.util.DateUtil;
         import mx.collections.IList;

         import flash.display.InteractiveObject;

         import mx.collections.ArrayCollection;
         import mx.controls.Alert;
         import mx.events.ScrollEvent;
         import mx.events.ScrollEventDirection;
           import mx.collections.XMLListCollection;
           import flash.utils.Timer;
         import flash.events.TimerEvent;

           //variables
           [Bindable] private var menuBarCollection:XMLListCollection;
           [Bindable] private var dataXML:XMLList;
           [Bindable] private var dataArray:ArrayCollection = new
ArrayCollection();
           [Bindable] private var constantTime:Label = new Label();
           [Bindable] private var today:Date = new Date();

           [Bindable] private var iObj:DisplayObject;
         [Bindable] private var dataProvider : IList;
         [Bindable] private var iDataProvider : IList;
         [Bindable] private var rowDataProvider : IList;
         [Bindable] private var startDate : Date;
         [Bindable] private var startTime : Date;
         [Bindable] private var endDate : Date;
         [Bindable] private var zoom : Number;
         [Bindable] private var scheduleViewerWidth : Number = 2000;
         [Bindable] private var scheduleViewerHeight : Number = 400;
         private var rawArray:Array = new Array();
         private var timer:Timer;

          //once the page is created run these functions
          private function onCreationComplete() : void
          {
             setTimeframe();             //set the time frame on the top
of the list
             initBackgroundColors();  //set the bg colors
             programRequest.send();   //get the programs from the DB
             channelRequest.send();

          }

          private function setFocusOnFirstProgram():void
          {


              scheduleViewer.liveScrolling=true;
              //focusManager.setFocus(scheduleViewer.dataProvider[0]);

          }
          /* set the time frame for the top of the grid */
          private function setTimeframe() : void
          {

              var time : Date = new Date();
              startDate = DateUtil.roundTime(new Date() ,
time.getMinutes());  //round off the current time too either 00 or the
30
             endDate = getEndDate( startDate );  //limit the amt of
programs we want to display.

          }

          private function getEndDate( startDate : Date ) : Date
          {
             var duration : Number = DateUtil.HOUR_IN_MILLISECONDS * 5; 
//set the duration of the timeline to 5 hours out
             var endDate : Date = new Date( startDate.getTime() +
duration );
             return endDate;
          }


          /* @about: sets the event result to an array for displaying on
the schedule */
          private function setDataProvider(event:ResultEvent) : void
          {
             var c:Number = 0;
             ScheduleData.FocusID = [EMAIL PROTECTED];   //this is
the channel_id to focus on

             //assign the event.result XML to an object and create each
row based on the channel id
             //each channel node has its programs listed for that day
inside of it --look at the programs.xml to get a better understanding
             for each(var p:XML in event.result..channel)
             {
                 var channelObj:Object = new Object();
                 channelObj.ch_id = [EMAIL PROTECTED];
                 channelObj.prog_id = [EMAIL PROTECTED];
                 channelObj.name = p..name;
                 channelObj.program_length = p..program_length;
                 channelObj.image_name = p..image_name;
                 channelObj.time = p..time;
                 rawArray.push(channelObj);

            }
             dataProvider =new ScheduleData().createRowItem(rawArray);

            //set the focus of the tab on the first program
             setFocusOnFirstProgram();
          }

          /* @about: sets the channel listings on the left side of the
program based up the number of Channels returned sorted ASC
                     this should match each row as well */
          private function setChannelProvider(event:ResultEvent) : void
          {
             var rowCount:int = event.result..count;   //this is the
absolute count of channels ie-rows-to populate
             rowDataProvider = new ArrayCollection();
             for( var t : int = 0; t < rowCount; t++ )
             {
                rowDataProvider.addItem( { label: [EMAIL PROTECTED]
+ " id==" + [EMAIL PROTECTED] } );
             }
          }


          /* HORIZONTAL scrolling event.  move the xposition of the
timeline with the scheduler to look as one piece */
          private function onScrollScheduleViewer( event : ScrollEvent )
: void
          {
             if( event.direction == ScrollEventDirection.HORIZONTAL )
             {
                timeline.xPosition = event.position;
             }
          }
          /* VERTICAL SCROLL event, scroll the channel list on the left
with it */
          private function scrollList( event : LayoutScrollEvent ) : void
          {
             if( event.direction == ScrollEventDirection.VERTICAL )
             {
                rowsList.verticalScrollPosition = event.position;
             }
          }




          /* if no selection made warn the user with an alert box */
          private function warnAboutNoSelection() : void
          {
             Alert.show( "Please select an entry." );
          }

          //initialize the bg color--will be CSS later
          private function initBackgroundColors() : void
          {
             var result : ArrayCollection = new ArrayCollection();

             var duration : Number = endDate.getTime() -
startDate.getTime();
             var days : Number = duration / DateUtil.DAY_IN_MILLISECONDS;

             for( var i : int; i < days; i++ )
             {
                var currentDate : Number = DateUtil.DAY_IN_MILLISECONDS *
i;
                var backgroundItem : BackgroundItem;
                backgroundItem = createBackgroundItem( "office closed",
0xD5D4D0,
                                                    currentDate, 0, 0,
24, 0 );
                result.addItem( backgroundItem );

                backgroundItem = createBackgroundItem( "generell office
hours", 0xFFFFFF,
                                                       currentDate, 9, 0,
17, 0 );
                result.addItem( backgroundItem );

                backgroundItem = createBackgroundItem( "lunchtime",
0xEEEDE9,
                                                       currentDate, 12,
0, 13, 0 );
                result.addItem( backgroundItem );
             }
             scheduleViewer.backgroundItems = result;
          }

          /* this creates the background items for the schedule */
          private function createBackgroundItem( description : String,
                                                 color : Number,
currentDate : Number,
                                                 startHours : Number,
startMinutes : Number,
                                                 endHours : Number,
endMinutes : Number ) : BackgroundItem
          {
             var backgroundItem : BackgroundItem = new BackgroundItem();
             backgroundItem.description = description;
             backgroundItem.color = color;
             backgroundItem.startDate = new Date( currentDate +
createTime( startHours, startMinutes ) );
             backgroundItem.endDate = new Date( currentDate + createTime(
endHours, endMinutes ) );
             return backgroundItem;
          }

          /* create the time to be displayed on the timeline and programs
*/
          private function createTime( hours : Number, minutes : Number )
: Number
          {
             var result : Number = (( hours * 60 ) + minutes ) * 60 *
1000;
             return result;
          }

            //view the selected program's info and image in the bottom
panel viewer
          private function viewSelectedProgram():void{

              if( scheduleViewer.selectedItem != null )
             {
                   // popup a screen for the user to view more info on
the movie
                  
viewImage.source='../program_images/'+scheduleViewer.selectedItem.imageN\
ame;
                   
test_label.text=scheduleViewer.selectedItem.imageName;

                      trace(scheduleViewer.selectedItem.chId
);
             }
             else
             {
                warnAboutNoSelection();
             }

          }
         /*  @name: refreshClock
             @author:Corey A Smaller
             @about: this refreshes every 1 second and updates the clock
on the main app toolbar
             @date: 12/08/07 */
         private function refreshClock():void {
             this.timer = new Timer(1000);
             this.timer.addEventListener(TimerEvent.TIMER,
this.resetNow);
             this.timer.start();
         }

         /* called from refreshClock -refreshes the clock on the main
page with the updated time
            @author: Corey Smaller
            @date: 12/08/2007 */
         private function resetNow(event:TimerEvent):void {
             this.clock.text = new Date().toLocaleTimeString();
         }


          ]]>
     </mx:Script>




    <!-- HTTP Request for shows -->
        <mx:HTTPService  id="programRequest" url="php/programs.xml"
            useProxy="false" result ="setDataProvider(event);"
resultFormat="e4x"
             />

         <!-- HTTP Request for channels -->
        <mx:HTTPService  id="channelRequest" url="php/channels.xml"
            useProxy="false" result ="setChannelProvider(event);"
resultFormat="e4x"
             />


        <mx:DateFormatter id="DateDisplay"
         formatString = "MM/DD/YYYY"/>


        <!-- application container -->
     <mx:ApplicationControlBar id="dock_bar" dock="true"  width="100%"
height="200">
             <mx:HBox bottom="0" left ='5'>
                <mx:Label text="{DateDisplay.format(today)}"
fontWeight="bold"  fontSize="15"/>
                <mx:Text fontSize= "15" fontWeight="bold"
             id="clock" text="" creationComplete="this.refreshClock();"
                 width="120" x="10" y="0"/>
            </mx:HBox>

     </mx:ApplicationControlBar>
     <mx:VBox>


         <mx:HBox width="100%" >


             <!--CHANNELS -->
                <mx:VBox verticalGap="0">
               <mx:VBox height="{ timeline.height }" verticalGap="0">
                  <mx:Label text="Channels"/>
               </mx:VBox>
               <mx:List tabEnabled="false" focusEnabled="false"
                  id="rowsList" width="200" height="{
scheduleViewerHeight }"
                  dataProvider="{ rowDataProvider }"
                  rowHeight="{ scheduleViewer.rowHeight }"
                  verticalScrollPolicy="off" verticalAlign="middle"/>
            </mx:VBox>

            <mx:VBox verticalGap="0">

                 <!--TIME LINE -->
               <flexlib:Timeline
                  id="timeline"
                  width="{ scheduleViewerWidth }" borderStyle="none"
                  startDate="{ startDate }" endDate="{ endDate }"

                  />

              <!--SCHEDULE --- THIS IS THE PART THAT IS GIVING ME FITS-->
               <flexlib:ScheduleViewer tabChildren="true"
focusEnabled="true" click="viewSelectedProgram()"
                  id="scheduleViewer"  tabEnabled="false"
                   width="{ scheduleViewerWidth }" height="{
scheduleViewerHeight }" borderStyle="none"
                  dataProvider="{ dataProvider }"
                  startDate="{ startDate }" endDate="{ endDate }"
                  horizontalScrollPolicy="off" pixelScrollEnabled="true"
                 
entryRenderer="flexlib.scheduling.scheduleClasses.renderers.ColoredGradi\
entScheduleEntryRenderer"
                 
entryLayout="flexlib.scheduling.scheduleClasses.layout.SimpleLayout"
                 
horizontalLinesViewer="flexlib.scheduling.samples.AlternatingHorizontalL\
inesViewer"
                 
verticalLinesViewer="flexlib.scheduling.samples.SolidVerticalLinesViewer\
"

                  pixelScroll="onScrollScheduleViewer( event );"
itemScroll="scrollList( event )"
                  />

            </mx:VBox>

         </mx:HBox>
         <mx:Panel width="800" height="250">
             <mx:Image  id="viewImage" width="200" height="200"
                  />
             <mx:Label id = "test_label" />
         </mx:Panel>

      </mx:VBox>
</mx:Application>




THE CLASS:
package flexlib.scheduling.samples
{
     import flexlib.scheduling.scheduleClasses.ColoredScheduleEntry;
     import flexlib.scheduling.scheduleClasses.SimpleScheduleEntry;
     import flexlib.scheduling.util.DateUtil;

     import mx.collections.ArrayCollection;
     import mx.collections.IList;
     import mx.controls.Alert;

     public class ScheduleData
     {

         public static var FocusID:uint;

         public function createRowItem( rawArray:Array ) :
ArrayCollection
         {


             var result : Array = new Array();
             var duration : Number;//the length of the show in minutes
             var program: String ;    //the name of the show
             var ch_id:Number;       //channel ID to match the listing
with the row
             var color : Number;        //bg color
             var programStartTime:Number     //program start time
             var imageName:String;
             var tabCounter:Number = 0;
             //FocusID = rawArray[0].ch_id[0];
             //for each row
             for( var i : Number = 0; i < rawArray.length; i++ )
             {

                 var c: Number = 0;   //counter
                 var row : IList = new ArrayCollection();
                 //Alert.show(count(rawArray[i].prog_id).toString());
                 for each(var t:Object in rawArray[i])
                 {

                     if(rawArray[i].prog_id[c]){

                         programStartTime = (rawArray[i].time[c] * 60 *
60 * 1000);   //convert hours to milliseconds
                         duration = rawArray[i].program_length[c] * 60 *
1000;    //the length of the show in minutes
                         program= rawArray[i].name[c];    //the name of
the show
                         ch_id =rawArray[i].ch_id;
                         if(rawArray[i].image_name[c])
                             imageName = rawArray[i].image_name[c];
                         color = 0x00ff77;        //channel ID to match
the listing with the row
                         var entry : SimpleScheduleEntry =
createColoredEntry( program, programStartTime, duration,
color,ch_id,imageName,tabCounter );
                         //turn our SimpleScheduleEntry into an
interactiveObject in order to be able to tab/focus

                         row.addItem( entry );
                         c++;
                         tabCounter++

                     }
                 }

                 result.push(row);

             }


             return new ArrayCollection(result);
         }


         private function createSimpleEntry( i : Number, startTime :
Number, duration : Number ) : SimpleScheduleEntry
         {
             var entry : SimpleScheduleEntry = new SimpleScheduleEntry();

             entry.startDate = DateUtil.setTime( new Date(), startTime );
             entry.endDate = DateUtil.addTime( DateUtil.copyDate(
entry.startDate ), duration );
             entry.label = "Entry " + i;
             return entry;
         }

         private function createColoredEntry
             ( program:String, startTime : uint, duration : Number, color
: uint, ch_id : uint,image:String,tab:uint )
              : SimpleScheduleEntry
         {
             var entry : ColoredScheduleEntry = new
ColoredScheduleEntry();

             entry.startDate = DateUtil.setTime( new Date(), startTime );
             entry.endDate = DateUtil.addTime( DateUtil.copyDate(
entry.startDate ), duration );
             entry.chId = tab;
             entry.label = program ;
             entry.backgroundColor = color;
             entry.imageName = image;
             entry.focusEnabled = true;
             entry.tabEnabled = true;
             entry.mouseFocusEnabled = true;
             //entry.tabIndex = tab;
             /* configureListeners(entry);   */ //add the listeners to
each child object created

             return entry;
         }
         //adding the focusinHandler to display the popup wiht the info
on the program when selected
         /* private function
configureListeners(dispatcher:IEventDispatcher):void
         {
             dispatcher.addEventListener(FocusEvent.FOCUS_IN,
focusInHandler);

         } */
         private function randomInt( max : Number ) : Number
         {
             return Math.floor( Math.random() * max );
         }
     }
}

--- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Can you post your code with view source enabled?
>
>
>
> ________________________________
>
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
> Behalf Of Corey Smaller
> Sent: Tuesday, December 18, 2007 5:53 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] tabEnabled not enabling
>
>
>
> after much pain and suffering with this Flexlib Schduler, i have set
> my schedule program objects (entry) to tabEnabled= "true",
> tabchildren="true", focusEnabled="true" . I have traced the tab index
> of each item when I click it and the index number shows up so i know
> the entry is enabled so I figured the tab navigation should work
> right? um..nope.
>
> in my main mxml my scheduleViewer (which contain the enntries)
> focusEnabled="true" tabChildren="true" and tabEnabled="true" . I have
> tried changing tabEnabled="false" and focusEnabled='false" and several
> combos of each to no avail.
> I need a stiff drink.
>


Reply via email to