@@ -71,6 +71,10 @@ var Display;
7171 this . setTo ( 1 , 0 , 0 , 1 , 0 , 0 ) ;
7272 } ;
7373
74+ Matrix . prototype . createGradientBox = function ( width , height , rotation , tX , tY ) {
75+ this . createBox ( width , height , rotation , tX , tY ) ;
76+ } ;
77+
7478 Matrix . prototype . createBox = function ( sX , sY , q , tX , tY ) {
7579 this . identity ( ) ;
7680 this . rotate ( q ) ;
@@ -600,6 +604,33 @@ var Display;
600604 return ;
601605 }
602606 this . _hasSetDefaults = true ;
607+ try {
608+ /** Try reading the defaults from motion fields **/
609+ if ( defaults . hasOwnProperty ( "motion" ) ) {
610+ var motion = defaults [ "motion" ] ;
611+ if ( motion . hasOwnProperty ( "alpha" ) ) {
612+ this . _alpha = motion [ "alpha" ] [ "fromValue" ] ;
613+ }
614+ if ( motion . hasOwnProperty ( "x" ) ) {
615+ this . _x = motion [ "x" ] [ "fromValue" ] ;
616+ }
617+ if ( motion . hasOwnProperty ( "y" ) ) {
618+ this . _y = motion [ "y" ] [ "fromValue" ] ;
619+ }
620+ } else if ( defaults . hasOwnProperty ( "motionGroup" ) && defaults [ "motionGroup" ] && defaults [ "motionGroup" ] . length > 0 ) {
621+ var motion = defaults [ "motionGroup" ] [ 0 ] ;
622+ if ( motion . hasOwnProperty ( "alpha" ) ) {
623+ this . _alpha = motion [ "alpha" ] [ "fromValue" ] ;
624+ }
625+ if ( motion . hasOwnProperty ( "x" ) ) {
626+ this . _x = motion [ "x" ] [ "fromValue" ] ;
627+ }
628+ if ( motion . hasOwnProperty ( "y" ) ) {
629+ this . _y = motion [ "y" ] [ "fromValue" ] ;
630+ }
631+ }
632+ } catch ( e ) {
633+ }
603634 if ( defaults . hasOwnProperty ( "alpha" ) ) {
604635 this . _alpha = defaults [ "alpha" ] ;
605636 }
@@ -771,6 +802,32 @@ var Display;
771802 } ) ;
772803
773804
805+ Object . defineProperty ( DisplayObject . prototype , "width" , {
806+ get : function ( ) {
807+ return this . _width ;
808+ } ,
809+ set : function ( w ) {
810+ this . _width = w ;
811+ this . propertyUpdate ( "width" , w ) ;
812+ } ,
813+ enumerable : true ,
814+ configurable : true
815+ } ) ;
816+
817+
818+ Object . defineProperty ( DisplayObject . prototype , "height" , {
819+ get : function ( ) {
820+ return this . _height ;
821+ } ,
822+ set : function ( h ) {
823+ this . _height = h ;
824+ this . propertyUpdate ( "height" , h ) ;
825+ } ,
826+ enumerable : true ,
827+ configurable : true
828+ } ) ;
829+
830+
774831 Object . defineProperty ( DisplayObject . prototype , "visible" , {
775832 get : function ( ) {
776833 return this . _visible ;
@@ -1315,8 +1372,6 @@ var Display;
13151372 }
13161373 if ( ! mProp . hasOwnProperty ( "lifeTime" ) ) {
13171374 mProp [ "lifeTime" ] = this . _dur ;
1318- } else {
1319- mProp [ "lifeTime" ] *= 1000 ;
13201375 }
13211376 var src = { } , dst = { } ;
13221377 src [ movingVars ] = mProp [ "fromValue" ] ;
@@ -1429,6 +1484,7 @@ var Display;
14291484 function CommentCanvas ( params ) {
14301485 _super . call ( this ) ;
14311486 this . _mM = new Display . MotionManager ( this ) ;
1487+ this . setDefaults ( params ) ;
14321488 this . initStyle ( params ) ;
14331489 Runtime . registerObject ( this ) ;
14341490 this . bindParent ( params ) ;
@@ -1624,6 +1680,18 @@ var Display;
16241680 } ) ;
16251681
16261682
1683+ Object . defineProperty ( TextField . prototype , "length" , {
1684+ get : function ( ) {
1685+ return this . text . length ;
1686+ } ,
1687+ set : function ( l ) {
1688+ __trace ( "TextField.length is read-only." , "warn" ) ;
1689+ } ,
1690+ enumerable : true ,
1691+ configurable : true
1692+ } ) ;
1693+
1694+
16271695 Object . defineProperty ( TextField . prototype , "htmlText" , {
16281696 get : function ( ) {
16291697 return this . text ;
@@ -1637,6 +1705,32 @@ var Display;
16371705 } ) ;
16381706
16391707
1708+
1709+
1710+ Object . defineProperty ( TextField . prototype , "textWidth" , {
1711+ get : function ( ) {
1712+ /** TODO: Fix this to actually calculate the width **/
1713+ return this . _text . length * this . _textFormat . size ;
1714+ } ,
1715+ set : function ( w ) {
1716+ __trace ( "TextField.textWidth is read-only" , "warn" ) ;
1717+ } ,
1718+ enumerable : true ,
1719+ configurable : true
1720+ } ) ;
1721+
1722+ Object . defineProperty ( TextField . prototype , "textHeight" , {
1723+ get : function ( ) {
1724+ /** TODO: Fix this to actually calculate the height **/
1725+ return this . _textFormat . size ;
1726+ } ,
1727+ set : function ( h ) {
1728+ __trace ( "TextField.textHeight is read-only" , "warn" ) ;
1729+ } ,
1730+ enumerable : true ,
1731+ configurable : true
1732+ } ) ;
1733+
16401734 Object . defineProperty ( TextField . prototype , "color" , {
16411735 get : function ( ) {
16421736 return this . _textFormat . color ;
0 commit comments