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 5972243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:37:51+00:00 2026-05-22T20:37:51+00:00

I’ve got a sprite object that gets a custom shape loaded into it, that

  • 0

I’ve got a sprite object that gets a custom shape loaded into it, that gets used as a mask so as to cut out a custom shape from an image that is loaded in with a loader object – The loader(loada) and shape(lines) objects are both children of the sprite object – I’ve added code to save out the image from beneath the mask but when the save function is called nothing is saved out, and no errors are thrown.

function save(evt:MouseEvent):void{
    //Create random number from current date/time to name image created
    var imgID:Number= new Date().getTime()
    //Matrix to holder the area to be cropped
    var maskRect = loada.mask.getBounds(lines);
    //Matrix of image to be cropped
    var imgMatrix= loada.mask.transform.matrix;
    //Cropped image
    var myCroppedImage:Bitmap = cropImage(maskRect, imgMatrix, loada.mask.width, loada.mask.height, loada.mask );
    //Get new matrix of cropped image
    var m:Matrix = myCroppedImage.transform.matrix;
    var urlLoader:URLLoader = new URLLoader();
    //Set jpg quality of the image to be export 1-100
    var myEncoder:JPGEncoder = new JPGEncoder(80);
    //Create jpg to be exported
    var jpgSource:BitmapData = new BitmapData (loada.mask.width, loada.mask.height);
    jpgSource.draw(myCroppedImage, m);
    //Create byte array to hold jpg data
    var byteArray:ByteArray = myEncoder.encode(jpgSource);
    var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
    trace(imgID);
    //Send image to the server to be saved
    var saveJPG:URLRequest = new URLRequest("save_image.php?r="+imgID);
    saveJPG.requestHeaders.push(header);
    saveJPG.method = URLRequestMethod.POST;
    saveJPG.data = byteArray; 
    trace(saveJPG);
}

//Crop image
function cropImage( rect, matrix, _width:Number, _height:Number, displayObject:DisplayObject):Bitmap {
    //Create cropped image
    var croppedBitmap:Bitmap = new Bitmap( new BitmapData( _width, _height ), PixelSnapping.ALWAYS, true );
    croppedBitmap.bitmapData.draw(displayObject, matrix , null, null, rect, true );
    return croppedBitmap;
}
  • 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. Editorial Team
    Editorial Team
    2026-05-22T20:37:51+00:00Added an answer on May 22, 2026 at 8:37 pm

    From what you’ve posted here, it looks like you’re not calling the “load” function:

    urlLoader.load(saveJPG);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small

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.