40 likes | 162 Views
Sketch Pad. . 圖層: actions, buttons , bkground. 圖層: bkground. . clear. 圖層: buttons 插入 新增元件 ( 按鈕: button) 插入 新增元件 ( 按鈕: clrbtn). clear. 從元件庫把按鈕 (button, clrbtn) 拉入舞台. 為每個按鈕命名 ( 實體名稱 ) color Red , color Green , color Blue , clrbtn. 修改元件 (button) 之滑鼠滑入圖案為圓形. thickness = 0;
E N D
Sketch Pad 圖層:actions, buttons, bkground 圖層:bkground clear 圖層:buttons 插入新增元件(按鈕:button) 插入新增元件(按鈕:clrbtn) clear 從元件庫把按鈕 (button, clrbtn) 拉入舞台 為每個按鈕命名(實體名稱) colorRed, colorGreen, colorBlue,clrbtn 修改元件 (button) 之滑鼠滑入圖案為圓形
thickness = 0; colour = "0x000000"; pen_mc.startDrag(true); Mouse.hide(); _root.onMouseDown = startDrawing; _root.onMouseUp = stopDrawing; 圖層:actions, 按F9(動作) function startDrawing() { if (_xmouse<455) { _root.lineStyle(thickness, colour); _root.moveTo(_root._xmouse, _root._ymouse); _root.onMouseMove = drawLine; } } function drawLine() { _root.lineTo(this._xmouse, this._ymouse); } function stopDrawing() { delete this.onMouseMove; }
_root.lineStyle(thickness, colour); 實體名稱.onPress colorRed.onPress = function() { colour = "0xFF0000"; } colorGreen.onPress = function() { colour = "0x00FF00"; } colorBlue.onPress = function() { colour = "0x0000FF"; } clrbtn.onPress = function() { _root.clear(); } colorYellow.onPress = function() { colour = "0xFFFF00"; } colorMagenta.onPress = function() { colour = "0xFF00FF"; } colorCyan.onPress = function() { colour = "0x00FFFF"; } colorBlack.onPress = function() { colour = "0x000000"; }
_root.lineStyle(thickness, colour); 圖層:buttons 插入新增元件(按鈕) line0, line3, line6 line0.onPress = function() { thickness = 0; } line3.onPress = function() { thickness = 3; } line6.onPress = function() { thickness = 6; } thickness = 0; colour = "0x000000"; pen_mc.startDrag(true); Mouse.hide(); _root.onMouseDown = startDrawing; _root.onMouseUp = stopDrawing;