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

Part 2: Load Image from URL into Dynamic Text Box - goodinson.snapshot

Engaged ,
Feb 17, 2015 Feb 17, 2015

Copy link to clipboard

Copied

I have a flash file where a user can add an image url into a Dynamic Text Box (image_in.text) and the image will now appear in the flash file.

I am using goodinson.snapshot as featured in this article: Saving Flash graphics as image files at runtime | Adobe Developer Connection

This application works fine (graphic is generated and downloaded) only if a user chooses an included graphic in the flash file (loaded externally) or if I declare a url inside the flash file for the load image variable (var image_url:String = "http://website.com/image.jpg";).

However, if a user enters an image url into the Dynamic Text Box (image_in.text), which the flash does successfully load, the download image function no longer works!

Is this a security bug in flash itself? Or am I missing a code tweak somewhere? 

If an FLA that does this already exists somewhere, let me know.

Thanks in advance for your help!

TOPICS
ActionScript

Views

477

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 ,
Feb 17, 2015 Feb 17, 2015

Copy link to clipboard

Copied

RE:  bitmapdata draw method


There are also restrictions on using a loaded bitmap image as the source. A call to the draw() method is successful if the loaded image comes from the same domain as the caller. Also, a cross-domain policy file on the image's server can grant permission to the domain of the SWF content calling the draw() method. In this case, you must set the checkPolicyFile property of a LoaderContext object, and use this object as the context parameter when calling the load() method of the Loader object used to load the image. These restrictions do not apply to AIR content in the application security sandbox.


or use server-side script to load the image so you can circumvent the cross-domain 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
Engaged ,
Feb 23, 2015 Feb 23, 2015

Copy link to clipboard

Copied

LATEST

Thanks for your response!

The image urls are on the same domain as where the swf is.

I don't understand how declaring the variable as the url is different from declaring it from the value of a dynamic text box... it's the same url, but only one method works, shouldn't they both work?

var image_url:String = "http://website.com/image.jpg"; works..

var image_url:String = image_in.text; does not work, even though the value for image_in.text is identical to the one in the example above.

Since they are all on the same domain, this should work, right?

Thanks again.

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