Filed Under (AIR, Chimp, Flex) by jonr on March-5-2009

I have updated my Flex security component called Chimp.  I was working on implementing a suggestion to use the includeInLayout property instead of removing children, and found a number of issues in the process.  I have expanded the sample application to help test the component.  Also, it should give a pretty good picture of how the component works.

Here is what has changed since the last post:

  • Replaced the “remove” action with “removeFromLayout” & “removeChild” actions
    • removeFromLayout: This property use the includeInLayout property to remove components from view.  This is preferred over the ‘removeChild’ action, but will not work in all cases (like TabNavigator tabs).
    • removeChild: This removes the child from the parent.
  • Update the component so it updates the view on any permission changes.  So, it no longer require that permissions are loaded and set before the Chimp is loaded.  The Chimp still needs to be added before the protected components are added because they are tracked with an event listener on the add to stage system event.

Please let me know if anyone else has suggestions on how to improve the component…

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • DZone
  • Digg
  • del.icio.us
  • Reddit
  • Facebook
  • LinkedIn

Comments:

[...] Flex Security Component Updates [...]

[...] Flex Security Component Updates [...]

Brett on October 14th, 2009 at 8:03 am #

Hi Jon,

Great component thanks, by far the most elegant solution to this problem I’ve seen.

I’m having difficulty using it with TabNavigators though (you’ve obviously seen similar issues from your posts).

Taking your example code from google if I add the following line to the metadata:
[Protected(permissions="admin",notInPermissionAction="removeChild",componentId="box3")]
So I’m hiding box3 in addition to box2 when not admin I get an error stating: “The supplied DisplayObject must be a child of the caller.”

Any idea why this is?

Sergio on October 30th, 2009 at 4:14 am #

Hi Jon

First of all, thanks for the component… as Brett said, is by far the easiest and most elegant way to accomplish this I’ve found.

I’m using Mate, and Chimp works perfectly, however, I found a little problem: I cannot remove two Tabs in a TabNavigator. I have somthing like:

[Protected(permissions="admin",notInPermissionAction="removeChild",componentId="comm")]
[Protected(permissions="admin",notInPermissionAction="removeChild",componentId="personaldata")]

where “comm” and “personaldata” are two Tabs in the same TabNavigator. The first in the line dissapears, and comes back when admin logs in, but the second one (it doesn’t matter which one is) does nothing. Any ideas? Is something already known?

Post a comment
Name: 
Email: 
URL: 
Comments: