@@ -170,28 +170,39 @@ class FlxUITypedButton<T:FlxSprite> extends FlxTypedButton<T> implements IFlxUIB
170
170
171
171
_centerLabelOffset = FlxPoint .get (0 , 0 );
172
172
173
- statusAnimations [3 ] = " normal_toggled" ;
174
- statusAnimations [4 ] = " highlight_toggled" ;
175
- statusAnimations [5 ] = " pressed_toggled" ;
176
-
177
173
labelAlphas = [for (i in 0 ... 3 ) 1 ];
178
174
179
175
inputOver = new FlxInput (0 );
180
176
}
181
-
177
+
182
178
override public function graphicLoaded (): Void
183
179
{
184
180
super .graphicLoaded ();
185
-
186
- setupAnimation (" normal_toggled " , 3 );
187
- setupAnimation (" highlight_toggled " , 4 );
188
- setupAnimation (" pressed_toggled " , 5 );
181
+
182
+ setupAnimation (getToggleStatusAnimation ( NORMAL , 3 ) );
183
+ setupAnimation (getToggleStatusAnimation ( HIGHLIGHT , #if FLX_MOUSE 4 #else 3 #end) );
184
+ setupAnimation (getToggleStatusAnimation ( PRESSED , 5 ) );
189
185
190
186
if (_autoCleanup )
191
187
{
192
188
cleanup ();
193
189
}
194
190
}
191
+
192
+ function getToggleStatusAnimation (status : FlxButtonState )
193
+ {
194
+ #if (flixel <= "5.9.0")
195
+ return switch (status )
196
+ {
197
+ case NORMAL : " normal_toggled" ;
198
+ case PRESSED : " pressed_toggled" ;
199
+ case HIGHLIGHT : " highlight_toggled" ;
200
+ case DISABLED : " disabled_toggled" ;
201
+ }
202
+ #else
203
+ return status .toString () + " _toggled" ;
204
+ #end
205
+ }
195
206
196
207
@:access (flixel.addons.ui. FlxUITypedButton )
197
208
public function copyGraphic (other : FlxUITypedButton <FlxSprite >): Void
@@ -311,14 +322,11 @@ class FlxUITypedButton<T:FlxSprite> extends FlxTypedButton<T> implements IFlxUIB
311
322
}
312
323
}
313
324
314
- /**
315
- * Offset the statusAnimations-index by 3 when toggled.
316
- */
317
- override public function updateStatusAnimation (): Void
325
+ override function updateStatusAnimation (): Void
318
326
{
319
327
if (has_toggle && toggled )
320
328
{
321
- animation .play (statusAnimations [ status + 3 ] );
329
+ animation .play (getToggleStatusAnimation ( status ) );
322
330
}
323
331
else
324
332
{
0 commit comments