Changeset 3302
- Timestamp:
- 12/19/07 04:35:09 (13 months ago)
- Location:
- lang/legacy-actionscript/as2draw
- Files:
-
- 1 added
- 7 modified
-
AS2Draw.as (modified) (3 diffs)
-
AS2Draw.swf (modified) (previous)
-
ColorButton.as (added)
-
PenButton.as (modified) (3 diffs)
-
ToolPalette.as (modified) (1 diff)
-
U.as (modified) (2 diffs)
-
build.bat (modified) (1 diff)
-
index.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/legacy-actionscript/as2draw/AS2Draw.as
r3301 r3302 4 4 private var mToolPalette:ToolPalette; 5 5 private var mSelectedPenButton:PenButton; 6 private var mSelectedColorButton:ColorButton; 7 public var DEFAULT_COLORS:Array = [0xffffff, 0xdddddd, 0x888888, 0x000000, 0xf04433, 0xffaf98, 0x80c090]; 6 8 7 9 public function AS2Draw(aRoot:MovieClip) 8 10 { 9 mToolPalette = new ToolPalette(aRoot, 480, 24, 0x888888);11 mToolPalette = new ToolPalette(aRoot, 480, 56, 0x888888); 10 12 buildToolPalette(mToolPalette); 11 13 12 mDrawable = new Drawable (aRoot, 0x eeffdd, 480, 200);13 mDrawable.setY( 24);14 mDrawable = new Drawable (aRoot, 0xffffff, 480, 232); 15 mDrawable.setY(56); 14 16 } 15 17 … … 17 19 { 18 20 var _this = this; 19 var closure = function(b){_this.pushedPenButton(b);};20 21 21 var p1:PenButton = new PenButton(3); 22 tp.addButton(p1); 23 p1.afterPush = closure; 22 { 23 var closure = function(b){_this.pushedPenButton(b);}; 24 25 var p1:PenButton = new PenButton(3); 26 tp.addButton(p1); 27 p1.afterPush = closure; 24 28 25 var p2:PenButton = new PenButton(8);26 tp.addButton(p2);27 p2.afterPush = closure;29 var p2:PenButton = new PenButton(8); 30 tp.addButton(p2); 31 p2.afterPush = closure; 28 32 29 var p3:PenButton = new PenButton(16); 30 tp.addButton(p3); 31 p3.afterPush = closure; 33 var p3:PenButton = new PenButton(16); 34 tp.addButton(p3); 35 p3.afterPush = closure; 36 37 pushedPenButton(p1); 38 } 39 40 tp.appendBlank(8); 41 42 { 43 var l = DEFAULT_COLORS.length; 44 var closure = function(b){_this.pushedColorButton(b);}; 45 for (var i:Number = 0;i < l;i++) 46 { 47 var cb:ColorButton = new ColorButton(DEFAULT_COLORS[i]); 48 tp.addButton(cb); 49 50 cb.afterPush = closure; 51 } 52 } 32 53 } 33 54 … … 43 64 } 44 65 66 private function pushedColorButton(aButton:ColorButton) 67 { 68 if (mSelectedColorButton) 69 { 70 mSelectedColorButton.setSelected(false); 71 } 72 73 mSelectedColorButton = aButton; 74 mSelectedColorButton.setSelected(true); 75 } 76 45 77 static function main() 46 78 { -
lang/legacy-actionscript/as2draw/PenButton.as
r3301 r3302 3 3 private var mWidth:Number; 4 4 private var mMC:MovieClip; 5 private var buttonWidth:Number = 28;6 private var buttonHeight:Number = 23;5 private var buttonWidth:Number = 40; 6 private var buttonHeight:Number = 55; 7 7 private var mSelectionColor:Number = 0xddeeff; 8 8 private var mDefaultColor:Number = 0xffffff; … … 25 25 mMC = aParent.createEmptyMovieClip("pen-button-w"+mWidth, aIndex); 26 26 drawSymbol(mMC, mSelected); 27 mMC.useHandCursor = false;27 mMC.useHandCursor = true; 28 28 29 29 var _this = this; … … 49 49 var cy:Number = buttonHeight/2; 50 50 51 mMC.clear();51 g.clear(); 52 52 53 mMC.beginFill(selected ? mSelectionColor : mDefaultColor);54 U.rect( mMC, 0, 0, buttonWidth, buttonHeight);55 mMC.endFill();53 g.beginFill(selected ? mSelectionColor : mDefaultColor); 54 U.rect(g, 0, 0, buttonWidth, buttonHeight); 55 g.endFill(); 56 56 57 g.lineStyle(mWidth, 0x000000 );57 g.lineStyle(mWidth, 0x000000, selected ? 100 : 60); 58 58 g.moveTo(cx, cy); 59 59 g.lineTo(cx+0.5,cy); -
lang/legacy-actionscript/as2draw/ToolPalette.as
r3276 r3302 31 31 } 32 32 33 public function appendBlank(aLeft:Number, aRight:Number) 34 { 35 if (aLeft) 36 mNextLeft += aLeft; 37 38 if (aRight) 39 mNextRight -= aRight; 40 } 41 33 42 public function addButton(aBtn) 34 43 { -
lang/legacy-actionscript/as2draw/U.as
r3300 r3302 1 1 class U /*Utility*/ 2 2 { 3 public static function rect(g:MovieClip, x:Number, y:Number, w:Number, h:Number )3 public static function rect(g:MovieClip, x:Number, y:Number, w:Number, h:Number, close) 4 4 { 5 5 g.moveTo(x , y ); … … 7 7 g.lineTo(x+w, y+h); 8 8 g.lineTo(x , y+h); 9 if (close) 10 g.lineTo(x, y); 9 11 } 10 12 } -
lang/legacy-actionscript/as2draw/build.bat
r3273 r3302 1 mtasc -version 7 -swf AS2Draw.swf -main AS2Draw.as -header 480:2 24:301 mtasc -version 7 -swf AS2Draw.swf -main AS2Draw.as -header 480:288:30 -
lang/legacy-actionscript/as2draw/index.html
r3273 r3302 20 20 <body> 21 21 <div class="canvas-container"> 22 <object data="./AS2Draw.swf" type="application/x-shockwave-flash" width="480" height="2 24">22 <object data="./AS2Draw.swf" type="application/x-shockwave-flash" width="480" height="288"> 23 23 <param name="movie" value="./AS2Draw.swf" /> 24 24 <param name="autostart" value="true" />
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)