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

import

Community Beginner ,
Aug 13, 2024 Aug 13, 2024

Copy link to clipboard

Copied

Hello everyone
I'm having a problem with my Action, when I try to import (import com.adobe.images.PNGEncoder) nothing appears in the menu, it's empty and then the error appears as shown in the attached image, can someone please help me, what could be happening??
Thank you very much.

 

Error_Adobe.png

TOPICS
ActionScript , Code , Error , Import and export

Views

285

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 ,
Aug 13, 2024 Aug 13, 2024

Copy link to clipboard

Copied

that package is incorrect.  check the as3 api

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 Beginner ,
Aug 13, 2024 Aug 13, 2024

Copy link to clipboard

Copied

Hello friend kosglad
Thank you for your help, I apologize but I have no idea how to solve this problem, I don't even know where to start, where to move, this has never happened to me before.

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 ,
Aug 13, 2024 Aug 13, 2024

Copy link to clipboard

Copied

https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/index.html

 

check the pngencoder package 

 

mx.graphics.codec.PNGEncoder

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 Beginner ,
Aug 14, 2024 Aug 14, 2024

Copy link to clipboard

Copied

Hello friend kglad
Once again, I thank you for your help. I did what you asked me to do. I read everything trying to understand how to solve the problem, but I confess that I could not understand how to solve it. I am not a Flash user with excellent experience like you, just a regular user. I apologize for not understanding how this type of problem works.
I really appreciate your attention.

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 ,
Aug 14, 2024 Aug 14, 2024

Copy link to clipboard

Copied

remove your

 

import com.adobe.images.PNGEncoder;

 

and replace with

 

import mx.graphics.codec.PNGEncoder;

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 Beginner ,
Aug 14, 2024 Aug 14, 2024

Copy link to clipboard

Copied

Hello friend kosglad
I still have the same problem, I think something is missing, my project is to take a photo with the Webcam and save it as a png or jpg, I have done other similar projects and did not have this problem.

 

Problema_2.png

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 ,
Aug 14, 2024 Aug 14, 2024

Copy link to clipboard

Copied

maybe pngencoder is no longer part of the library.

 

you could download it and import it https://github.com/mikechambers/as3corelib/blob/master/src/com/adobe/images/PNGEncoder.as

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 Beginner ,
Aug 14, 2024 Aug 14, 2024

Copy link to clipboard

Copied

Hello, my friend kglad
I really appreciate your help and patience. It really solved the problem. I created a folder next to my project and put the PNGEncoder.as file in it. Then I imported it. It worked perfectly.
However, I have a question. When I save the file, it says "This file type is not supported." Can you tell me if it's still a problem with Flash? Should I change something in my script?
I'm grateful.

 

Captura de tela 2024-08-14 214420.png

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 ,
Aug 14, 2024 Aug 14, 2024

Copy link to clipboard

Copied

Hi.

 

Use the BitmapData's encode method and the PNGEncoderOptions class. Like this:

import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.PNGEncoderOptions;
import flash.geom.Rectangle;
import flash.net.FileReference;
import flash.utils.ByteArray;

function snapshot(target:DisplayObject, fileName:String):void
{
	var bitmapData:BitmapData = new BitmapData(target.width, target.height);
	var byteArray:ByteArray = new ByteArray();
	var fileReference:FileReference;
	
	bitmapData.draw(target);
	bitmapData.encode(new Rectangle(0, 0, bitmapData.width, bitmapData.height), new PNGEncoderOptions(), byteArray);
	fileReference = new FileReference();
	fileReference.save(byteArray, fileName);
}

snapshot(yourContainer, "capture_" + new Date().time + ".png");


Regards,
JC

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 Beginner ,
Aug 14, 2024 Aug 14, 2024

Copy link to clipboard

Copied

Vou tentar isso tambem, apesar que deu certo, apenas quando salvo o arquivo e quando tento abrir, ele diz que "Não tem suporte para este tipo de aquivo", será que ainda é algum tipo de problema com o Flash ??

 

Captura de tela 2024-08-14 214420.png

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 ,
Aug 15, 2024 Aug 15, 2024

Copy link to clipboard

Copied

The code exports a .png but it seems you're opening a .jpg.

 

Make sure the extension is correct.

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 ,
Aug 15, 2024 Aug 15, 2024

Copy link to clipboard

Copied

or you can use JPEGEncoder class (using the same link).

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 Beginner ,
Aug 15, 2024 Aug 15, 2024

Copy link to clipboard

Copied

Hello my friends kglad and JoãoCésar
I managed to solve the problem, it was really the JPGEncoder, the path inside the ".as" needed to be changed too, and soon there was also a problem in the BitString that I already knew how to solve, I changed my code using "ByteArray", then everything worked perfectly.
I owe you a huge thank you for having the patience to help me because it was by following your instructions that I managed to solve it.
I am happy to be able to count on you.
Thank you very much.

 

TESTE1.png

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 ,
Aug 15, 2024 Aug 15, 2024

Copy link to clipboard

Copied

LATEST

good to hear!  and thank you for the update.

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