mirror of
https://github.com/scratchfoundation/scratch-flash.git
synced 2024-12-04 21:21:06 -05:00
Fixed variables named "---" not appearing in menus
This commit is contained in:
parent
9be7d2e86e
commit
35319a54d3
2 changed files with 6 additions and 5 deletions
|
@ -44,6 +44,7 @@ public class Menu extends Sprite {
|
|||
public var minWidth:int;
|
||||
public var itemHeight:int;
|
||||
|
||||
public static var line:Object = new Object;
|
||||
private static var menuJustCreated:Boolean;
|
||||
|
||||
private var menuName:String = '';
|
||||
|
@ -61,7 +62,7 @@ public class Menu extends Sprite {
|
|||
this.itemHeight = itemHeight;
|
||||
}
|
||||
|
||||
public function addItem(label:String, value:* = null, enabled:Boolean = true, checkmark:Boolean = false):void {
|
||||
public function addItem(label:*, value:* = null, enabled:Boolean = true, checkmark:Boolean = false):void {
|
||||
var last:MenuItem = allItems.length ? allItems[allItems.length-1] : null;
|
||||
var newItem:MenuItem = new MenuItem(this, label, value, enabled);
|
||||
if ((!last || last.isLine()) && newItem.isLine()) return;
|
||||
|
@ -70,7 +71,7 @@ public class Menu extends Sprite {
|
|||
}
|
||||
|
||||
public function addLine():void {
|
||||
addItem('---');
|
||||
addItem(line);
|
||||
}
|
||||
|
||||
public function showOnStage(stage:Stage, x:int = -1, y:int = -1):void {
|
||||
|
|
|
@ -44,13 +44,13 @@ public class MenuItem extends Sprite {
|
|||
private var base:Shape;
|
||||
private var w:int, h:int;
|
||||
|
||||
public function MenuItem(menu:Menu, labelText:String, selection:*, enabled:Boolean) {
|
||||
public function MenuItem(menu:Menu, labelText:*, selection:*, enabled:Boolean) {
|
||||
this.menu = menu;
|
||||
this.selection = (selection == null) ? labelText : selection;
|
||||
addChild(base = new Shape());
|
||||
if (labelText == '---') return;
|
||||
if (labelText == Menu.line) return;
|
||||
addCheckmark();
|
||||
addLabel(labelText, enabled);
|
||||
addLabel(String(labelText), enabled);
|
||||
setBaseColor(menu.color);
|
||||
if (enabled) {
|
||||
addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
|
||||
|
|
Loading…
Reference in a new issue