Ok, so let's take a step back. I completely understand protect/private/public concept. I think I am was having a problem with the mechanics of what is happening behind the scenes.
I actually just figured out what I need to do. I didn't have the try/catch block in my code, I was using this.hasOwnProperty (event.item.interanEvt) and calling the function if that was true. This resolves to false, which tells me it is returning the public properties. Doing my code in a try/catch works; I can, indeed, reference that private function that is part of the extended MenuBar. Thanks Dominic --- In [email protected], "Gordon Smith" <[EMAIL PROTECTED]> wrote: > > To add to what Alex has said... In AS3, access specifiers such as > 'protected' and 'private' aren't just compile-time concepts, they're > also runtime concepts that are rigorously enforced by the ActionScript > Virtual Machine. If your class makes something private, it is really > inaccessible except by your class. AS3 takes this kind of security issue > as seriously as Java does. > > Gordon Smith > Adobe Flex SDK Team > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Alex Harui > Sent: Tuesday, February 26, 2008 9:52 AM > To: [email protected] > Subject: RE: [flexcoders] referencing a private function > > > > You have to make a reference to the function public. Private means just > that: can't be called from the outside. > > I would recommend having the renderers attach listeners to the MenuBar > instead. > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Dominic Pazula > Sent: Tuesday, February 26, 2008 9:32 AM > To: [email protected] > Subject: [flexcoders] referencing a private function > > I have a component extending MenuBar whose data provider provides the > internal handler for the itemClick. I have a generic function that > checks the MenuEvent for the needed property and then trys to call > the function it specifies. > > Specifically > > <mx:MenuBar xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> " > itemClick="internalClick(event)"> > <mx:Script> > <![CDATA[ > private function internalClick(event:MenuEvent):void{ > if (event.item.hasOwnProperty("internalEvt")){ > try{ > this[event.item.internalEvt]() > } > catch(e:Error){ > > } > } > } > > ... > > Now this works well as long as the specified function is public. > However, I don't want all of these functions to be public. How can I > reference and call a private function dynamically? > > Thanks > Dominic >

