Re: [flexcoders] **View States Problem**

2008-11-27 Thread Sefi Ninio
Continuing Chet's line of thinking - You might want to create a state
hierarchy so that state1 is based in the base state, and state2 is based on
state1, and in each one refine the view elements per your requirements.

HTH,
Sefi

On Thu, Nov 27, 2008 at 2:56 AM, Chet Haase [EMAIL PROTECTED] wrote:



 States are mutually exclusive: a given component (such as the component
 that contains the states in your code below) can only be in one state at a
 time. States can be derived from each other, but that's essentially just a
 way to inherit property values from one state to the other; they are still
 completely different states. When you set the 'currentState' property, you
 will be put into that state and that state only.



 It's not clear to me what you're trying to accomplish by being in 1 state
 at a time; can you elaborate on the problem you're trying to solve?



 Chet.





 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *malik_robinson
 *Sent:* Wednesday, November 26, 2008 4:46 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] **View States Problem**



 Hi,

 I am using Flex 3

 I am trying to use view states in my Flex application. My code seems
 to work fine when I just have two view states, but when I have 3
 states (including the base state), the screen never displays all 3 at
 the same time. I am displaying these states based on the result of a
 remote call, that part works fine so the remoting part of it is not
 the problem.

 In Flexbuilder 3 if I go into design view, I can traverse through the
 states (base, state2, state3), and the visual displays look correct.

 Anyone have any idea or thoughts?

 Here is my code below:

 mx:states

 mx:State name=state2

 mx:AddChild relativeTo={frm} position=lastChild 

 mx:FormItem label=Select Sub Area:
 mx:ComboBox
 id=cb2
 dataProvider={subAreaAC}
 labelField=state2
 width=216 left=10 top=40 minWidth=150 /
 /mx:FormItem

 /mx:AddChild

 /mx:State

 mx:State name=state3 basedOn=state2

 mx:AddChild relativeTo={frm} position=lastChild 
 mx:FormItem label=Select Sub-Sub Area:
 mx:ComboBox
 id=cb3
 dataProvider={subSubAreaAC}
 labelField=state3
 minWidth=150 /
 /mx:FormItem
 /mx:AddChild

 /mx:State

 /mx:states

 !-- this is basically my base state, this gets showed by default --
 mx:Form id=frm x=10 y=10
 mx:FormItem label=Select a Parent Category:
 mx:ComboBox id=cb1
 labelField=ParentCategory
 width=150 left=10 top=40
 dataProvider={catAC}
 rowCount={catAC.length / 2}
 /
 /mx:FormItem
 /mx:Form





Re: [flexcoders] **View States Problem**

2008-11-27 Thread Paul Andrews
I think it's just a case of the OPs terminology - he expects to see components 
from the base state plus state2 when he switches to state3. I don't think he 
means being in three states at the same time..
  - Original Message - 
  From: Chet Haase 
  To: flexcoders@yahoogroups.com 
  Sent: Thursday, November 27, 2008 12:56 AM
  Subject: RE: [flexcoders] **View States Problem**


   

  States are mutually exclusive: a given component (such as the component that 
contains the states in your code below) can only be in one state at a time. 
States can be derived from each other, but that's essentially just a way to 
inherit property values from one state to the other; they are still completely 
different states. When you set the 'currentState' property, you will be put 
into that state and that state only.

   

  It's not clear to me what you're trying to accomplish by being in 1 state at 
a time; can you elaborate on the problem you're trying to solve?

   

  Chet.

   

   

  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
malik_robinson
  Sent: Wednesday, November 26, 2008 4:46 PM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] **View States Problem**

   

  Hi,

  I am using Flex 3

  I am trying to use view states in my Flex application. My code seems
  to work fine when I just have two view states, but when I have 3
  states (including the base state), the screen never displays all 3 at
  the same time. I am displaying these states based on the result of a
  remote call, that part works fine so the remoting part of it is not
  the problem.

  In Flexbuilder 3 if I go into design view, I can traverse through the
  states (base, state2, state3), and the visual displays look correct.

  Anyone have any idea or thoughts?

  Here is my code below: 

  mx:states

  mx:State name=state2

  mx:AddChild relativeTo={frm} position=lastChild 

  mx:FormItem label=Select Sub Area:
  mx:ComboBox 
  id=cb2
  dataProvider={subAreaAC}
  labelField=state2
  width=216 left=10 top=40 minWidth=150 /
  /mx:FormItem

  /mx:AddChild

  /mx:State

  mx:State name=state3 basedOn=state2

  mx:AddChild relativeTo={frm} position=lastChild 
  mx:FormItem label=Select Sub-Sub Area:
  mx:ComboBox 
  id=cb3 
  dataProvider={subSubAreaAC}
  labelField=state3 
  minWidth=150 /
  /mx:FormItem
  /mx:AddChild

  /mx:State

  /mx:states

  !-- this is basically my base state, this gets showed by default --
  mx:Form id=frm x=10 y=10
  mx:FormItem label=Select a Parent Category:
  mx:ComboBox id=cb1 
  labelField=ParentCategory
  width=150 left=10 top=40 
  dataProvider={catAC} 
  rowCount={catAC.length / 2}
  /
  /mx:FormItem
  /mx:Form


   

