function goFullScreen() { Stage.displayState = "fullScreen"; } // End of the function function exitFullScreen() { Stage.displayState = "normal"; } // End of the function function menuHandler(obj, menuObj) { if (Stage.displayState == "normal") { menuObj.customItems[0].enabled = true; menuObj.customItems[1].enabled = false; } else { menuObj.customItems[0].enabled = false; menuObj.customItems[1].enabled = true; } // end else if } // End of the function var fullscreenCM = new ContextMenu(menuHandler); fullscreenCM.hideBuiltInItems(); var fs = new ContextMenuItem("Go Full Screen", goFullScreen); fullscreenCM.customItems.push(fs); var xfs = new ContextMenuItem("Exit Full Screen", exitFullScreen); fullscreenCM.customItems.push(xfs); _root.menu = fullscreenCM;
错误提示:没有名为'displayState'的属性
解决方法:
改为以下红字,将.displayState改为["displayState"]:
function goFullScreen() { Stage["displayState"] = "fullScreen"; } // End of the function function exitFullScreen() { Stage["displayState"] = "normal"; } // End of the function function menuHandler(obj, menuObj) { if (Stage["displayState"] == "normal") { menuObj.customItems[0].enabled = true; menuObj.customItems[1].enabled = false; } else { menuObj.customItems[0].enabled = false; menuObj.customItems[1].enabled = true; } // end else if } // End of the function var fullscreenCM = new ContextMenu(menuHandler); fullscreenCM.hideBuiltInItems(); var fs = new ContextMenuItem("Go Full Screen", goFullScreen); fullscreenCM.customItems.push(fs); var xfs = new ContextMenuItem("Exit Full Screen", exitFullScreen); fullscreenCM.customItems.push(xfs); _root.menu = fullscreenCM;
|