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

'FileReference' is undefined + HTML5canvas

Engaged ,
Apr 12, 2021 Apr 12, 2021

Copy link to clipboard

Copied

2021-04-12_18-08-13.jpg

 

2021-04-12_18-09-02.jpg

 

var root = this;
var file1 = new FileReference;
var fileLoader1 = new Loader;


function start1(evt) {
	loadImageBtn1.addEventListener("click", showDialog1.bind(this));
}
start1();

function showDialog1(evt) {
	this.file1 = new FileReference;
	var imageFileTypes1 = new FileFilter("Images (*.jpg, *.png, *.gif)", "*.jpg;*.png;*.gif");
	this.file1.browse([imageFileTypes1]);
	file1.addEventListener("select", selectFile1);
}
function selectFile1(evt) {
	file1.addEventListener("complete", loadFile1);
	file1.load();
}
function loadFile1(evt) {

	this.fileLoader1.loadBytes("file1");
	displayImage1();
}
function displayImage1(evt) {
	fileLoader1.height = 156;
	fileLoader1.width = 156;
	fileLoader1.x = 360.25;
	fileLoader1.y = 245.9;
	this.addChild(fileLoader1);
}
TOPICS
Code , Error , How to , Import and export , Missing feature , Other , Performance , Timeline

Views

364

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
LEGEND ,
Apr 12, 2021 Apr 12, 2021

Copy link to clipboard

Copied

Yes, ActionScript 3 code isn't going to work in Canvas documents.

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 ,
Apr 12, 2021 Apr 12, 2021

Copy link to clipboard

Copied

@ClayUUID But I turned it to html5canvas

https://helpx.adobe.com/ca/animate/kb/as-to-html5.html

Since you are an expert, how do you implement it?

 

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
LEGEND ,
Apr 13, 2021 Apr 13, 2021

Copy link to clipboard

Copied

No, you did not turn it into Canvas code. There's no such things as FileReference or FileFilter in Canvas documents. Those are AS3 APIs.

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 ,
Apr 18, 2021 Apr 18, 2021

Copy link to clipboard

Copied

@ClayUUID 

Is there a list of commands that it does not support ?

What are the commands that help me with this code ?

 

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
LEGEND ,
Apr 18, 2021 Apr 18, 2021

Copy link to clipboard

Copied

AS3 APIs supported in Canvas documents: None of them.

Javascript APIs supported in Canvas documents: All of them.

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 ,
Apr 18, 2021 Apr 18, 2021

Copy link to clipboard

Copied

LATEST

 

this.upload_button.addEventListener("click", fl_MouseClickHandler_3.bind(this));

function fl_MouseClickHandler_3() {
var reader = new FileReader();
reader.onload = function (event) {
var dataUri = event.target.result,
context = document.getElementById("mycanvas").getContext("2d"),
img = new Image();

img.onload = function () {
context.drawImage(img, 100, 100);
};
img.src=dataUri;
reader.readAsDataURL('file');
}
}

//////////////

Still not working?

 

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 ,
Apr 13, 2021 Apr 13, 2021

Copy link to clipboard

Copied

an important question?

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