I'm working on an app with a mainPanel and a couple of popup windows 
that do various things.. one of them allows a user to enter search 
criteria, and then the grid on the main panel is populated with results. 
  The other popup allows a user to select options for dropping the data 
to a file.

The main app contains the following actionscript code:

###################################################################
public var lookupPeopleCriteria:Object;

private function lookupPeople(criteria:Object):void
{
        lookupPeopleCriteria = criteria;
        ro.lookupPeople(criteria);
}

public function generateDrop(colNames:Array):void
{
        Alert.show(colNames.toString(),'OK',Alert.OK);
        Alert.show(lookupPeopleCriteria.toString(),'OK',Alert.OK);
}
###################################################################

lookupPeople() is called when the search criteria window is submitted 
and closed.. the criteria is passed in, and then assigned to the 
lookupPeopleCriteria variable.  The remote service runs fine and the 
grid is populated.

When I open my drop options window, and choose my options, and 
submit/close that window, it callls the generateDrop() function and 
passes in some column names in an array.

the first alert works fine, but the second does not, and generates the 
following error

TypeError: Error #1009: Cannot access a property or method of a null 
object reference.
        at DropOptionsWindow/::generateDrop()
        at DropOptionsWindow/__btnGenerateDrop_click()

I think the problem here is that I don't fully understand how scoping 
works.  I thought that declaring the lookupPeopleCriteria object outside 
of the function as a public variable would cause it to be accessible and 
to remain in memory even after the lookupPeople() function call is 
completed, but apparently, that is not the case.

Rick


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to