RE: [flexcoders] **View States Problem**

2008-11-27 Thread Chet Haase

States are mutually exclusive: a given component (such as the component that 
contains the states in your code below) can only be in one state at a time. 
States can be derived from each other, but that's essentially just a way to 
inherit property values from one state to the other; they are still completely 
different states. When you set the 'currentState' property, you will be put 
into that state and that state only.

It's not clear to me what you're trying to accomplish by being in 1 state at a 
time; can you elaborate on the problem you're trying to solve?

Chet.


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
malik_robinson
Sent: Wednesday, November 26, 2008 4:46 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] **View States Problem**


Hi,

I am using Flex 3

I am trying to use view states in my Flex application. My code seems
to work fine when I just have two view states, but when I have 3
states (including the base state), the screen never displays all 3 at
the same time. I am displaying these states based on the result of a
remote call, that part works fine so the remoting part of it is not
the problem.

In Flexbuilder 3 if I go into design view, I can traverse through the
states (base, state2, state3), and the visual displays look correct.

Anyone have any idea or thoughts?

Here is my code below:

mx:states

mx:State name=state2

mx:AddChild relativeTo={frm} position=lastChild 

mx:FormItem label=Select Sub Area:
mx:ComboBox
id=cb2
dataProvider={subAreaAC}
labelField=state2
width=216 left=10 top=40 minWidth=150 /
/mx:FormItem

/mx:AddChild

/mx:State

mx:State name=state3 basedOn=state2

mx:AddChild relativeTo={frm} position=lastChild 
mx:FormItem label=Select Sub-Sub Area:
mx:ComboBox
id=cb3
dataProvider={subSubAreaAC}
labelField=state3
minWidth=150 /
/mx:FormItem
/mx:AddChild

/mx:State

/mx:states

!-- this is basically my base state, this gets showed by default --
mx:Form id=frm x=10 y=10
mx:FormItem label=Select a Parent Category:
mx:ComboBox id=cb1
labelField=ParentCategory
width=150 left=10 top=40
dataProvider={catAC}
rowCount={catAC.length / 2}
/
/mx:FormItem
/mx:Form



Re: [flexcoders] **View States Problem**

2008-11-27 Thread Paul Andrews

