views:

376

answers:

0

I have been having serious trouble making data displayable and updatable using the popupmanager. I have gone back and forth and decided with the approach of placing a titlewindow in a custom component (which everyone recommends) rather than in main application. However, when I do this, since the titlewindow component I created doesn't know the studentsgrid (of my main application which uses a dataservice as dataprovider for my students grid), the data fails to display on the popup. So I decided to create a bindable variable studentsGrid in my component and then reference the component in the main application:

The component:

passTitleWindow.mxml 

[Bindable] public var subjectsGrid:DataGrid;


    <mx:Form x="-12" y="150" id="passView">

    <mx:FormItem label="Age" >
        <s:TextInput id="ageTextInput" text="@{studentsGrid.selectedItem.age}"/>
    </mx:FormItem>
    <mx:FormItem label="Grade">
        <s:TextInput id="gradeTextInput" text="@{studentsGrid.selectedItem.grade}"/>
    </mx:FormItem>
</mx:Form>


 main.mxml
 protected function passForm(evt:MouseEvent):void {

            var popupClass:Class = passTitleWindow as Class;
            var titleWin:* = PopUpManager.createPopUp(DisplayObject(Application.application.parentDocument), popupClass, true) as popupClass;
            PopUpManager.centerPopUp(titleWin);
            titleWin.studentsGrid = studentsGrid;

        } 

This returns the error: "Access of possibly undefined property application through a reference with static type Class.

Thanks for any response.