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

  • Home
  • SEARCH
  • 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 136817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:00:30+00:00 2026-05-11T07:00:30+00:00

Here is my new code but it does not render external image, please help.

  • 0

Here is my new code but it does not render external image, please help.

//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);     //addChild(loader);  }  //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-11T07:00:31+00:00Added an answer on May 11, 2026 at 7:00 am

    You need to wait for the image to load before you can draw it:

    public function LoaderExample() {     var loader:Loader = new Loader();     loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleComplete);      var request:URLRequest = new URLRequest('www.foo.com/image.jpg');     loader.load(request); }  public function handleComplete(e:Event):void {     //do stuff with the image here } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code: <%= Html.TextBox(txtId, new { @readonly = readonly })%> But it's
am new here. i have a slight problem; PLease look at the following code
Here is my code: new Loading.LoadTast(ctx) { @Override protected String doInBackground(Integer... params) { Looper.prepare();
New programmer here, I am trying to understand and break down this code below
Here's some code: DirectorySearcher searcher = new DirectorySearcher(); searcher.Filter = (&(objectClass=user)(sAMAccountName= + lstUsers.SelectedItem.Text +
Here's my code: DateTime date1 = new DateTime(byear, bmonth, bday, 0, 0, 0); DateTime
Here is my code Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck.Bind(new IPEndPoint(IPAddress.Any, 0));
here's my code: XmlDocument doc = new XmlDocument(); foreach (string c in colorList) {
Here is my code: chartDialog = new Dialog(item_activity.this); chartDialog.setContentView(R.layout.customlayout); chartDialog.setTitle(Title ); TextView textItemDetailsDialog =
Here's some code: OdbcConnection connection = new OdbcConnection(@DRIVER={MySQL ODBC 5.1 Driver};SERVER= + ip +

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.