14 Replies Latest reply: Mar 12, 2013 7:53 AM by kglad RSS

    can anyone help me convert actionscript 2.0 to actionscript 3.0 for my interactive sketchpad?

    weston.6 Community Member

      If anyone can get back to me I'd appreciate the help.

       

      I've been working on making an interactive drawing pad but started from a template that was in actionscripts 1&2. but when I converted it to actionscript 3.0  there are errors.

      I don't really understand coding very well and was hoping someone could help me make it work for actionscript 3.0.

       

      Here is the code for actionscript 2.0 (it works perfectly when in the correct format)

       

      lineThickness = 0;

      selectedColor = "0x000000";

      _root.onMouseDown = startDrawing;

      _root.onMouseUp = stopDrawing;

      function startDrawing() {

                if (_xmouse<455) {

                          _root.lineStyle(lineThickness, selectedColor);

                          _root.moveTo(_root._xmouse, _root._ymouse);

                          _root.onMouseMove = drawLine;

                }

      }

      function drawLine() {

                _root.lineTo(this._xmouse, this._ymouse);

      }

      function stopDrawing() {

                delete this.onMouseMove;

      }

      line0.onPress = function() {

                lineThickness = 0;

      };

      line3.onPress = function() {

                lineThickness = 3;

      };

      line6.onPress = function() {

                lineThickness = 6;

      };

      colorRed.onPress = function() {

                selectedColor = "0xFF0000";

      };

      colorGreen.onPress = function() {

                selectedColor = "0x00FF00";

      };

      colorBlue.onPress = function() {

                selectedColor = "0x0000FF";

      };

      colorYellow.onPress = function() {

                selectedColor = "0xFFFF00";

      };

      colorMagenta.onPress = function() {

                selectedColor = "0xFF00FF";

      };

      colorCyan.onPress = function() {

                selectedColor = "0x00FFFF";

      };

      colorBlack.onPress = function() {

                selectedColor = "0x000000";

      };

      eraser_btn.onPress = function() {

      _root.clear();

      };