[flexcoders] function.apply() and this on instance method

2007-08-28 Thread herrodius
Hi all,

I was wondering if there would be any way of forcing the this
parameter on function.apply() to actually point to the parameter
passed and not to the instance of the class that contains the invoked
method. I read some posts that say it will only work with functions
defined as Function, but unfortunately that doesn't help me any further.

What I want to do is alter the behavior of existing methods at
runtime. For instance, I gave an instance of a class that implements
IResponder, and I would like to execute some code before and after the
invocation of the result and fault methods.

Any ideas are greatly appreciated.

thx,
Christophe



[flexcoders] FlexBuilder issue:Another Flash debugger may be running. Close it to continue.

2007-05-11 Thread herrodius
Hi,

I'm getting an error when trying to debug flex applications in Flex
Builder. Restarting Eclipse has no effect, I actually have to reboot
my computer. The first time after rebooting, debugging works, but each
new attempt fails.

The error messages says: Another Flash debugger may be running. Close
it to continue.

Anyone ran into this? Any solutions? FlexBuilder has worked fine for
about 2 months now, but all of the sudden I get this message.

thx,
Christophe



[flexcoders] Dynamic constructor invocation?

2007-04-06 Thread herrodius
Hi guys,

I'm looking for a way to dynamically invoke a constructor and pass in
arguments. I know this was possible in AS2 with
Function.apply() on the constructor property of an object but I didn't
find anything in AS3.

I found a 1-year old post from Matt Chotin that says it wouldn't be
possible in AS3, but I was kinda hoping it might have magically
changed by now ;-)
http://www.mail-archive.com/flexcoders@yahoogroups.com/msg21919.html

Any tips?

thx,
Christophe



[flexcoders] Re: Dynamic constructor invocation?

2007-04-06 Thread herrodius
Hi Paul,

I'm currently also creating a lightweight IoC container. You can get a
ref to the Class by calling getDefinitionByName(). getClassByName() is
indeed not there.

About the ObjectFactory, do you mean creating wrappers around the
constructor call for every number of arguments? You can always send me
code offlist ([EMAIL PROTECTED]). If you are interested in my
progress I can send you some stuff to.

regards,
Christophe

--- In flexcoders@yahoogroups.com, Paul DeCoursey [EMAIL PROTECTED] wrote:

 
 I was looking into this, because I wanted to do some IoC work in Flex.
  I found one issue, I don't have any reference for getClassByName adn
 cannot compile when trying to use it.  Was it removed?  what's the
 deal there?
 
 Anyway, one solution I had thought of was to use a ObjectFactory of
 sorts.  Then you pass in an array of arguments to a getInstance
 function and it would use the correct call based on the length of the
 array.  It would be more code but it would be hidden away in a factory
 class.  If you need an example let me know.
 
 Paul
 --- In flexcoders@yahoogroups.com, herrodius lists@ wrote:
 
  Hi guys,
  
  I'm looking for a way to dynamically invoke a constructor and pass in
  arguments. I know this was possible in AS2 with
  Function.apply() on the constructor property of an object but I didn't
  find anything in AS3.
  
  I found a 1-year old post from Matt Chotin that says it wouldn't be
  possible in AS3, but I was kinda hoping it might have magically
  changed by now ;-)
  http://www.mail-archive.com/flexcoders@yahoogroups.com/msg21919.html
  
  Any tips?
  
  thx,
  Christophe
 





[flexcoders] [Flexunit] - How to test throwing errors?

2007-01-17 Thread herrodius
Hi all,

sorry for this slightly OT message.

I was wondering what the best way is to test for a method throwing an
error. I have an Account class that takes a number:int and a
name:String as constructor params. If an Account is instantiated with
a null name, I want to throw an Error (IllegalArgumentException).

In my test, I instantiate a new Account with a null name inside a
try/catch and fail immediately after the instantiation. However this
does not seem to work. The fail never executes and the test passes.  
See example:

