Skip to main content
Participant
November 21, 2017
Answered

Convert ActionScript in HTML5

  • November 21, 2017
  • 2 replies
  • 672 views

Hi everybody,

Can anybody help me to convert this ActionScript in a HTML5 Script?

Thanks a lot!

btn_Logo.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);
btn_ball01.addEventListener(MouseEvent.MOUSE_OVER, fl_ClickToGoToAndStopAtFrame_2);
btn_ball02.addEventListener(MouseEvent.MOUSE_OVER, fl_ClickToGoToAndStopAtFrame_3);
btn_ball03.addEventListener(MouseEvent.MOUSE_OVER, fl_ClickToGoToAndStopAtFrame_4);
btn_ball04.addEventListener(MouseEvent.MOUSE_OVER, fl_ClickToGoToAndStopAtFrame_5);
btn_ball05.addEventListener(MouseEvent.MOUSE_OVER, fl_ClickToGoToAndStopAtFrame_6);
scene.addEventListener(MouseEvent.MOUSE_OVER, fl_ClickToGoToAndStopAtFrame_1);

function fl_ClickToGoToWebPage(event:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.adobe.com"), "_blank");
}

function fl_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void
{
gotoAndStop(2);
}

function fl_ClickToGoToAndStopAtFrame_3(event:MouseEvent):void
{
gotoAndStop(3);
}

function fl_ClickToGoToAndStopAtFrame_4(event:MouseEvent):void
{
gotoAndStop(4);
}

function fl_ClickToGoToAndStopAtFrame_5(event:MouseEvent):void
{
gotoAndStop(5);
}

function fl_ClickToGoToAndStopAtFrame_6(event:MouseEvent):void
{
gotoAndStop(6);
}

function fl_ClickToGoToAndStopAtFrame_1(event:MouseEvent):void
{
gotoAndStop(1);
}

stop();

    This topic has been closed for replies.
    Correct answer kglad

    stage.enableMouseOver(10);

    this.btn_Logo.addEventListener('mousedown', fl_ClickToGoToWebPage.bind(this));

    this.btn_ball01.addEventListener('mouseover', fl_ClickToGoToAndStopAtFrame_2.bind(this));

    etc

    function fl_ClickToGoToWebPage(event):
    {
    window.open("http://www.adobe.com"), "_blank");
    }

    function fl_ClickToGoToAndStopAtFrame_2(event)
    {
    this.gotoAndStop(1);
    }

    2 replies

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    November 21, 2017

    stage.enableMouseOver(10);

    this.btn_Logo.addEventListener('mousedown', fl_ClickToGoToWebPage.bind(this));

    this.btn_ball01.addEventListener('mouseover', fl_ClickToGoToAndStopAtFrame_2.bind(this));

    etc

    function fl_ClickToGoToWebPage(event):
    {
    window.open("http://www.adobe.com"), "_blank");
    }

    function fl_ClickToGoToAndStopAtFrame_2(event)
    {
    this.gotoAndStop(1);
    }

    Participant
    November 21, 2017

    Thank you

    kglad
    Community Expert
    Community Expert
    November 21, 2017

    you're welcome.

    Colin Holgate
    Inspiring
    November 21, 2017

    When talking to buttons you need to add 'this.' before the button name. For the event part you use strings, like "click" instead of MouseEvent.CLICK. There are no typed variables, so in the function you would say (event) instead of (event:MouseEvent).

    For what types of events there are you should read the documentation. Here's a page that tells you what different event types there are:

    EaselJS Tutorial: Mouse Interaction