can somebody please explain to me why my context menu doesn't work?>
the context menu is to be used to show a popup titleWindow with fields
to add a new item.
the same code works in one module and totally does not work in the
other.

code is pasted below please some one help

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
width="100%" height="100%"
xmlns:comp="com.adobe.flex.extras.controls.*" xmlns:local="*">
        <mx:states>
                <mx:State name="addTransporter">
                        <mx:RemoveChild target="{datagrid1}"/>
                        <mx:AddChild relativeTo="{canvas1}" 
position="lastChild">
                                <mx:HBox x="0" y="0" width="100%" height="100%">
                                        <mx:DataGrid width="30%" height="100%" 
id="datagrid0"
doubleClick="currentState=''">
                                                <mx:columns>
                                                <local:CheckBoxHeaderColumn
                                width="23" id="checker" paddingLeft="4"
                                headerRenderer="CheckBoxHeaderRenderer"
                                        itemRenderer="CheckBoxItemRenderer"
                                        dataField="isSelected"/>

                                                        <mx:DataGridColumn 
headerText="Operating Transporters"
dataField="col1"/>

                                                </mx:columns>
                                        </mx:DataGrid>
                                        <mx:TabNavigator width="70%" 
height="100%">

                                            <mx:Canvas label="General 
Information" width="100%"
height="100%" hideEffect="{ZoomDissolveShow}"
showEffect="{ZoomDissolveHide}">
                                                <mx:Label x="10" y="38" 
text="Transporter Name"
fontWeight="normal"/>
                                                <mx:TextInput x="10" y="10" 
id="transporterName"
width="348" text=""/>
                                                <mx:Label x="10" y="93" 
text="RC Number"
fontWeight="normal"/>
                                                <mx:TextInput x="10" y="66" 
id="RcNum0" width="127"/>
                                                <mx:TextInput x="162" y="66" 
id="OrgCode0" width="127"/>
                                                <mx:Label x="162" y="93" 
text="Org Code"
fontWeight="normal"/>
                                                <mx:Label x="10" y="155" 
text="Manager"
fontWeight="normal"/>
                                                <mx:TextInput x="10" y="130" 
id="ContactPerson0"
width="279"/>
                                            </mx:Canvas>

                                            <mx:Canvas label="Contact Details" 
width="100%" height="100%"
id="stateTr" hideEffect="{ZoomDissolveShow}"
showEffect="{ZoomDissolveHide}">
                                                <mx:TextInput x="10" y="99" 
id="Citytr"/>
                                                <mx:Label x="178" y="127" 
text="State"
fontWeight="normal"/>
                                                <mx:TextInput x="10" y="157" 
id="TelephoneTr" width="153"/
>
                                                <mx:TextInput x="171" y="157" 
id="FaxTr" width="153"/>
                                                <mx:TextInput x="10" y="218" 
id="EmailTr" width="392"/>
                                                <mx:Label x="10" y="244" text=" 
Email"
fontWeight="normal"/>
                                                <mx:Label x="10" y="66" 
text="Address "
fontWeight="normal"/>
                                                <mx:Label x="10" y="184" 
text="Telephone"
fontWeight="normal"/>
                                                <mx:Label x="171" y="184" 
text="Fax" fontWeight="normal"/
>
                                                <mx:ComboBox 
fontWeight="normal" selectedIndex="0"
id="StateTr" x="178" y="99" />
                                                <mx:TextArea x="10" y="10" 
width="392" height="53"
id="addressTr"/>
                                                <mx:Label x="10" y="127" 
text="City" fontWeight="normal"/
>
                                            </mx:Canvas>
                                            <mx:Canvas label="Vehicle(s)" 
width="100%" height="100%"
hideEffect="{ZoomDissolveShow}" showEffect="{ZoomDissolveHide}">

                                                    <mx:DataGrid 
id="transporterVehicles" width="100%"
creationComplete="initDGtransporterVehicles()" height="100%">
                                                        <mx:columns>
                                                        
<local:CheckBoxHeaderColumn
                                width="23" id="checker1" paddingLeft="4"
                                headerRenderer="CheckBoxHeaderRenderer"
                                        itemRenderer="CheckBoxItemRenderer"
                                        dataField="isSelected"/>

                                                            <mx:DataGridColumn 
headerText="Vehicle Reg.
No." dataField=""/>
                                                            <mx:DataGridColumn 
headerText="Chasis. No."
dataField=""/>
                                                            <mx:DataGridColumn 
headerText="Manufacturer"
dataField=""/>
                                                            <mx:DataGridColumn 
headerText="Model"
dataField=""/>
                                                            <mx:DataGridColumn 
