Set property for States in Flex 4

Posted on July 11, 2010

When you upgrade a project from Flex 3 to Flex 4 (and by the way, if you’re a student, you can have a free license for Flex Builder at, you probably encounter this error if you use States:

Error: State overrides may no longer be explicitly declared.
The legacy states syntax has been deprecated.

So if you used to have something like that:

<mx:State name="mainMenu">
    <mx:SetProperty target="{mainMenuContainer}" name="visible" value="true" />
<mx:Container id="mainMenuContainer"></mx:Container>

It should be this way from now on:

<mx:State name="mainMenu"></mx:State>
<mx:Container id="mainMenuContainer"
    visible="false" visible.mainMenu="true">

Looking forward to the official livedoc for Flex 4 ^^

About the author

Cyril Mazur is a serial web entrepreneur with experience in various fields: online dating, forex & finance, blogging, online advertising... who enjoys building things that people like to use.

Leave the first comment