1 Reply Latest reply on May 7, 2008 12:02 PM by ntsiii

    Skipping the content of a tag


      I am trying to make a mxml component which will work like the JSP tag SKIP_BODY. In other words, it will take a component and a boolean. When the boolean is set to true it will show the "child" component and when it's false it will remove it.

      For the moment I made something which uses a Box (see the attached code).

      The problem is that I don't want to use a Box or any other layout related component, because my objective is to use my component as a "meta mxml tag" which will manage security access inside my application and thus must not interfere with the layout of the UI components.

      Has someone already done this kind of things ?


        • 1. Re: Skipping the content of a tag
          ntsiii Level 3
          That will be tough. Remember, mxml is just the first step. It gets generated into AS, then compiled into a swf. So you won't really have conditional compilation, but rather conditional renderering.

          You could toggle visible and includeInLayout properties to display or hide a component conditionally. If SecurityChecker just set these based on the bound value, then you would get the effect you want, I believe.

          Also, consider using Repeater to instantiate the components based on a dataProvider. that is not a declaritive solution, but is often used for conditional rendering.

          Or you could do it the hard way and extend UIComponent, and override createChildren()/