Flex 4 error: declaration must be contained within the <Declarations> tag
I was messing with the RemoteObject tags in Flex 4 and got the following error that is fairly straight forward, but I thought it was worth blogging since it’s a change from Flex 3.
declaration must be contained within the tag since it does not implement mx.core.IUIComponent.
In Flex 4 there are some changes to how you can place tags in your application. We’ve got a new Declarations tag which is similar to the Script. In Flex 4, that’s where everything that isn’t some kind of UI component goes. IUIComponent extends basically everything that renders on the screen. Anything that doesn’t, things like RemoteObject or HTTPService. Currently it doesn’t look like other classes, like ArrayCollection or the filters have to be in that Declarations tag.
Posted in Flex








November 5th, 2008 at 5:51 pm
Its important to note that visual elements that are not UIComponents (ie: the new graphic elements in Gumbo like Rect, Ellipse, etc) can live in a Flex 3 Application, but must be wrapped in a Group. If you don’t do this, you’ll get the error you mention above.
January 13th, 2010 at 9:14 am
<fx:Declarations>
<!– Place non-visual elements (e.g., services, value objects) here –>
<s:RemoteObject
id="service"
destination="helloAction"
/>
</fx:Declarations>