I have create a menu but when clicking on menu so that it shows, I get an error on the line because of the line “myMenu.show(null,null)”. See function below:
private function createAndShowmyMenu():void {
myMenu = Menu.createMenu(null, myMenuDataProvider, false);
myMenu.labelField="@label"
myMenu.setStyle("fontSize","10");
//Event Listeners Here
myMenu.show(null,null);
}
The Error is as such:
TypeError: Error #1007: Instantiation attempted on a non-constructor.
at mx.controls.menuClasses::MenuItemRenderer/commitProperties()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\menuClasses\MenuItemRenderer.as:469]
at mx.core::UIComponent/validateProperties()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:7933]
at mx.managers::LayoutManager/validateClient()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:863]
at mx.controls::List/http://www.adobe.com/2006/flex/mx/internal::setupRendererFromData()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\List.as:1706]
at mx.controls::Menu/measureWidthOfItems()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\Menu.as:1322]
at mx.controls::List/commitProperties()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\List.as:906]
at mx.controls::Menu/commitProperties()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\Menu.as:1244]
at mx.core::UIComponent/validateProperties()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:7933]
at mx.managers::LayoutManager/validateClient()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:863]
at mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\PopUpManagerImpl.as:384]
at mx.managers::PopUpManager$/addPopUp()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\PopUpManager.as:193]
at mx.controls::Menu/show()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\Menu.as:1648]
Anyone has an idea with this?
You should really try to read the documentation, debug your code or even look at the sdk code before posting a question.