var errorMessage:String = Account constructor should throw
IllegalArgumentException when passing 'null' name.;
try {
  var a:Account = new Account(100, null);
  fail(errorMessage);
}
catch (e:Error) {}

The only way I can get this to work, is to check if the errorMessage
in the catch block is the same as the error message in my test and
then call fail() again.

var errorMessage:String = Account constructor should throw
IllegalArgumentException when passing 'null' name.;
try {
  var a:Account = new Account(100, null);
  fail(errorMessage);
}
catch(e:Error) {
  if (e.message == errorMessage) {
fail(errorMessage);
  }
}

Seems a bit weird. The fail() in the try block is catched by the catch
block. I thought this worked in AS2? Am I missing out on something or
doing something wrong here?

thx in advance.

regards,
Christophe



[flexcoders] Re: [Flexunit] - How to test throwing errors?

2007-01-17 Thread herrodius
Hi Olivier,

that should indeed be the behavior, but the test also passes if I
remove the throw Error() line in my Account constructor. This is
probably because the fail() in the testcase is directly caught by the
catch block underneath. I used to do it this way in AS2, but it seems
like the try/catch behavior is different in AS3.

Does anyone have any solution for this, or another way of testing
throw statements?

regards,
Christophe

--- In flexcoders@yahoogroups.com, Stembert Olivier (BIL)
[EMAIL PROTECTED] wrote:

 Hi Christophe,
  
 It seems logic the fail() statement is not executed since it follows the
 new Account() statement which throws the exception.
 I'm not sure I understand what you mean...
  
 Regards,
  
 Olivier
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of herrodius
 Sent: Wednesday, January 17, 2007 11:53 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] [Flexunit] - How to test throwing errors?
 
 
 
 Hi all,
 
 sorry for this slightly OT message.
 
 I was wondering what the best way is to test for a method throwing an
 error. I have an Account class that takes a number:int and a
 name:String as constructor params. If an Account is instantiated with
 a null name, I want to throw an Error (IllegalArgumentException).
 
 In my test, I instantiate a new Account with a null name inside a
 try/catch and fail immediately after the instantiation. However this
 does not seem to work. The fail never executes and the test passes. 
 See example:
 
 var errorMessage:String = Account constructor should throw
 IllegalArgumentException when passing 'null' name.;
 try {
 var a:Account = new Account(100, null);
 fail(errorMessage);
 }
 catch (e:Error) {}
 
 The only way I can get this to work, is to check if the errorMessage
 in the catch block is the same as the error message in my test and
 then call fail() again.
 
 var errorMessage:String = Account constructor should throw
 IllegalArgumentException when passing 'null' name.;
 try {
 var a:Account = new Account(100, null);
 fail(errorMessage);
 }
 catch(e:Error) {
 if (e.message == errorMessage) {
 fail(errorMessage);
 }
 }
 
 Seems a bit weird. The fail() in the try block is catched by the catch
 block. I thought this worked in AS2? Am I missing out on something or
 doing something wrong here?
 
 thx in advance.
 
 regards,
 Christophe
 
 
 
  
 
 -
 
 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.
 -





[flexcoders] Re: WebService bug?

2007-01-12 Thread herrodius
Hi Ben,

We are using the 2.0.1 version.

I have just discovered that this problem only occurs when using
collections of objects that are typed to a superclass of the objects.

For instance, I have a class MediaItem. My 2 concrete subclasses are
CD and DVD. A CD has a Tracks property and a DVD has a Actors
property. When I send over a MediaItem array, it is correctly
converted to an ArrayCollection but the Tracks and the Actors
collections in the subclasses of MediaItem are ObjectProxy instances.

To solve this, let's move the Tracks property of the CD class to the
MediaItem superclass. The Tracks property is then also converted to an
ArrayCollection.

Seems like a bug in the deserialisation of the data, what do you and
others think? Should I file a bug and where?

regards,
Christophe

