Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 128045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:34:22+00:00 2026-05-11T05:34:22+00:00

I had an answer before and it was very helpful, thus I modified my

  • 0

I had an answer before and it was very helpful, thus I modified my code to make it work,however, I’m still in square-1

//load libs import flash.net.*; import flash.geom.Matrix; import flash.display.*; import flash.events.*; import com.adobe.images.JPGEncoder;  function myLoader() {     var loader:Loader = new Loader();     loader.contentLoaderInfo.addEventListener(Event.COMPLETE, sketch);      var request:URLRequest = new URLRequest('http://www.sergiorodriguez.org/images/2008_5_FXD_VividBlack.jpg');     loader.load(request); }  //action for mouse  stage.addEventListener(MouseEvent.MOUSE_MOVE, moveCursor); Mouse.hide();  function moveCursor(event:MouseEvent):void{     pencil.x = event.stageX;     pencil.y = event.stageY; }   var canvas_mc;     canvas_mc = new MovieClip()  addChildAt(canvas_mc,0); canvas_mc.swapDepths  //draw area to sketch function sketch(e:Event):void{     //load bitmap and draw it to memory     var myBitmapData;         myBitmapData = new BitmapData(500, 500);         myBitmapData.draw(e);      //define matrix     var matrix;         matrix = new flash.geom.Matrix();      //start canvas     canvas_mc.graphics.beginBitmapFill(myBitmapData,matrix, true, true);     canvas_mc.graphics.drawRect(0, 0, 500, 500);     canvas_mc.graphics.endFill();      //listening  events     canvas_mc.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);     canvas_mc.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);     canvas_mc.addEventListener(MouseEvent.MOUSE_MOVE, makeLine);     }         //mouse draws on press 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); }  //mouse stops drawing on realese function stopDrawing(event:MouseEvent):void{     canvas_mc.removeEventListener(MouseEvent.MOUSE_MOVE, makeLine); }  //creates lines function makeLine(event:MouseEvent):void{     canvas_mc.graphics.lineTo(mouseX, mouseY);   }  //call function myLoader()  //start to save onto server 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; } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:34:23+00:00Added an answer on May 11, 2026 at 5:34 am

    I’m not sure what the question is, but I assume that you’re trying to paint on the image loaded by the myLoader() function, and that you don’t see the image. In that case, the problem is that you didn’t add the Loader instance to the main sprite as a child. Here’s the fix:

    function myLoader() {     var loader:Loader = new Loader();     loader.contentLoaderInfo.addEventListener(Event.COMPLETE, sketch);      var request:URLRequest = new URLRequest('http://www.sergiorodriguez.org/images/2008_5_FXD_VividBlack.jpg');     loader.load(request);     addChild(loader); } 

    Explanation: the loader will eventually cointain the loaded image, but if you want it displayed, you need to display the loader itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question may have been asked before, but I had trouble finding an answer,
I had asked this question before, but I got no correct answer. So, this
I figured this answer had been asked before, so I searched, but I couldn't
OK, I had asked a similar question before and had got an answer but
I had some code before I moved to Unicode and Delphi 2009 that appended
This answer had me slightly confused. What is a 'select to a temp table'
I had this answer on another post I asked: I believe the VS designer
(Jeopardy-style question, I wish the answer had been online when I had this issue)
I've had a look around for the answer to this, but I only seem
I was looking for an answer for a previous question and had an ingenious

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.