I've successfully converted a Flash file to HTML using CreateJS but I am having no joy making a symbol a link.
The buttons work perfectly in the flash movie but when converted to JS/HTML5 it seems to fail. Does anyone have a solution?
I've successfully converted a Flash file to HTML using CreateJS but I am having no joy making a symbol a link.
The buttons work perfectly in the flash movie but when converted to JS/HTML5 it seems to fail. Does anyone have a solution?
This is working:
// The "instance" is an instance on the stage in Flash
this.instance.addEventListener("click", function(event) {
window.location = "http://google.com";
})
I tested it on a Flash Canvas with just one frame and one button
Toolkit for CreateJS does not convert ActionScript- you will have to either add a frame script
/* JS
this.onClick = function() {
window.location = "http://google.com";
}
*/
Or find the symbol in your JavaScript and add the listener there.
// The "symbolName" is an instance on the stage in Flash.
exportRoot.symbolName.onClick = function() {
window.location = "http://google.com";
}
You can also create library items yourself and add the listener.
var symbol = new lib.MySybmol();
stage.addChild(symbol);
symbol.onClick = function() {
// etc.
}
Hope that helps.
UPDATE:
The examples in this answer are out of date. The onClick
handlers have been deprecated for some time, and need to be replaced with the EventDispatcher addEventListener()
, or the shortcut on()
methods:
symbol.on("click", function() {
// etc.
});
i added your code just before the script ending . And my image has default bitmap instance for one image . but it does not redirect to google
exportRoot.instance.onClick = function() {
window.location = "http://google.com";
here is the link : http://canvas.byethost11.com/check/check.html