7 Replies Latest reply on Jan 6, 2011 10:54 PM by acer1629

    Error in phase of assigniment Action Script

    acer1629 Level 1

      Hello Guys!

      I created the following action script named "sketch.as" :






      import flash.display.Sprite;

      import flash.events.MouseEvent;

      import com.adobe.images.JPGEncoder;



      public class sketch extends Sprite {


      public function sketch():void {

      //this is your documentclass constructor



      stage.addEventListener(MouseEvent.MOUSE_MOVE, moveCursor);



      function moveCursor(event:MouseEvent):void


          pencil.x = event.stageX;

          pencil.y = event.stageY;



      var canvas_mc:MovieClip = new MovieClip()

      addChildAt(canvas_mc, 0);


      function sketch()




      canvas_mc.graphics.drawRect(0, 0, 600, 500);


      canvas_mc.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);

      canvas_mc.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);

      canvas_mc.addEventListener(MouseEvent.MOUSE_MOVE, makeLine);


      function startDrawing(event:MouseEvent):void{

      canvas_mc.graphics.lineStyle(1, 0, 1);

      canvas_mc.graphics.moveTo(mouseX, mouseY);

      canvas_mc.addEventListener(MouseEvent.MOUSE_MOVE, makeLine);


      function stopDrawing(event:MouseEvent):void{

      canvas_mc.removeEventListener(MouseEvent.MOUSE_MOVE, makeLine);


      function makeLine(event:MouseEvent):void{

      canvas_mc.graphics.lineTo(mouseX, mouseY);





      var serverPath:String = "";

      function createJPG(m:MovieClip, q:Number, fileName:String)


      var jpgSource:BitmapData = new BitmapData (m.width, m.height);


      var jpgEncoder:JPGEncoder = new JPGEncoder(q);

      var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

      var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");

      var jpgURLRequest:URLRequest = new URLRequest ( serverPath+"jpg_encoder_download.php?name=" + fileName + ".jpg");


      jpgURLRequest.method = URLRequestMethod.POST;

      jpgURLRequest.data = jpgStream;

      var jpgURLLoader:URLLoader = new URLLoader();


      navigateToURL(jpgURLRequest, "_blank");



      save_btn.addEventListener(MouseEvent.CLICK, saveBtnPress);

      save_btn.addEventListener(MouseEvent.ROLL_OVER, saveBtnOver);

      save_btn.addEventListener(MouseEvent.ROLL_OUT, saveBtnOut);


      function saveBtnPress(e:Event):void


      createJPG(canvas_mc, 90, "sketch");


      function saveBtnOver(e:Event):void



      pencil.visible = false;


      function saveBtnOut(e:Event):void



      pencil.visible = true;









      Lately I created a file .fla in the same root of the file .as naming it "sketch.fla"


      When I try, in the Adobe Flash CS4 Professional screen, to assign to  ".fla" in the properties Publish my action script, the following message appears:


      “A definition for the document class could not be found in the classpath, so one will be automatically generated in tha SWF file upon export.”


      Obviously, it doesn’t function

      Could somebody help me??