headerText="Product Type"
dataField=""/>
                                                        </mx:columns>
                                                    </mx:DataGrid>

                                            </mx:Canvas>
                                        </mx:TabNavigator>
                                </mx:HBox>
                        </mx:AddChild>
                </mx:State>
        </mx:states>
        <mx:Script>
                <![CDATA[

                        import mx.managers.PopUpManager;
                 import transporterPopUp;
                  import mx.controls.Alert;
                   import mx.managers.IPopUpManager;
                private var iPopUpManager:IPopUpManager;
                [Bindable] private var cmDGV:ContextMenu;

                        private function initDGtransporterVehicles():void{

                                var cmDGV1:ContextMenuItem = new 
ContextMenuItem("Add
Transporter", true);
                var cmDGV2:ContextMenuItem = new ContextMenuItem("Edit
Transporter", false);
                var cmDGV3:ContextMenuItem = new
ContextMenuItem("Delete Transporter", false);

                                
cmDGV1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
addPefUser);
                                
cmDGV2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
editPefUser);
                                
cmDGV3.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
deletePefUser);

                cmDGV = new ContextMenu();
                removeDefaultDGVItems();
                cmDGV.customItems = [cmDGV1,cmDGV2,cmDGV3];
                                
cmDGV.addEventListener(ContextMenuEvent.MENU_SELECT,
contextMenuDGV_menuSelect);
   }


                        private function removeDefaultDGVItems():void {
            cmDGV.hideBuiltInItems();

            var defaultDGItems:ContextMenuBuiltInItems =
cmDGV.builtInItems;
            defaultDGItems.print = true;

        }

            private function
contextMenuDGV_menuSelect(evt:ContextMenuEvent):void {

             Alert.show("contect menu CLicked");
            }

                public function addPefUser():void

                {
                //Alert.show("hits add user function");
                var newTransporter:transporterVehiclePopUp =
        transporterVehiclePopUp(PopUpManager.createPopUp(this,
                 transporterVehiclePopUp,
                 true));     //instantiate and show the title window

                        newTransporter.title = "Add New Transporter";//built-in 
property
                        newTransporter.mainApp = this;                      
//Reference
to the main app scope

                        PopUpManager.centerPopUp(newTransporter);
                }

                public function editPefUser():void
                {
                        Alert.show("hits function");
//                      var newTransporter:transporterVehiclePopUp =
//        transporterVehiclePopUp(PopUpManager.createPopUp(this,
//                 transporterVehiclePopUp,
//                 true));     //instantiate and show the title window
//
//  newTransporters.title = "Add New Transporter";//built-in property
//  newTransporters.mainApp = this;
  }

            private function
contextDGMenuItemV_menuItemSelect(evt:ContextMenuEvent,selectedItemNow:String=""):void
{
                 // Alert.show("hits first Linker function");
                  addPefUser();
//
            }
                        private function
contextDGMenuItemV2_menuItemSelect(evt:ContextMenuEvent):void {
                // Alert.show("hits first Linker function");
                editPefUser();
//                alert = Alert.show("Property A: " + [EMAIL PROTECTED] +
"\n" + "Property B: " + [EMAIL PROTECTED], [EMAIL PROTECTED], Alert.OK);
            }
                        private function deletePefUser():void {
                Alert.show("Employee Selected is: ");
//                alert = Alert.show("Property A: " + [EMAIL PROTECTED] +
"\n" + "Property B: " + [EMAIL PROTECTED], [EMAIL PROTECTED], Alert.OK);
            }


                ]]>
        </mx:Script>
                <mx:Parallel id="ZoomDissolveShow">
                        <mx:Blur duration="200" blurYFrom="15.0" blurYTo="1.0"/>
                        <mx:Zoom id="myZoomHide" zoomHeightFrom="1.0" 
zoomWidthFrom="1.0"
zoomHeightTo="0.0" zoomWidthTo="0.0"/>
        </mx:Parallel>
        <mx:Parallel id="ZoomDissolveHide">
                        <mx:Zoom id="myZoomShow" zoomHeightFrom="0.0" 
zoomWidthFrom="0.0"
zoomHeightTo="1.0" zoomWidthTo="1.0"/>
                        <mx:Blur duration="200" blurYFrom="15.0" blurYTo="1.0"/>
        </mx:Parallel>
        <mx:Panel width="100%" layout="absolute" height="100%"
id="vehiclePanel" x="0">
                <mx:HDividedBox x="0" y="0" width="100%" height="100%">
                        <mx:Canvas width="30%" height="99%" id="canvas1">
                                <mx:DataGrid x="0" y="0" width="100%" 
height="100%"
id="datagrid1">
                                        <mx:columns>
                                <local:CheckBoxHeaderColumn
                                width="23" id="checker2" paddingLeft="4"
                                headerRenderer="CheckBoxHeaderRenderer"
                                        itemRenderer="CheckBoxItemRenderer"
                                        dataField="isSelected"/>
                                                <mx:DataGridColumn 
headerText="Operating Transporters"
dataField="col1"/>
                                                <mx:DataGridColumn 
headerText="HeadQuarters" dataField="col1"/>
                                        </mx:columns>
                                </mx:DataGrid>
                        </mx:Canvas>
                </mx:HDividedBox>
                <mx:ControlBar>
                        <mx:Button label="New Transporter" id="addMktr1"
icon="@Embed(source='assets/add.png')"
click="currentState='addTransporter'"/>
                        <mx:Button label="Update" id="updateMktr0"
icon="@Embed(source='assets/image_edit.png')" />
                        <mx:Button label="Delete" id="delMktr0" 
icon="@Embed(source='assets/
image_delete.png')" />
                </mx:ControlBar>
        </mx:Panel>

</mx:Module>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to