[flexcoders] Re: Do states and transitions behave differently depending on the context?

2009-01-20 Thread mauricen
Thanks very much!  It looks as though the transition will work - or not -
depending on when it's invoked in the component creation process.
And invoking it at the wrong time (ie as part of initialisation, as I 
did) prevents it from working later, as in your solution.

Transitions seem to have a very steep learning curve.  The solution
for the toy example /still/ doesn't work in my real application!  So
there must be some other inexplicable glitch to be isolated...

--- In flexcoders@yahoogroups.com, Haykel BEN JEMIA hayke...@... wrote:

 I don't know why it's behaving like that, but it seems to work if
you set
 the state after the form item has been created, like this:
 
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 mx:Form
 mx:FormItem label=Type
creationComplete=st.currentState='taskQueue'
 view:SectionTypeControl id=st /
 /mx:FormItem
 /mx:Form
 /mx:Application
 
 Anyone has an explanation?
 
 Haykel Ben Jemia
 
 Allmas
 Web  RIA Development
 http://www.allmas-tn.com
 
 
 
 
 On Mon, Jan 19, 2009 at 5:59 PM, mauricen maur...@...wrote:
 
I have a component which can appear initially in one of two
states, and
  can subsequently be switched between them. When this switch takes
place,
  I want a transition to occur. Here's a tiny model of my component:
 
  mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml;
  mx:states
  mx:State name=state1
  mx:AddChild
  mx:HBox
  mx:Text id=text1 text=t1:/
  mx:Text id=text2 text=t2:/
  /mx:HBox
  /mx:AddChild
  /mx:State
  /mx:states
  mx:transitions
  mx:Transition
  mx:Move targets={[text1, text2]}/
  /mx:Transition
  /mx:transitions
  /mx:Canvas
 
  If I embed this component (call it MyComp) like this:
 
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  view:MyComp currentState=state1/
  /mx:Application
 
  the transition takes place as the component appears, and everything is
  fine. But if I put it inside a FormItem, like this:
 
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  mx:Form
  mx:FormItem label=Type
  view:SectionTypeControl currentState=taskQueue/
  /mx:FormItem
  /mx:Form
  /mx:Application
 
  the transition never takes place and the two labels remain
superimposed.
 
  In fact the problem is a little worse than this. In the toy
  application above, you can replace FormItem by a container like HBox
  and it works again. But in my real app I can't use it inside a Form
  at all. What gives?
 
  Maurice
 
   
 





Re: [flexcoders] Re: Do states and transitions behave differently depending on the context?

2009-01-20 Thread Haykel BEN JEMIA
Why do you need the one state? Is it only to make the transition when the
component is created or do you have other states? What do you want to
achieve exactly? Perhaps there is a better solution!

Haykel Ben Jemia

Allmas
Web  RIA Development
http://www.allmas-tn.com




On Tue, Jan 20, 2009 at 1:42 PM, mauricen maur...@morninglight.co.ukwrote:

   Thanks very much! It looks as though the transition will work - or not -
 depending on when it's invoked in the component creation process.
 And invoking it at the wrong time (ie as part of initialisation, as I
 did) prevents it from working later, as in your solution.

 Transitions seem to have a very steep learning curve. The solution
 for the toy example /still/ doesn't work in my real application! So
 there must be some other inexplicable glitch to be isolated...


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Haykel
 BEN JEMIA hayke...@... wrote:
 
  I don't know why it's behaving like that, but it seems to work if
 you set
  the state after the form item has been created, like this:
 
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
  mx:Form
  mx:FormItem label=Type
 creationComplete=st.currentState='taskQueue'
  view:SectionTypeControl id=st /
  /mx:FormItem
  /mx:Form
  /mx:Application
 
  Anyone has an explanation?
 
  Haykel Ben Jemia
 
  Allmas
  Web  RIA Development
  http://www.allmas-tn.com
 
 
 
 
  On Mon, Jan 19, 2009 at 5:59 PM, mauricen maur...@...wrote:

 
   I have a component which can appear initially in one of two
 states, and
   can subsequently be switched between them. When this switch takes
 place,
   I want a transition to occur. Here's a tiny model of my component:
  
   mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml;
   mx:states
   mx:State name=state1
   mx:AddChild
   mx:HBox
   mx:Text id=text1 text=t1:/
   mx:Text id=text2 text=t2:/
   /mx:HBox
   /mx:AddChild
   /mx:State
   /mx:states
   mx:transitions
   mx:Transition
   mx:Move targets={[text1, text2]}/
   /mx:Transition
   /mx:transitions
   /mx:Canvas
  
   If I embed this component (call it MyComp) like this:
  
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   view:MyComp currentState=state1/
   /mx:Application
  
   the transition takes place as the component appears, and everything is
   fine. But if I put it inside a FormItem, like this:
  
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   mx:Form
   mx:FormItem label=Type
   view:SectionTypeControl currentState=taskQueue/
   /mx:FormItem
   /mx:Form
   /mx:Application
  
   the transition never takes place and the two labels remain
 superimposed.
  
   In fact the problem is a little worse than this. In the toy
   application above, you can replace FormItem by a container like HBox
   and it works again. But in my real app I can't use it inside a Form
   at all. What gives?
  
   Maurice
  
  
  
 

  



