Hans,

This is a sort of workaround...

In the super class:

1) declare and define the states
private function init(arr:Array) : void
{
        var newState : State;
        var i:int; for(i=0; i<arr.length; i++)
        {
                var id : String = arr[i].data;
                newState = new State();
                newState.name = id;
                states.push(newState);
        }
}

2) getter method
protected function getState(id:String) : State
{
        var i:int; for (i=0; i<states.length; i++)
        {
                var state : mx.states.State = states[i];
                if (id == state.name)
                        return state;
        }
        return null;
}

In the child class:

public function codeMinimizedState() : void
{
        var state : mx.states.State = getState("minimized");
        var p : SetProperty = new SetProperty();
        p.name = ...;
        p.value = ...;
        p.target = ...;
        state.overrides[0] = p;
        ...                     
} 
...

The child class could implement an interface like:

public interface ICodeState
{
        public function codeMinimizedState() : void
        public function codeMaximizedState() : void
        ...
}



I think you're working in Belgium, right? I work not far from you in
Luxembourg.

Regards,

Olivier

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Van De Velde Hans
Sent: Monday, January 15, 2007 5:11 PM
To: '[email protected]'
Subject: RE: [flexcoders] Interface class for states?



Thanks for your reply,
but this is not exactly what I need... :-}
 
What I need is an (exotic) way to force the presence of
certain states in a MXML component.
 
For example we're developing www.belgacom.tv <http://www.belgacom.tv>
in group and 
I want to make sure that everyone extending the "GeneralPortlet" class
implements has at least these states:
 
 <mx:states>
  <mx:State name="minimized">
  </mx:State>
  <mx:State name="maximized">
  </mx:State>
  <mx:State name="normal">
  </mx:State>
  <mx:State name="icon">
  </mx:State>
  <mx:State name="edit">
  </mx:State>  
 </mx:states>
 
Can this be done?
 
 
wkr,
Hans.

 
 

        -----Original Message-----
        From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Webdevotion
        Sent: maandag 15 januari 2007 15:44
        To: [email protected]
        Subject: Re: [flexcoders] Interface class for states?
        
        

        Hey Hans,
        
        Look at this blogpost: 
        http://casario.blogs.com/mmworld/2006/08/implementing_in.html
<http://casario.blogs.com/mmworld/2006/08/implementing_in.html> 
        
        succes ermee ; )
        

 

---------------------

An electronic message is not binding on its sender.

Any message referring to a binding engagement must be confirmed in
writing and duly signed.

---------------------

 


---------------------
An electronic message is not binding on its sender.
Any message referring to a binding engagement must be confirmed in writing and 
duly signed.
---------------------

Reply via email to