Targeting HTML5 - MouseEvent problems

Hello! when I target html5 MouseEvent wont trigger… Here:

package main;

import flash.events.*;
import flash.display.*;
import haxe.Timer;
import haxe.io.Bytes;
import openfl.Assets;
import openfl.display.*;
import openfl.Lib;
import openfl.system.*;
import openfl.ui.*;
import openfl.events.MouseEvent;

class Main extends Sprite 
{
    public var button_mc = Assets.getMovieClip("library:maingallery_mc");
    
    public function new() 
    {
        super();
        
        addChild(button_mc);
        button_mc.addEventListener(MouseEvent.MOUSE_DOWN, button_mc_listener);
        
    }
    
    public function button_mc_listener(event:MouseEvent)
    {
        button_mc.nextFrame();
        
    }
    
}

It adds the button_mc properly but nothing happens when I click it :confused: What am I doing wrong?

I think it is hard to tell without testing the exact SWF you are using, is it a SimpleButton or a MovieClip?

Try importing openfl.events.* rather than flash.events.*

@singmajesty
It is Movieclip, but I’ve also tried Button before I posted about this. Neither of 'em work.

@Calipsoo
Tried, didn’t work.

Tested it now with button_mc.visible = false; that worked at least.

New to Haxe&Openfl so I have no idea if button_mc.nextFrame(); is even supposed to work when targeting HTML5…

It should, but I think the SWF library behaves better when you are animating symbols, rather than having different shapes on multiple keyframes. I’m not sure how your SWF is constructed, but I can say that the SWF library is not perfect, but I’ve used it successfully on multiple complex projects