jeanroman Posted September 4, 2014 Share Posted September 4, 2014 I am working with Flash PRO CC v. 14.0. to convert my website to HTML5 / javascript I have converted a file to the HTML5 Canvas in Flash CC. I have no experience with javascript. I need help converting this AS3 code to javascript in the HTML5 Canvas file for the CONTACT (mailto:) button This is the Flash AS3 code for the email contact button - prior to convert to HTML5 canvas. When anyone clicked on the CONTACT button It opened a black email form addressed to my email account. This is the original AS3 code that was disabled when converted to HTML5 canvas: //function getLink4(event:MouseEvent):void{ // var request:URLRequest = new URLRequest("mailto:j11@jeanroman.com"); // navigateToURL(request, ""); // //} //contact.addEventListener(MouseEvent.CLICK, getLink4); // THIS code worked - When you click on the CONTACT button It opens a black email form addressed to my email account and this is what I want the JS code to do In attempt to translate the above AS3 code I used the code snippet /HTML5 canvas/ Actions / Click to Go to Web Page That gave me this code. When you click on the CONTACT button It opens a black email form addressed to my email account. The problem with this javascript code is that when you click the contact button it also opens a new blank growers window. I do not want it to open a new blank browser window. I want it to remain on current HOME web page, and just open a blank email addressed to my email name. This is the current Javascript code I am working with: this.contactBtn.addEventListener("click", fl_ClickToGoToWebPage_4); function fl_ClickToGoToWebPage_4() { window.open("mailto:j11@jeanroman.com", ""); } Question: How do I stop it from also opening a blank browser window? How do I keep it on current browser page yet open a blank email addressed to my email account? Any help to end my frustration is greatly appreciated Link to comment Share on other sites More sharing options...
justsomeguy Posted September 4, 2014 Share Posted September 4, 2014 The window.open function opens a new window. If you don't want to do that, then instead of using window.open you probably just want to set the window.location.href property to your mailto link. 1 Link to comment Share on other sites More sharing options...
jeanroman Posted September 4, 2014 Author Share Posted September 4, 2014 Thank You This code seems to work. this.contactBtn.addEventListener("click", myFunction); function myFunction() { var x = location.href; location.href="mailto:someone@example.com" } Link to comment Share on other sites More sharing options...
L8V2L Posted September 7, 2014 Share Posted September 7, 2014 (edited) The window.open function opens a new window. If you don't want to do that, then instead of using window.open you probably just want to set the window.location.href property to your mailto link.:-)... What's mailto? Edited September 7, 2014 by L8V2L Link to comment Share on other sites More sharing options...
Ingolme Posted September 7, 2014 Share Posted September 7, 2014 :-)... What's mailto? Search for it on Google. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now