Changeset 3300 for lang/legacy-actionscript
- Timestamp:
- 12/19/07 03:30:38 (12 months ago)
- Location:
- lang/legacy-actionscript/as2draw
- Files:
-
- 1 added
- 4 modified
-
AS2Draw.as (modified) (1 diff)
-
AS2Draw.swf (modified) (previous)
-
Drawable.as (modified) (2 diffs)
-
PenButton.as (modified) (2 diffs)
-
U.as (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/legacy-actionscript/as2draw/AS2Draw.as
r3276 r3300 15 15 private function buildToolPalette(tp:ToolPalette) 16 16 { 17 var _this = this; 18 var closure = function(b){_this.pushedPenButton(b);}; 19 17 20 var p1:PenButton = new PenButton(3); 18 21 tp.addButton(p1); 22 p1.afterPush = closure; 19 23 20 24 var p2:PenButton = new PenButton(8); 21 25 tp.addButton(p2); 26 p2.afterPush = closure; 22 27 23 28 var p3:PenButton = new PenButton(16); 24 29 tp.addButton(p3); 30 p3.afterPush = closure; 31 } 32 33 private function pushedPenButton(aButton:PenButton) 34 { 35 25 36 } 26 37 -
lang/legacy-actionscript/as2draw/Drawable.as
r3273 r3300 1 //import jp.javac.tools.*;2 3 1 class Drawable 4 2 { … … 24 22 { 25 23 mMC.beginFill(mBGColor); 26 mMC.moveTo(0 , 0 ); 27 mMC.lineTo(mSize.w, 0 ); 28 mMC.lineTo(mSize.w, mSize.h); 29 mMC.lineTo(0 , mSize.h); 24 U.rect(mMC, 0, 0, mSize.w, mSize.h); 30 25 mMC.endFill(); 31 26 } -
lang/legacy-actionscript/as2draw/PenButton.as
r3276 r3300 3 3 private var mWidth:Number; 4 4 private var mMC:MovieClip; 5 private var buttonWidth:Number = 28; 5 private var buttonWidth:Number = 28; 6 private var buttonHeight:Number = 23; 7 private var mSelectionColor:Number = 0xddeeff; 8 private var mSelected:Boolean; 9 10 public var afterPush:Function; 6 11 7 12 public function PenButton(aWidth:Number) … … 10 15 } 11 16 17 public function getWidth() 18 { 19 return mWidth; 20 } 21 12 22 public function createView(aParent:MovieClip, aIndex:Number) 13 23 { 14 24 mMC = aParent.createEmptyMovieClip("pen-button-w"+mWidth, aIndex); 15 drawSymbol(mMC );25 drawSymbol(mMC, true); 16 26 mMC.useHandCursor = false; 27 28 var _this = this; 29 mMC.onPress = function(){_this.onMouseDown()}; 17 30 return mMC; 18 31 } 19 32 20 p rivate function drawSymbol(g:MovieClip)33 public function setSelected(b:Boolean) 21 34 { 22 var c:Number = (buttonWidth-4)/2; 35 mSelected = b; 36 drawSymbol(mMC, b); 37 } 38 39 private function onMouseDown() 40 { 41 if (afterPush) 42 afterPush(this); 43 } 44 45 private function drawSymbol(g:MovieClip, selected:Boolean) 46 { 47 var cx:Number = buttonWidth/2; 48 var cy:Number = buttonHeight/2; 49 50 mMC.clear(); 51 52 if (selected) { 53 mMC.beginFill(mSelectionColor); 54 U.rect(mMC, 0, 0, buttonWidth, buttonHeight); 55 mMC.endFill(); 56 } 57 23 58 g.lineStyle(mWidth, 0x000000); 24 g.moveTo(c +2,c);25 g.lineTo(c +2+0.5,c);59 g.moveTo(cx, cy); 60 g.lineTo(cx+0.5,cy); 26 61 } 27 62 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)