I am doing a few more tests with buttons in HTML5.
I noticed that RollOver and RollOut are not detected: is this a bug?
EDIT: I have found another discrepancy between Flash and HTML5.
I have an item (it is the same one I modified to replace the missing hitArea in the beginning):
it is a Sprite containing a gfxContainer: gfxContainer contains a switchable gfx element and an activeArea element.
The structure is like this:
- gfxContainer (mouseEnabled = false, mouseChildren = true)
- gfx (mouseEnabled = false, mouseChildren = false)
- activeArea (mouseEnabled = true, mouseChildren = false)
- gfxContainer must ignore global mouse interactions and care for children only.
- gfx must be totally ignored by mouse interactions
- activeArea must care for global mouse interactions and ignore children specific ones.
I do this to use activeArea shape as hitArea for whatever gfx is in the container, but this works in Flash only: using these settings in HTML5 the item does not detect mouse interactions, it is not interactive at all.
To make this work the exact same way in HTML5 I must set gfxContainer.mouseEnabled = true: it still ignores gfx shape and uses activeArea shape for interactions, but if I use this settings in Flash it uses both gfx and activeArea as hitArea.
To be honest, both Flash and HTML5 behaviours look wrong:
- gfx should be passive whatever I set in its container, but this is not true for Flash.
- gfxContainer.mouseEnabled = true shouldn’t be necessary, but this is not true for HTML5.
Weird situation… am I missing something? For now I have set a conditional compilation
stateContainer.mouseEnabled = false;
stateContainer.mouseEnabled = true;
but I’d like it to be just a temporary fix.