Copy link to clipboard
Copied
Hello,
I'm new and unfamiliar with the terms so I'm not getting what I need when searching the forum. This is probably a pretty straightforward issue, though. NOTE: I'm using Animate CC to export an HTML5<canvas> final product. (I believe this uses EaselJS)
In my script in Animate, I'm first adding an Event Listener to 'MyInstance'.
stage.MyInstance.addEventListener("click", linkToWebSite.bind(this)); //Adds event listener
Then later in that script, I have a function that is called by that event:
function zoomMilestone( someUrl ) {
//here's where I want to take the 'someUrl' that is coming across and open that URL in a new browser window.
};
What is the code that would go into that function above to open the url in a new window?
Thanks much!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
The default action is that windows you open are in a new window, so you can get away with this (no need to include _blank):
function zoomMilestone( someUrl ) {
window.open(someUrl);
}
One complication is that you can't just redirect people, it needs to come from a user action. Hopefully it will work for your case.
Copy link to clipboard
Copied
Thanks Colin and ClayUUID!
That's simply what I needed.
...I'd appreciate some help with the terminology so I can find that kind of thing on my own:
Isn't "window.open()" Javascript?
I assumed I should be looking at the EasleJS site (EaselJS v0.8.2 API Documentation : EaselJS ) for syntax because I thought my Animate CC draws to the screen using the EaselJS canvas framework. (But I couldn't find anything that worked at that site.)
When I'm looking for some syntax solution that works for my Animate CC + HTML5<canvas> project, should I just search for the Javascript solution?
Thanks again!
Copy link to clipboard
Copied
CreateJS is not a language, it's a library, written in JavaScript. The scripting language in HTML5 Canvas documents is JavaScript. You do audio/visual/event things using the CreateJS library, and everything else using plain vanilla JavaScript.
I don't understand why you keep putting "canvas" in angle brackets when you write it.
Copy link to clipboard
Copied
Thanks ClayUUID. It's starting to make sense now.
You wrote: "I don't understand why you keep putting "canvas" in angle brackets when you write it."
Probably because I don't know what I'm talking about. I was just repeating how someone else referred to the output from Animate CC.
Thanks for helping clarify things.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now