explorers' club

explorations in dev, science, sci-fi, games, and other fun stuff!

Note to Self: Spark State Exclusions

Leave a comment

[Note to Self]

In some cases you may develop a particular UX to have nested state exclusion such as:

<s:Group excludeFrom="default">
    <s:Group excludeFrom="stateB"/>
</s:Group>

Problem

You will encounter this Compile-Time Error:

Component cannot be realized within state ‘default’ because an ancestor is excluded from ‘default’.

The intent being that the outer group is excluded from only one state, however you also want to apply additional exclusions to that group’s children, in this case, the child group ALSO being excluded from “stateB”.  To recap the child group is to be exclude from both “default” and “stateB”.

Solution

You must explicitly define all state exclusions to the nested objects like so:

<s:Group excludeFrom="default">
    <s:Group excludeFrom="default, stateB"/>
</s:Group>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s