Re: [flexcoders] Re: Flex - BlazeDS - Java: int are set to 0 when they should be kept to NULL.

2009-09-10 Thread Jon Gunnip
David,

The int primitive type in Java and Flex cannot be null.  They both
default to 0.  If you have,

var myInt:int; // ActionScript
int myInt; // Java

then that is the same as initializing myInt to 0.

Jon

On Thu, Sep 10, 2009 at 11:13 AM, whiskerstasters sailorse...@yahoo.com wrote:
 Hi Tom,
 in my BlazeDS Debug, all my int variables are set to 0.
 My flex object variables of type int are pre-set to null and some are not set.

 When debuging Flex, I noticed Flex automatically sets my variables to 0.

 Why does this happen?

 Thank you.

 -David




 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links






Re: [flexcoders] Re: RegExpValidator Not working with code-behind - SOLVED

2009-09-04 Thread Jon Gunnip
Thanks for posting your solution.  By the way, I also was able to get
my regex to work from ActionScript by storing as a String and
similarly escaping the curly braces with a backslash.  The expression
attribute on mx:RegExpValidator is expecting a String, so attempting
to store in ActionScript as RegExp type did not work for me.

So, I think the following should work for you (untested):

public var expression:String =
^(([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])\.)\{3\}([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])$;

and then

mx:RegExpValidator expression={expression} /

Jon