--- In flexcoders@yahoogroups.com, ben.clinkinbeard
[EMAIL PROTECTED] wrote:

 Are you using 2.0.1? There were a handful of WebService
 serialization/deserialization issues resolved, some of which were
 specific to .NET services.
 
 You might also want to check out Darron Schall's ObjectTranslator
 class: http://www.darronschall.com/weblog/archives/000247.cfm.
 
 HTH,
 Ben
 
 
 --- In flexcoders@yahoogroups.com, herrodius lists@ wrote:
 
  Hi all,
  
  we are currently creating a series of webservices to talk to our .Net
  backend system. We are sending over nested value objects which
  sometimes contain nested arrays of objects. When we receive an array
  in Flex, it is mapped to an ArrayCollection. We then have to do the
  actual object mapping manually, which is the way to go I suppose.
  
  But when we send over nested arrays, the first array is converted to
  an ArrayCollection successfully but every other (deeper) array is
  converted to an ObjectProxy in which there is an ArrayCollection that
  contains the actual data of the Array. There seems to be an extra
  object/level that gets created.
  
  An example (debugger output):
  
  result (ObjectProxy)
  - Components (ArrayCollection)
  -- [0] (ObjectProxy)
  -- [1] (ObjectProxy)
  --- Answers (ObjectProxy, should be ArrayCollection)
   GapAnswer (ArrayCollection, does not exist in the original object
  and should not be here)
  - [0]
  - [1]
  
  As you can see there is an Answers property in the second item of
  the Components ArrayCollection. This should be an ArrayCollection
  instead of an ObjectProxy and the GapAnswer property in it should
  not even exist. (GapAnswer is the type of the .Net Answers array -
  GapAnswer[] Answers)
  
  Has anyone run into this before? Could this be a bug in the
  deserialization of the objects?
  
  regards,
  Christophe
 





[flexcoders] WebService bug?

2007-01-11 Thread herrodius
Hi all,

we are currently creating a series of webservices to talk to our .Net
backend system. We are sending over nested value objects which
sometimes contain nested arrays of objects. When we receive an array
in Flex, it is mapped to an ArrayCollection. We then have to do the
actual object mapping manually, which is the way to go I suppose.

But when we send over nested arrays, the first array is converted to
an ArrayCollection successfully but every other (deeper) array is
converted to an ObjectProxy in which there is an ArrayCollection that
contains the actual data of the Array. There seems to be an extra
object/level that gets created.

An example (debugger output):

result (ObjectProxy)
- Components (ArrayCollection)
-- [0] (ObjectProxy)
-- [1] (ObjectProxy)
--- Answers (ObjectProxy, should be ArrayCollection)
 GapAnswer (ArrayCollection, does not exist in the original object
and should not be here)
- [0]
- [1]

As you can see there is an Answers property in the second item of
the Components ArrayCollection. This should be an ArrayCollection
instead of an ObjectProxy and the GapAnswer property in it should
not even exist. (GapAnswer is the type of the .Net Answers array -
GapAnswer[] Answers)

Has anyone run into this before? Could this be a bug in the
deserialization of the objects?

regards,
Christophe



[flexcoders] Cairngorm: Switching between BusinessDelegates

2006-09-12 Thread herrodius
Hi guys,

we are developing an application that has login functionality.
Depending on the context (offline, online, ...) the application runs
in, we would like to switch between local file io and online database
access via remoting or webservices to read and write the user data.

I was thinking were the best place would be to put the switch mechanism.

My thought: We would have a LoginCommand that calls a business
delegate (let's call it AuthenticationDelegate) to talk to the remote
services, web services or the local file system. The command doesnt
create a specific business delegate but gets it from a configured
locater or even a factory that tries to look up the context. The
command receives a IAuthenticationDelegate instance which would be a
specific implementation of WebserviceAuthenticationDelegate,
RemotingAuthenticationDelegate or LocalAuthenticationDelegate.

Does this seem like a good solution to you guys, would you place the
switch elsewhere or is the idea bad altogether?
If it is a good idea, how would the command receive an instance?

thx for your time,
Christophe





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! 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:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

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