It IS, or at least was, the case that non-visual components must be at
the root mxml scope.  I will try to find it documented.

 

If the component is non-visual, then it does not matter, functionally
speaking, where in the DOM it goes.

 

Tracy

 

________________________________

From: [email protected] [mailto:[email protected]] On
Behalf Of Rick Winscot
Sent: Friday, December 12, 2008 1:25 PM
To: [email protected]
Subject: Re: [flexcoders] Restrictions on non-visual component placement

 

It's difficult to determine what your problem is without knowing a
little more about what your DetailPopUp does/is. If you post some code
it would be far easier to determine why one context works and another
doesn't. Generally... I wouldn't recommend mingling non-visual and
visual components in mxml. 

Your error basically says that your non-visual component doesn't have an
appropriate interface for the context you are placing it in. e.g. It
should be a IUIComponent.

http://livedocs.adobe.com/flex/201/langref/mx/core/IUIComponent.html
<http://livedocs.adobe.com/flex/201/langref/mx/core/IUIComponent.html> 

Rick Winscot


On 12/12/08 12:49 PM, "Michael Prescott" <[email protected]>
wrote:

        
         
        
        Short version:
        
        I have a non-visual component that I'm trying to declare in a
repeater, but it seems that MXML doesn't allow this.  Is this true?  How
do you get around this, create a visual component to wrap the non-visual
component?
        
        Long version:
        
        I have an ActionScript non-visual component whose declaration
looks like this:
        
        public class DetailPopup extends EventDispatcher implements
IMXMLObject
        
        I've used this successfully inside an inline, MXML item
renderer, like this:
        
         <mx:DataGridColumn>
            <mx:itemRenderer>
              <mx:Component>
                <mx:VBox>
        
                  <!-- a bunch of other stuff, and then my: -->
        
                  <my:DetailPopUp/>
        
                <mx:VBox>
              </mx:Component>
            </mx:itemRenderer>
          </mx:DataGridColumn>
        
        
        Now that I'm switching from a DataGrid to a Grid, the code ought
to look like this:
        
         <mx:GridItem>
            <mx:VBox>
        
              <!-- a bunch of other stuff, and then my: -->
        
        (X)   <my:DetailPopUp/>
        
            <mx:VBox>
          </mx:GridItem>
        
        ..except that I'm getting an error, "Component declarations are
not allowed here. (Note: visual children must implement IUIComponent.)"
        
        After trying out a bunch of scenarios, it looks like non-visual
components can only be declared in the outermost scope of a component or
application.  Is this true?  This is rather awkward, as I need a
DetailPopUp for each griditem.
        
        Any tips would be very helpful!
        
        Michael
         
            

 

Reply via email to