Copy link to clipboard
Copied
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);
}
Copy link to clipboard
Copied
Yes, ActionScript 3 code isn't going to work in Canvas documents.
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?
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.
Copy link to clipboard
Copied
Is there a list of commands that it does not support ?
What are the commands that help me with this code ?
Copy link to clipboard
Copied
AS3 APIs supported in Canvas documents: None of them.
Javascript APIs supported in Canvas documents: All of them.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
an important question?