On Mon, Aug 31, 2009 at 4:52 PM, gtb104gtb...@yahoo.com wrote:
 The solution was to declare the regexp in the mxml, escaping the { and } 
 characters.  Once I did that, it worked as expected.

 mx:RegExpValidator id=ipValidator
  expression=/^(([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])\.)\{3\}([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])$/
  source={tiIPAddress}
  property=text
  trigger={tiIPAddress}
  triggerEvent=change
  noMatchError=Invalid IP Address Format./


 Geoff

 --- In flexcoders@yahoogroups.com, Geoffrey gtb...@... wrote:

 Didn't seem to help.

 I changed the String to a RegExp, escaped and didn't escape the {} 
 characters, and also tried with and without the [Bindable] metadata tag.  As 
 long as the regular expression is in the actionscript file, it just doesn't 
 work properly.  Actually, in this instance, nothing ever validates as a 
 valid IP address.

 Geoff

 --- In flexcoders@yahoogroups.com, Ian Thomas ian@ wrote:
 
  Geoff,
     Try:
 
  public var validIPExpression:RegExp =
  /^(([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])\.)\{3\}([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])$/;
 
  instead.
 
  Could be because by directly specifying the expression, the MXML-AS
  parser correctly decides to treat it as a RegExp. But when directly
  binding to the value, binding sees it just as a String.
 
  HTH,
     Ian
 
  On Thu, Aug 13, 2009 at 5:17 PM, Geoffreygtb104@ wrote:
  
  
   We use the code-behind technique to attach AS to MXML. Doing this has 
   caused
   an interesting issue with RegExpValidator. If the regular expression is
   defined in the AS file and contains a quantifier, it causes validation to
   act funky.
  
   In the following example, if you type about 20 zeroes into the IP field 
   it
   goes from invalid, to valid, and back to invalid. Obviously it should be
   invalid after the first zero is typed and stay that way unless a proper 
   IP
   is entered. However, if you take the same regExp string and put it in the
   MXML file it works as expected. Note that escaping or not escaping the { 
   or
   } characters while the string is in the AS file has no effect on the
   validation.
  
   Test.mxml
   -
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
   xmlns:local=*
   minWidth=800 minHeight=600
  
   local:MyComp/
  
   /mx:Application
  
   MyComp.mxml
   ---
   ?xml version=1.0 encoding=utf-8?
   custom:MyCompScript xmlns:mx=http://www.adobe.com/2006/mxml;
   xmlns:custom=*
  
   mx:FormItem id=fiIPAddress
   label=IP Address: 
   required=true
   mx:TextInput id=tiIPAddress/
   /mx:FormItem
  
   mx:RegExpValidator id=ipValidator
   expression={validIPExpression}
   source={tiIPAddress}
   property=text
   trigger={tiIPAddress}
   triggerEvent=change
   noMatchError=Invalid IP Address Format./
  
   !-- works if you use
   expression=^(([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])\.)\{3\}([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])$--
  
   /custom:MyCompScript
  
   MyCompScript.as
   ---
   package
   {
   import mx.containers.Form;
  
   public class MyCompScript extends Form
   {
   [Bindable]
   public var validIPExpression:String =
   ^(([01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\.){3}([01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])$;
   //public var validIPExpression:String =
   ^(([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])\.)\{3\}([01]?[0-9]\{1,2\}|2[0-4][0-9]|25[0-5])$;
   // Neither of the above work
  
   public function MyCompScript()
   {
   super();
   }
   }
   }
  
   Does this seem like a bug, or just a limitation introduced by using the
   code-behind technique?
  
   Thanks,
   Geoff
  
   p.s. Don't know what code-behind is?
   http://learn.adobe.com/wiki/display/Flex/Code+Behind
  
  
 





 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links






Re: [flexcoders] Race conditions when event handlers triggered from different targets

2009-08-30 Thread Jon Gunnip
Great.  The information about how dispatchEvent() works is very helpful, too.

Thanks!
Jon

On Fri, Aug 28, 2009 at 12:16 AM, Gordon Smithgosm...@adobe.com wrote:


 Yes, that is what Alex is saying. Handler B will not begin before handler A
 finishes. Event handlers don't get paused. Furthermore, when you (or the
 Player) calls dispatchEvent(), all the event handlers listening for that
 event execute before dispatchEvent() returns.



 Gordon Smith

 Adobe Flex SDK Team



 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of Jon Gunnip
 Sent: Thursday, August 27, 2009 5:21 PM
 To: flexcoders@yahoogroups.com
 Subject: Re: [flexcoders] Race conditions when event handlers triggered from
 different targets





 Alex,

 Thanks. Just to be clear, are you saying that once event handler A'
 begins executing, another event handler B' will not begin executing
 until A' finishes?

 Even in a single-threaded environment, not knowing how the flash
 player works, it is possible that the player could decide to pause
 an executing event handler to allow another to progress. That would
 create the scenario I am describing.

 Jon

 On Thu, Aug 27, 2009 at 6:54 PM, Alex Haruiaha...@adobe.com wrote:
 Because actionscript is single-threaded, your scenario cannot happen.

 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.
 Blog: http://blogs.adobe.com/aharui


 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of Jon Gunnip
 Sent: Thursday, August 27, 2009 1:49 PM
 To: flexcoders@yahoogroups.com
 Subject: Re: [flexcoders] Race conditions when event handlers triggered
 from different targets

 Thanks, Tracy. I'm not principally concerned with knowing when two
 operations have completed. I'm more concerned about checking the
 status of a global variable in event handler A' and then having that
 variable's value changed by event handler B' before A' is finished
 executing.  In Java you might use a synchronized block for this.  I
 was hoping the flash player might make some guarantees that make a
 concern like this unnecessary, especially since it executes in a
 single thread.

 Are there any resources that describe the internals of the Flash
 player?  Is there a spec like there is for the Java runtime?

 Thanks,
 Jon

 On Thu, Aug 27, 2009 at 12:44 PM, Tracy Spratttr...@nts3rd.com wrote:


 You can't predict order, but you can be assured that there is no parallel
 processing of actionscript code.  I don't know the internals of the flash
 player well enough to say in detail but there are rules that control what
 code is processed when.



 If you need to know that two async processes have completed, use a flag
 or
 dictionary, set a flag value in each handler, and check it in each
 handler.



 Tracy Spratt,

 Lariat Services, development services available

 

 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of Jon Gunnip
 Sent: Thursday, August 27, 2009 10:04 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Race conditions when event handlers triggered from
 different targets





 Hi,

 I have a concern about possible race conditions in our Flex
 application. I've read in Essential ActionScript 3.0 that the Flash
 runtime will not interrupt the execution of an event handler to update
 the screen. I'm wondering if there are any similar guarantees about
 the order in which two event handlers registered with different
 targets are executed. Consider the following:

 User presses button A triggering event handler A'
 In same frame, result returned from HTTPService B, triggering event
 handler
 B'

 If A' starts executing before B', will it run to completion before B'
 starts executing, or could their execution be interleaved?

 Thanks,
 Jon




 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location:
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links





 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location:
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links





 


[flexcoders] Race conditions when event handlers triggered from different targets

2009-08-27 Thread Jon Gunnip
Hi,

I have a concern about possible race conditions in our Flex
application.  I've read in Essential ActionScript 3.0 that the Flash
runtime will not interrupt the execution of an event handler to update
the screen.  I'm wondering if there are any similar guarantees about
the order in which two event handlers registered with different
targets are executed.  Consider the following:

User presses button A triggering event handler A'
In same frame, result returned from HTTPService B, triggering event handler B'

If A' starts executing before B', will it run to completion before B'
starts executing, or could their execution be interleaved?

Thanks,
Jon


Re: [flexcoders] Race conditions when event handlers triggered from different targets

2009-08-27 Thread Jon Gunnip
Thanks, Tracy. I'm not principally concerned with knowing when two
operations have completed. I'm more concerned about checking the
status of a global variable in event handler A' and then having that
variable's value changed by event handler B' before A' is finished
executing.  In Java you might use a synchronized block for this.  I
was hoping the flash player might make some guarantees that make a
concern like this unnecessary, especially since it executes in a
single thread.

Are there any resources that describe the internals of the Flash
player?  Is there a spec like there is for the Java runtime?

Thanks,
Jon

On Thu, Aug 27, 2009 at 12:44 PM, Tracy Spratttr...@nts3rd.com wrote:


 You can’t predict order, but you can be assured that there is no parallel
 processing of actionscript code.  I don’t know the internals of the flash
 player well enough to say in detail but there are rules that control what
 code is processed when.



 If you need to know that two async processes have completed, use a flag or
 dictionary, set a flag value in each handler, and check it in each handler.



 Tracy Spratt,

 Lariat Services, development services available

 

 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of Jon Gunnip
 Sent: Thursday, August 27, 2009 10:04 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Race conditions when event handlers triggered from
 different targets





 Hi,

 I have a concern about possible race conditions in our Flex
 application. I've read in Essential ActionScript 3.0 that the Flash
 runtime will not interrupt the execution of an event handler to update
 the screen. I'm wondering if there are any similar guarantees about
 the order in which two event handlers registered with different
 targets are executed. Consider the following:

 User presses button A triggering event handler A'
 In same frame, result returned from HTTPService B, triggering event handler
 B'

 If A' starts executing before B', will it run to completion before B'
 starts executing, or could their execution be interleaved?

 Thanks,
 Jon

 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: 
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

* To change settings via email:
mailto:flexcoders-dig...@yahoogroups.com 
mailto:flexcoders-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
flexcoders-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



Re: [flexcoders] Race conditions when event handlers triggered from different targets

2009-08-27 Thread Jon Gunnip
Alex,

Thanks.  Just to be clear, are you saying that once event handler A'
begins executing, another event handler B' will not begin executing
until A' finishes?

Even in a single-threaded environment, not knowing how the flash
player works, it is possible that the player could decide to pause
an executing event handler to allow another to progress.  That would
create the scenario I am describing.

Jon

On Thu, Aug 27, 2009 at 6:54 PM, Alex Haruiaha...@adobe.com wrote:
 Because actionscript is single-threaded, your scenario cannot happen.

 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.
 Blog: http://blogs.adobe.com/aharui


 -Original Message-
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
 Behalf Of Jon Gunnip
 Sent: Thursday, August 27, 2009 1:49 PM
 To: flexcoders@yahoogroups.com
 Subject: Re: [flexcoders] Race conditions when event handlers triggered from 
 different targets

 Thanks, Tracy. I'm not principally concerned with knowing when two
 operations have completed. I'm more concerned about checking the
 status of a global variable in event handler A' and then having that
 variable's value changed by event handler B' before A' is finished
 executing.  In Java you might use a synchronized block for this.  I
 was hoping the flash player might make some guarantees that make a
 concern like this unnecessary, especially since it executes in a
 single thread.

 Are there any resources that describe the internals of the Flash
 player?  Is there a spec like there is for the Java runtime?

 Thanks,
 Jon

 On Thu, Aug 27, 2009 at 12:44 PM, Tracy Spratttr...@nts3rd.com wrote:


 You can't predict order, but you can be assured that there is no parallel
 processing of actionscript code.  I don't know the internals of the flash
 player well enough to say in detail but there are rules that control what
 code is processed when.



 If you need to know that two async processes have completed, use a flag or
 dictionary, set a flag value in each handler, and check it in each handler.



 Tracy Spratt,

 Lariat Services, development services available

 

 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of Jon Gunnip
 Sent: Thursday, August 27, 2009 10:04 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Race conditions when event handlers triggered from
 different targets





 Hi,

 I have a concern about possible race conditions in our Flex
 application. I've read in Essential ActionScript 3.0 that the Flash
 runtime will not interrupt the execution of an event handler to update
 the screen. I'm wondering if there are any similar guarantees about
 the order in which two event handlers registered with different
 targets are executed. Consider the following:

 User presses button A triggering event handler A'
 In same frame, result returned from HTTPService B, triggering event handler
 B'

 If A' starts executing before B', will it run to completion before B'
 starts executing, or could their execution be interleaved?

 Thanks,
 Jon




 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links





 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location: 
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives: 
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links






Re: [flexcoders] Data binding inside Repeater?

2009-08-14 Thread Jon Gunnip
I was looking into a problem similar to this a few days ago.  I
noticed in the Repeater.as framework code, that it ignores changes to
the dataProvider collection that are of type
CollectionEventKind.UPDATE.  Thus, if you modify an item in the
underlying data provider, the repeater will not update.  If you
add/remove an item, it will update.

Jon

On Fri, Aug 14, 2009 at 2:54 AM, Roman Protsiukroman.prots...@gmail.com wrote:


 And what if Object would not be generic Object but rather class
 DataProviderContainer { [Bindable]public var dataProvider:ArrayCollection;}
 I assume your dynamic property dataProvider on Object is not bindable.

 Roman Protsiuk
 Software Engineer/Engineering Team Lead

 http://under.in.ua

 Kyiv, Ukraine (GMT+2)
 mobile: +38 097 321 56 54 email: roman.prots...@gmail.com skype: roman.protsiuk
 linkedin: http://www.linkedin.com/in/romanpv blogspot: http://roma-ch.blogspot.com

 On Fri, Aug 14, 2009 at 12:53 AM, gmbroth gmbr...@hotmail.com wrote:



 Hi,

 I'm having a bit of trouble using the following combination of data
 binding and Repeater and could use some enlightenment:

 mx:ArrayCollection id=fred  some data here... /mx:ArrayCollection 

 mx:ArrayCollection id=measurements 
 mx:Object dataProvider={fred} /
 /mx:ArrayCollection

 mx:Repeater id=measurementRepeater dataProvider=measurements 
 my:Chart dataProvider={measurementRepeater.currentItem.dataProvider} /
 /mx:Repeater

 The intention is to have my chart bind to 'fred' via the Repeater
 iteration over measurements, a kind of double-binding, I suppose. My chart
 component does render the initial data in 'fred' but doesn't respond to
 subsequent changes to 'fred', i.e., I'm not getting dynamic binding. But if
 I change the repeater line above to this:

 my:Chart dataProvider={fred} /

 then everything works as expected. Is there a way to do in MXML what I'm
 trying to do above?

 Thanks, Garry