I have tried to extend State (mx.states.State).

package org.test
{
        import mx.states.State; 

        public class MyState extends State
        {
                public function MyState()
                {
                        //TODO: implement function
                        super();
                }
                
                public function myFunction():void{
                        trace("test");
                }
        }
}

Then, I tried to use custom state in application:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
        xmlns:t="org.test.*" layout="absolute"> 
        <mx:states>
                <mx:State id="one" name="start">
                        <mx:AddChild>
                                <mx:Button  label="Hi There!" 
x="144.5" y="97">                                       
                                </mx:Button>                                    
                        </mx:AddChild>
                </mx:State>
                <t:MyState id="two" name="my"> 
                        <mx:AddChild>
                                <mx:Button  label="Me too!" x="144.5" 
y="97">                                 
                                </mx:Button>                                    
                        </mx:AddChild>
                </t:MyState>            
        </mx:states>    
        <mx:Button x="74" y="78" label="Button"/>
</mx:Application>


When I open the Design view, no components in State is shown and I get 
an error:
com.adobe.flexbuilder.mxmlmodel.NonVisualComponentInstance 

Any workarounds for this?

Reply via email to