Skip to main content
CodeDeveloperOM
Inspiring
April 12, 2021
Question

'FileReference' is undefined + HTML5canvas

  • April 12, 2021
  • 2 replies
  • 693 views

 

 

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);
}
This topic has been closed for replies.

2 replies

Participant
April 13, 2021

an important question?

Legend
April 12, 2021

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

CodeDeveloperOM
Inspiring
April 12, 2021

@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?

 

Legend
April 13, 2021

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.