05-04-2011 02:56 PM
New revision is available of the community library. It is available at:
http://code.google.com/p/playbook-as3-lib/
This revision includes:
Thanks for the input and code from various people.
We are working on a blog site that will include sample code and more detailed API documentation.
We also have plans to do a full "sample" app that will exercise and test the library but can be used as a basic app for new developers. More on this later.
05-04-2011 02:59 PM
05-04-2011 04:24 PM
Did you miss my post on your last release?
I posted some code to enable listening of the Play/Pause hardware key, thought it might be a nice addition to the lib.
05-04-2011 09:27 PM
05-10-2011 05:00 PM
05-11-2011 12:54 AM
Here is a change that I added to your TimePicker class in the 3rd Release along with the DateParse to correctly adjust the time since you start with 1 instead of 0 with your hour array, and to keep from throwing an error if time is not changed. I don't know if I forgot to mention it but here it is again if you want to add it:
public function TimePicker( minute_intervals : uint = 5 ){
super();
this.width = 200;
this.height = 42;
this._minute_intervals = minute_intervals;
var hours : Array = [
{data:1,label:'1'},
{data:2,label:'2'},
{data:3,label:'3'},
{data:4,label:'4'},
{data:5,label:'5'},
{data:6,label:'6'},
{data:7,label:'7'},
{data:8,label:'8'},
{data:9,label:'9'},
{data:10,label:'10'},
{data:11,label:'11'},
{data:12,label:'12'}];
//
var minutes : Array = new Array();
var m : int;
var l : String;
for( m=0; m < 60; m += minute_intervals ){
l = ''; // reset
if( m < 10 )l = '0';
l += String( m );
minutes.push( { data : m, label : l } );
}
//
var ampm : Array = [ {data:'am',label:'AM'},
{data:'pm',label:'PM'} ];
this.dataProvider = new DataProvider( [ new DataProvider(hours), new DataProvider(minutes), new DataProvider(ampm) ] );
//Added to auto set start time to current and adjust for 1 based
//instead of 0 based hour array
var current:Date = new Date();
var cHour:uint = current.hours;
var cMin:uint = current.minutes / minute_intervals;
var cAP:uint = 0;
if( cHour < 12 ){ cHour=(cHour+11)%12; }
if( cHour > 11 ){ cAP = 1; cHour=(cHour+11)%12; }
var sel:Array = new Array();
sel.push(cHour);
sel.push(cMin);
sel.push(cAP);
selectedIndices = sel;
}
05-11-2011 08:25 AM
05-11-2011 08:30 AM
Correction to my earlier post:
Here is the adjusted code:
////////////////////////////////////////////////////////////// public function setSelectionDate( tm : Date ) : void { var hrs : int = tm.getHours()+1; var ampm : String = AM_SUFFIX; if( hrs > 12 ) { hrs -= 12; ampm = PM_SUFFIX; } this.setSelection( hrs-1, tm.getMinutes(), ampm ); } ////////////////////////////////////////////////// ////////////// public function setSelection( hour : uint, minute : uint, ampm : String ) : void { var sel : Array = new Array(); sel.push( hour - 1 );
sel.push( minute / this._minute_intervals ); sel.push( ( ampm == AM_SUFFIX ) ? 0 : 1 ); this.selectedIndices = sel; }
05-11-2011 08:36 AM
hi john. i'm curious why you don't use ASDoc for library's documentation?
05-11-2011 08:41 AM