• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Trying to create a JPG from the camera and export it as a file.

New Here ,
Mar 06, 2017 Mar 06, 2017

Copy link to clipboard

Copied

I inherited a program that worked in 2012 but no longer works. I tradced the issue to the last line of the following code. I am unsure how to fix it. The purpose of the application is to take a picture from the camera and export it as a jpg and email it.

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

{

  var jpgSource:BitmapData = new BitmapData(540,715);

  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, "_top");

This is the error I get:

SecurityError: Error #3769: Security sandbox violation: Only simple headers can be used with navigateToUrl() or sendToUrl().

                at global/flash.net::navigateToURL()

                at index_2017_fla::MainTimeline/createJPG()[index_2017_fla.MainTimeline::frame1:128]

                at index_2017_fla::MainTimeline/save()[index_2017_fla.MainTimeline::frame1:106]

TOPICS
ActionScript

Views

596

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 13, 2017 Mar 13, 2017

you have to test on the server or change your security settings, Adobe - Flash Player : Settings Manager - Global Security Settings panel

Votes

Translate

Translate
Community Expert ,
Mar 06, 2017 Mar 06, 2017

Copy link to clipboard

Copied

are you testing on the server that contains the php file?

are you using a relative path to the php file?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 13, 2017 Mar 13, 2017

Copy link to clipboard

Copied

I have the PHP file in the directory and what the previous employee did was "var jpgURLRequest:URLRequest = new URLRequest ( serverPath+"jpg_encoder_download.php?name=" + fileName + ".jpg");"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2017 Mar 13, 2017

Copy link to clipboard

Copied

you have to test on the server or change your security settings, Adobe - Flash Player : Settings Manager - Global Security Settings panel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2017 Mar 15, 2017

Copy link to clipboard

Copied

Thanks for the reply, I did both but it still won't save a jpg. I still get the same error.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2017 Mar 15, 2017

Copy link to clipboard

Copied

you tested the file on your server and used a local path to the php?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2017 Mar 17, 2017

Copy link to clipboard

Copied

Here is a link to the full program. It's written for an older version of flash and I can't figure out what broke and what didn't.

import flash.display.Bitmap; import flash.events.MouseEvent; import flash.disp - Pastebin.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2017 Mar 17, 2017

Copy link to clipboard

Copied

there's probably not a coding error.  there's a security issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2017 Mar 17, 2017

Copy link to clipboard

Copied

LATEST

ah, okay. I'll try and look into it more.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 07, 2017 Mar 07, 2017

Copy link to clipboard

Copied

>>

jpgURLLoader.load(jpgURLRequest);

  navigateToURL(jpgURLRequest, "_top");

Why are you using both load and navigateToURL? If you want to post the request and also go to a page you'll need a different request.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 13, 2017 Mar 13, 2017

Copy link to clipboard

Copied

Which request would be needed?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines