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

    Error in phase of assigniment Action Script

    acer1629

      Hello Guys!

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

       

       

      package

      {

       

      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);

      Mouse.hide();

       

      function moveCursor(event:MouseEvent):void

      {

          pencil.x = event.stageX;

          pencil.y = event.stageY;

      }

       

      var canvas_mc:MovieClip = new MovieClip()

      addChildAt(canvas_mc, 0);

      canvas_mc.swapDepths

      function sketch()

      {

       

      canvas_mc.graphics.beginFill(0xFFFFFF);

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

      canvas_mc.graphics.endFill();

      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);

      }

      sketch();

       

       

      var serverPath:String = "";

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

      {

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

      jpgSource.draw(m);

      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.requestHeaders.push(header);

      jpgURLRequest.method = URLRequestMethod.POST;

      jpgURLRequest.data = jpgStream;

      var jpgURLLoader:URLLoader = new URLLoader();

      //jpgURLLoader.load(jpgURLRequest);

      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

      {

      Mouse.show();

      pencil.visible = false;

      }

      function saveBtnOut(e:Event):void

      {

      Mouse.hide();

      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??