Jump to content
jeanroman

Need help converting this AS3 code to javascript in the HTML5 Canvas file for the CONTACT (mailto:) button

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

Thank You

 

This code seems to work.

 

this.contactBtn.addEventListener("click", myFunction);
function myFunction() {
var x = location.href;
location.href="mailto:someone@example.com"
}

Share this post


Link to post
Share on other sites

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 by L8V2L

Share this post


Link to post
Share on other sites

:-)... What's mailto?

Search for it on Google.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...