RE: [flexcoders] Proper way to ensure components in a different state are created

2010-09-01 Thread flex
If you use includeIn or excludeFrom, then itemCreationPolicy becomes
available and you can set it to immediate - 

 

imageComponent includeIn=State 1 itemCreationPolicy=immediate
id=imcomp /

 

Then in code you could in imcomp.currentState = myDesiredState, even
before State 1 has been used.

 

Hope this helps,

Derek

 

 

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of dorkie dork from dorktown
Sent: Wednesday, September 01, 2010 5:15 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Proper way to ensure components in a different state
are created

 

  

When I try to access components that are in a different state on the
line after I set the current state I get this error,
TypeError: Error #1009: Cannot access a property or method of a null
object reference.

// code
currentState = NOTES;
noteComponent.text = value; // noteComponent exists in NOTES state and
is not created yet

I know this is because of the Flex invalidation cycle and I'm aware I
could use databinding and I know I could use callLater. But if I
needed to create the components immediately for only the state I'm
going to how would I do that?

Custom Component:
Group

states
State 1
State 2
State 3
/states

imageComponent includeIn=State 1/
videoComponent includeIn=State 2/
noteComponent includeIn=State 3/

/Group

JP



 

__ Information from ESET NOD32 Antivirus, version of virus signature
database 5414 (20100901) __

 

The message was checked by ESET NOD32 Antivirus.

 

http://www.eset.com

image001.jpgimage002.jpg

Re: [flexcoders] Proper way to ensure components in a different state are created

2010-09-01 Thread dorkie dork from dorktown
Yeah, I created a test project and itemCreationPolicy immediate and deferred
both work. But in my application only immediate works. It seems like
currentState is deferring creating the components for some odd reason.

On Wed, Sep 1, 2010 at 5:43 AM, f...@guitar-learning.com wrote:



  If you use includeIn or excludeFrom, then itemCreationPolicy becomes
 available and you can set it to “immediate” –



 imageComponent includeIn=State 1 itemCreationPolicy=immediate
 id=”imcomp” /



 Then in code you could in imcomp.currentState = “myDesiredState”, even
 before State 1 has been used.



 Hope this helps,

 Derek





 *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On
 Behalf Of *dorkie dork from dorktown
 *Sent:* Wednesday, September 01, 2010 5:15 AM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] Proper way to ensure components in a different
 state are created





 When I try to access components that are in a different state on the
 line after I set the current state I get this error,
 TypeError: Error #1009: Cannot access a property or method of a null
 object reference.

 // code
 currentState = NOTES;
 noteComponent.text = value; // noteComponent exists in NOTES state and
 is not created yet

 I know this is because of the Flex invalidation cycle and I'm aware I
 could use databinding and I know I could use callLater. But if I
 needed to create the components immediately for only the state I'm
 going to how would I do that?

 Custom Component:
 Group

 states
 State 1
 State 2
 State 3
 /states

 imageComponent includeIn=State 1/
 videoComponent includeIn=State 2/
 noteComponent includeIn=State 3/

 /Group

 JP



 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 5414 (20100901) __



 The message was checked by ESET NOD32 Antivirus.



 http://www.eset.com


 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 5414 (20100901) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com

  



Re: [flexcoders] Proper way to ensure components in a different state are created

2010-09-01 Thread Haykel BEN JEMIA
You could add a bindable var, e.g. noteText, and set the text property in
the mxml tag to {noteText}. Then you only have to assign the value to the
noteText variable.

Le 2010 9 1 10:48, dorkie dork from dorktown 
dorkiedorkfromdorkt...@gmail.com a écrit :
 When I try to access components that are in a different state on the
 line after I set the current state I get this error,
 TypeError: Error #1009: Cannot access a property or method of a null
 object reference.

 // code
 currentState = NOTES;
 noteComponent.text = value; // noteComponent exists in NOTES state and
 is not created yet

 I know this is because of the Flex invalidation cycle and I'm aware I
 could use databinding and I know I could use callLater. But if I
 needed to create the components immediately for only the state I'm
 going to how would I do that?

 Custom Component:
 Group

 states
 State 1
 State 2
 State 3
 /states

 imageComponent includeIn=State 1/
 videoComponent includeIn=State 2/
 noteComponent includeIn=State 3/

 /Group

 JP


Re: [flexcoders] Proper way to ensure components in a different state are created

2010-09-01 Thread dorkie dork from dorktown
Thanks, I'll do that. My main quest was trying to find the equivalent of

createComponentFromDescriptors in Flex 4 spark components. If I find
anything I'll post back.

On Wed, Sep 1, 2010 at 6:19 PM, Haykel BEN JEMIA hayke...@gmail.com wrote:



 You could add a bindable var, e.g. noteText, and set the text property in
 the mxml tag to {noteText}. Then you only have to assign the value to the
 noteText variable.

 Le 2010 9 1 10:48, dorkie dork from dorktown 
 dorkiedorkfromdorkt...@gmail.com a écrit :

  When I try to access components that are in a different state on the
  line after I set the current state I get this error,
  TypeError: Error #1009: Cannot access a property or method of a null
  object reference.
 
  // code
  currentState = NOTES;
  noteComponent.text = value; // noteComponent exists in NOTES state and
  is not created yet
 
  I know this is because of the Flex invalidation cycle and I'm aware I
  could use databinding and I know I could use callLater. But if I
  needed to create the components immediately for only the state I'm
  going to how would I do that?
 
  Custom Component:
  Group
 
  states
  State 1
  State 2
  State 3
  /states
 
  imageComponent includeIn=State 1/
  videoComponent includeIn=State 2/
  noteComponent includeIn=State 3/
 
  /Group
 
  JP

  



Re: [flexcoders] Proper way to ensure components in a different state are created

2010-09-01 Thread dorkie dork from dorktown
Arggh I forgot I have to set certain components visible,

currentState = note;
source = note.text; // databinding
note.visible = true;
border.visible = true;
border.y = note.y;
border.width = note.width;

I think this is impossible in Flex 4. I'm think my only option is to set
every component creation policy to immediate.

On Wed, Sep 1, 2010 at 10:44 PM, dorkie dork from dorktown 
dorkiedorkfromdorkt...@gmail.com wrote:

 Thanks, I'll do that. My main quest was trying to find the equivalent of

 createComponentFromDescriptors in Flex 4 spark components. If I find
 anything I'll post back.


 On Wed, Sep 1, 2010 at 6:19 PM, Haykel BEN JEMIA hayke...@gmail.comwrote:



 You could add a bindable var, e.g. noteText, and set the text property in
 the mxml tag to {noteText}. Then you only have to assign the value to the
 noteText variable.

 Le 2010 9 1 10:48, dorkie dork from dorktown 
 dorkiedorkfromdorkt...@gmail.com a écrit :

  When I try to access components that are in a different state on the
  line after I set the current state I get this error,
  TypeError: Error #1009: Cannot access a property or method of a null
  object reference.
 
  // code
  currentState = NOTES;
  noteComponent.text = value; // noteComponent exists in NOTES state and
  is not created yet
 
  I know this is because of the Flex invalidation cycle and I'm aware I
  could use databinding and I know I could use callLater. But if I
  needed to create the components immediately for only the state I'm
  going to how would I do that?
 
  Custom Component:
  Group
 
  states
  State 1
  State 2
  State 3
  /states
 
  imageComponent includeIn=State 1/
  videoComponent includeIn=State 2/
  noteComponent includeIn=State 3/
 
  /Group
 
  JP