Yes, that works for me too, A little googling indicates that you cannot inherit states. So I tried moving the state definitions into the child component which still does not work as shown below. However if I change A.mxml to inherit from s:VGroup the state errors go away (although I get a bunch of new ones because I’m not inheriting from the base class). I could change my base class to an .as definition; but I don’t know if that would help. Any suggestions?
---------------base component _section.mxml--------------------------------------- <s:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:com="components.*" …> … ---------- child component A.mxml--------------------------- <?xml version="1.0" encoding="utf-8"?> <sections:_section xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:com="components.*" xmlns:sections="sections.*" > <s:states> <s:State id="Oct2010" name="Oct2010"/> <s:State id="Oct2011" name="Oct2011"/> <s:State id="Apr2012" name="Apr2012"/> </s:states> … ------------------ compiler error points to the <s:states> line----------------- Description Resource Location Path Type Could not resolve <s:states> to a component implementation. A.mxml line 12 /MdsClientBeta1/src/sections Flex Problem From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tandon, Rishi Sent: Tuesday, February 07, 2012 4:35 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex 3 -> 4 migration and s:States Well I tried your code in flex sdk 4.6 and could not include <mx:states> as it is deprecated. But replacing <ms:states> with <s:states> works like a butter. Please refer to the code below: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <s:states> <s:State id="sparkState1" name="sparkState1" /> <s:State id="sparkState2" name="sparkState2" /> </s:states> <mx:Button includeIn="sparkState1" label="MX Component" /> <mx:Button includeIn="sparkState2" label="MX Component 2" /> </s:Application> Flex 3 states can be used with spark component Please refer to the attach blog: http://blog.benstucki.net/?p=56 Regards, Rishi Tandon ________________________________ From: bu4fred <fred.se...@adventistcare.org> To: flexcoders@yahoogroups.com Sent: Tuesday, February 7, 2012 12:39 AM Subject: [flexcoders] Flex 3 -> 4 migration and s:States I'm migrating a flex 3.0 application to 4.0 (or 4.5, doesn't matter much) and I want to use the new state features of includeIn and excludeFrom. I have a user defined base class in mxml and i inherit from that for my 'working' classes. I have this code in my baseclass <mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:com="components.*" currentState="Oct2010"> <mx:states> <s:State id="Oct2010" name="Oct2010"/> <s:State name="Oct2011"/> <s:State name="Apr2012"/> </mx:states> . . . ------------- working class contains ----------------------------- <mx:FormItem includeIn="Apr2012"> ... </mx:FormItem> ---- and the error is -------------------------------------------- State 'Apr2012' was referenced without being declared. A.mxml line 66 /MdsClientBeta1/src/sections Flex Problem ------------------- comments ------------------------ I tried s:states rather than mx:states but it could not resolve name Must s:states be used only in s: components or can they be used in mx components?