- Original Message - 
From: malik_robinson [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, November 27, 2008 12:46 AM
Subject: [flexcoders] **View States Problem**


 Hi,

 I am using Flex 3

 I am trying to use view states in my Flex application. My code seems
 to work fine when I just have two view states, but when I have 3
 states (including the base state), the screen never displays all 3 at
 the same time. I am displaying these states based on the result of a
 remote call, that part works fine so the remoting part of it is not
 the problem.

 In Flexbuilder 3 if I go into design view, I can traverse through the
 states (base, state2, state3), and the visual displays look correct.

 Anyone have any idea or thoughts?

 Here is my code below:

snip

Hi Malik,

I have amended your code to make it runnable as an example (something you 
should have done).

Basically I have added three buttons to the base state to switch state, 
plus made some stub data providers.

Everything works as expected (in terms of view states anyway), so I don't 
think your problem is related to view states.

Paul

Amended code:
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=vertical

mx:Script

![CDATA[

import mx.collections.ArrayCollection;

[Bindable]

public var subSubAreaAC:ArrayCollection = new ArrayCollection(['E','F']);

[Bindable]

public var subAreaAC:ArrayCollection = new ArrayCollection(['A','B']);

[Bindable]

public var catAC:ArrayCollection = new ArrayCollection(['C','D']);

]]

/mx:Script

mx:states


mx:State name=state2


mx:AddChild relativeTo={frm} position=lastChild 


mx:FormItem label=Select Sub Area:

mx:ComboBox

id=cb2

dataProvider={subAreaAC}

labelField=state2

width=216 left=10 top=40 minWidth=150 /

/mx:FormItem


/mx:AddChild


/mx:State


mx:State name=state3 basedOn=state2


mx:AddChild relativeTo={frm} position=lastChild 

mx:FormItem label=Select Sub-Sub Area:

mx:ComboBox

id=cb3

dataProvider={subSubAreaAC}

labelField=state3

minWidth=150 /

/mx:FormItem

/mx:AddChild


/mx:State


/mx:states




!-- this is basically my base state, this gets showed by default --

mx:HBox

mx:Button label=base state click=currentState=''/

mx:Button label=state2 click=currentState='state2'/

mx:Button label=state3 click=currentState='state3'/

/mx:HBox

mx:Form id=frm x=10 y=10

mx:FormItem label=Select a Parent Category:

mx:ComboBox id=cb1

labelField=ParentCategory

width=150 left=10 top=40

dataProvider={catAC}

rowCount={catAC.length / 2}

/

/mx:FormItem

/mx:Form


/mx:Application



[flexcoders] **View States Problem**

2008-11-26 Thread malik_robinson
Hi,

I am using Flex 3

I am trying to use view states in my Flex application. My code seems
to work fine when I just have two view states, but when I have 3
states (including the base state), the screen never displays all 3 at
the same time. I am displaying these states based on the result of a
remote call, that part works fine so the remoting part of it is not
the problem.

In Flexbuilder 3 if I go into design view, I can traverse through the
states (base, state2, state3), and the visual displays look correct.

Anyone have any idea or thoughts?

Here is my code below:  

mx:states
  
mx:State name=state2

mx:AddChild relativeTo={frm} position=lastChild 

mx:FormItem label=Select Sub Area:
mx:ComboBox 
id=cb2
dataProvider={subAreaAC}
labelField=state2
width=216 left=10 top=40 minWidth=150   /
 /mx:FormItem

/mx:AddChild

  /mx:State

mx:State name=state3 basedOn=state2

mx:AddChild relativeTo={frm} position=lastChild 
mx:FormItem label=Select Sub-Sub Area:
mx:ComboBox 
id=cb3 
dataProvider={subSubAreaAC}
labelField=state3 
minWidth=150 /
/mx:FormItem
/mx:AddChild

/mx:State

/mx:states


!-- this is basically my base state, this gets showed by default --
mx:Form id=frm x=10 y=10
mx:FormItem label=Select a Parent Category:
mx:ComboBox id=cb1 
labelField=ParentCategory
width=150 left=10 top=40 
dataProvider={catAC} 
rowCount={catAC.length / 2}
 /
/mx:FormItem
/mx:Form



[flexcoders] View states problem in beta3

2006-05-26 Thread rama satoskar



hi all,

is there a problem in the following code
?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml 

 !-- The Application class states property defines the view
states. --
 mx:states
 !-- Flex enters the newButton state when you click button b1 --
 mx:State name=newButton
 !-- Add a Button child control to the v1 VBox control. --
 mx:AddChild target={v1}
 mx:Button label=New Button /
 /mx:AddChild
 !-- Disable the Add a Button button to prevent adding
more than
 one button. --
 mx:SetProperty target={b1} name=enabled value=false /
 /mx:State
 /mx:states
 !-- The application's child controls define the base state. --
 mx:VBox id=v1
 mx:Button id=b1 label=Add a Button
click=currentState='newButton'/
 !-- clicking the following button returns Flex to the bas
state. --
 mx:Button label=Remove Added Button click=currentState=''/
 /mx:VBox
/mx:Application

i seem to get a error each time saying:
Error: Cannot add a child that is already parented.













--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











RE: [flexcoders] View states problem in beta3

2006-05-26 Thread Jim Robson










In Beta 3, target is changed to relativeTo:




mx:AddChild relativeTo ={v1}











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of rama satoskar
Sent: Friday, May 26, 2006 9:44 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] View states
problem in beta3





hi all,

is there a problem in the following code
?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml


 !-- The Application class states property defines the
view
states. --
 mx:states
 !-- Flex enters the newButton
state when you click button b1 --
 mx:State
name=newButton
 !-- Add
a Button child control to the v1 VBox control. --

mx:AddChild target={v1}

mx:Button label=New Button /

/mx:AddChild
 !--
Disable the Add a Button button to prevent adding
more than

one button. --

mx:SetProperty target={b1} name=enabled
value=false /
 /mx:State
 /mx:states
 !-- The application's child controls define the base
state. --
 mx:VBox id=v1
 mx:Button id=b1
label=Add a Button
click=currentState='newButton'/
 !-- clicking the following
button returns Flex to the bas
state. --
 mx:Button label=Remove
Added Button click=currentState=''/
 /mx:VBox
/mx:Application

i seem to get a error each time saying:
Error: Cannot add a child that is already parented.















--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.