[flexcoders] Re: Do states and transitions behave differently depending on the context?

2009-01-20 Thread mauricen
There may well be...

It's part of a dialog for creating or editing Foos.  A Foo can be 
either red or green; green Foos also have a pressure and a temperature, 
which red Foos don't have.  When you're creating a Foo, you can select
one of two radio buttons labelled Red/Green.  You can't edit the 
colour of a Foo once it has been created.  

I'm trying to declutter the creation dialog by having it initially
appear with Red selected.  If the user selects Green, the temperature
and pressure controls slide out - that's what the transition is for.
That transition should be reversible, and repeatable.

When editing an existing Foo, the dialog should appear with Red or
Green selected as appropriate, and disabled.  If it's a green Foo
that's being edited, then the pressure and temperature controls should
be available for editing - that's the problem situation at the moment.

A general comment: transitions between states offer a huge potential
win for UI designers; they should make possible much more complex
interfaces than we would previously have dared to consider, because
they support progressive reveals, as in my example.  But if they're 
really as hard to use as this makes it seem, that win may be an
illusion.  I know they are working on a better language for states in
Gumbo - let's hope it improves the experience of programming transitions
as well.

Maurice

--- In flexcoders@yahoogroups.com, Haykel BEN JEMIA hayke...@... wrote:

 Why do you need the one state? Is it only to make the transition
when the
 component is created or do you have other states? What do you want to
 achieve exactly? Perhaps there is a better solution!
 
 Haykel Ben Jemia
 
 Allmas
 Web  RIA Development
 http://www.allmas-tn.com
 
 
 
 
 On Tue, Jan 20, 2009 at 1:42 PM, mauricen maur...@...wrote:
 
Thanks very much! It looks as though the transition will work -
or not -
  depending on when it's invoked in the component creation process.
  And invoking it at the wrong time (ie as part of initialisation, as I
  did) prevents it from working later, as in your solution.
 
  Transitions seem to have a very steep learning curve. The solution
  for the toy example /still/ doesn't work in my real application! So
  there must be some other inexplicable glitch to be isolated...
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
Haykel
  BEN JEMIA haykelbj@ wrote:
  
   I don't know why it's behaving like that, but it seems to work if
  you set
   the state after the form item has been created, like this:
  
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   mx:Form
   mx:FormItem label=Type
  creationComplete=st.currentState='taskQueue'
   view:SectionTypeControl id=st /
   /mx:FormItem
   /mx:Form
   /mx:Application
  
   Anyone has an explanation?
  
   Haykel Ben Jemia
  
   Allmas
   Web  RIA Development
   http://www.allmas-tn.com
  
  
  
  
   On Mon, Jan 19, 2009 at 5:59 PM, mauricen maurice@wrote:
 
  
I have a component which can appear initially in one of two
  states, and
can subsequently be switched between them. When this switch takes
  place,
I want a transition to occur. Here's a tiny model of my component:
   
mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml;
mx:states
mx:State name=state1
mx:AddChild
mx:HBox
mx:Text id=text1 text=t1:/
mx:Text id=text2 text=t2:/
/mx:HBox
/mx:AddChild
/mx:State
/mx:states
mx:transitions
mx:Transition
mx:Move targets={[text1, text2]}/
/mx:Transition
/mx:transitions
/mx:Canvas
   
If I embed this component (call it MyComp) like this:
   
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
view:MyComp currentState=state1/
/mx:Application
   
the transition takes place as the component appears, and
everything is
fine. But if I put it inside a FormItem, like this:
   
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
mx:Form
mx:FormItem label=Type
view:SectionTypeControl currentState=taskQueue/
/mx:FormItem
/mx:Form
/mx:Application
   
the transition never takes place and the two labels remain
  superimposed.
   
In fact the problem is a little worse than this. In the toy
application above, you can replace FormItem by a container
like HBox
and it works again. But in my real app I can't use it inside a
Form
at all. What gives?
   
Maurice