SimpleButton in OpenFl 9.1.0 basically doesn't work

I posted this is a related thread about a bug where SimpleButtons would mysteriously move to top left corner of the screen:

I was finally able to update to OpenFl 9.1.0 and found this SimpleButton bug to still exist. I’ve also discovered some other problems with the implementation of SimpleButtons stored in Flash swf files and building to HTML5.

If a SimpleButton has a textfield and the font for it has not been imbedded, the text doesn’t appear.

If a SimpleButton is made by having a sprite for a background with a static textfield in the middle for a label in the upstate frame, the downstate has its own background and static textfield, and a blank overstate, when the button is displayed, the textfield appears at the top of button, not in the middle. When the cursor is moved over the label, the textfield suddenly moves to it’s proper place.

If the overstate is a copy of the upstate, the label is displayed in the correct position, but when the cursor is moved over the button, the textfield disappears.

If the upstate and downstate are each a Sprite where upstate Sprite has a background and a textfield, and the downfield state has its own sprite contains sprite and textfield, everything works, BUT ONLY if the textfields are static. If they are dynamic, the text is not displayed.

If the upstate and downstate described in previous paragraph have their class defined, UpState and DownState, and the line var testBtn:SimpleButton = new SimpleButton(new UpState(), null, new DownState()); is used to create the button and the button is added to the stage, the button is displayed but even when enabled (testBtn.mouseEnabled = true; testBtn.useHandCursor = true; testBtn.enabled = true), the button is not enabled in any way, clicking it does nothing.

And as I said before, if the button is disabled (testBtn.enabled = false), the unwanted movement of the button occurs.

In OpenFl 8.9.6 and before, the SimpleButton class worked great. But since then it’s become virtual useless. Can someone explain why it hasn’t been fixed in the last 20+ months?

1 Like

Thank you for posting this.
I had been battling this for a few hours.

I confirm your post when I set OpenFL version to 8.9.6 using haxelib, it finally rendered!
But 8.9.6 doesn’t render the elements that use GlowFilter in my SWF properly.

I wish there was an explanation or workaround for this. I can see my SimpleButton and the children in its states when debugging. It is just not rendering.

But then I’m not able to build for HTML5 with 8.9.6 as it said Lime’s latest version isn’t compatible. I tried downgrading lime too and received a lot of errors that I have no clue how to fix.

If you want to downgrade Lime, you may also need to downgrade Haxe. As I recall, only the newest Lime includes fixes to support Haxe 4.2. Older versions of Lime won’t work with Haxe 4.2.

1 Like