[flexcoders] [ANN] Spring ActionScript 1.0 Release Candidate 1
Dear community, I’m pleased to announce that the first release candidate for Spring ActionScript 1.0 is now available. Spring ActionScript is an offshoot of the Java-based Spring Framework written in ActionScript 3. It is targeted for the Flash, Flex and AIR platforms. The framework contains an Inversion of Control Container, APIs for building tailored MVC architectures, extensions for the Cairngorm and PureMVC frameworks and several other utilities. For more info, please see the official announcement at http://www.herrodius.com/blog/273 cheers, Christophe -- Christophe Herreman http://www.herrodius.com http://www.springactionscript.org http://www.as3commons.org
Re: [flexcoders] Passing View to Presentation Model
new PModel(this) should do the trick without casting. This usage is really defeating the purpose of the Presentation Model pattern though. The PM should not know anything about the view it works for. regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.springactionscript.org http://www.as3commons.org 2009/12/16 vikram vikramvmalhotra1...@gmail.com Hello all I need to pass my view to the presentation model I have created for the view. I need to pass the view object in the constructor of presentation model. How can I do that? I tried doing this... public var pmodel:PModel = new PModel( View(this) ); // This gives an undefined View function error. Please help!!! Thanks and Regards ShiVik -- Christophe Herreman http://www.herrodius.com http://www.springactionscript.org http://www.as3commons.org
Re: [SPAM] Re: [flexcoders] var token:AsyncToken = service.[str](); how to get this working?
Try this: var operation:Operation = remoteObject.getOperation(methodName) as Operation; operation.arguments = parameters; var token:AsyncToken = operation.send(); regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.springactionscript.org http://www.as3commons.org 2009/12/17 MicC chigwel...@yahoo.com Thanks Tracy - that dot keeps on getting me :-) ... I get a value is not a function error for service[str]. The code var str:String = 'Sel_all_mgrs' ; var token:AsyncToken = service[str] (); token.addResponder( this.responder) ; is inside a Cairngorm Delegate ... but this should not make a difference, right? (hardcoding var token:AsyncToken = service.Sel_all_mgrs (); works fine. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tracy Spratt tr...@... wrote: The bracket notation replaces the dot notation: var token:AsyncToken = service[str] (); //remove the dot Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of claudiu ursica Sent: Tuesday, December 15, 2009 6:31 AM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: [SPAM] Re: [flexcoders] var token:AsyncToken = service.[str](); how to get this working? It is service.send() at least if your service is a HTTPService instance. C _ From: MicC chigwel...@... To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Sent: Tue, December 15, 2009 1:08:22 PM Subject: [flexcoders] var token:AsyncToken = service.[str](); how to get this working? When used conventionally - var token:AsyncToken = service.Sel_ all_mgrs( ); - this is service.function, right? var str:String = 'Sel_all_mgrs' ; var token:AsyncToken = service.[str] (); token.addResponder( this.responder) ; What is the correct code to get the above working? TIA, Mic. -- Christophe Herreman http://www.herrodius.com http://www.springactionscript.org http://www.as3commons.org
[flexcoders] Spring ActionScript 0.8 Released
Dear Community, I'm pleased to announce that the Spring ActionScript 0.8 release is now available. This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions. For more info, please see the official announcement at http://www.herrodius.com/blog/176 -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
[flexcoders] BlazeDS/ActiveMQ amf-streaming disconnect problem
' is stopping. [BlazeDS]03/11/2009 16:25:47.417 [DEBUG] [Client.MessageClient] MessageClient with clientId '7A98D7BC-F0B3-922C-A968-BE0BFB7D9080' for destination 'eventMessageFeed' has been invalidated. [BlazeDS]03/11/2009 16:25:47.419 [INFO] [Service.Message.JMS] JMS consumer for JMS destination 'java:comp/env/detectorsFlexTopic' is being removed from the JMS adapter [BlazeDS]03/11/2009 16:25:47.423 [INFO] [Service.Message.JMS] JMS consumer for JMS destination 'java:comp/env/detectorsFlexTopic' is stopping. [BlazeDS]03/11/2009 16:25:47.435 [DEBUG] [Client.MessageClient] MessageClient with clientId '7A9BC826-2199-C772-0A1B-FE6FAE9F7402' for destination 'detectorsFeed' has been invalidated. [BlazeDS]03/11/2009 16:25:47.438 [INFO] [Service.Message.JMS] JMS consumer for JMS destination 'java:comp/env/scenariosFlexTopic' is being removed from the JMS adapter [BlazeDS]03/11/2009 16:25:47.438 [INFO] [Service.Message.JMS] JMS consumer for JMS destination 'java:comp/env/scenariosFlexTopic' is stopping. [BlazeDS]03/11/2009 16:25:47.440 [DEBUG] [Client.MessageClient] MessageClient with clientId '7A9BCE40-A0DA-18D6-9FA1-6D6AA2088256' for destination 'scenarioMessageFeed' has been invalidated. [BlazeDS]03/11/2009 16:25:47.441 [DEBUG] [Client.FlexClient] FlexClient with id '7A95FDE9-0091-B1CD-3660-D8E9CD6CD3E6' has been invalidated. [BlazeDS]03/11/2009 16:25:47.441 [DEBUG] [Endpoint.StreamingAMF] Endpoint with id 'my-streaming-amf' is streaming message: Flex Message (flex.messaging.messages.CommandMessage) operation = disconnect clientId = null correlationId = null destination = null messageId = 7ED1C45A-10A7-BFBB-E24E-94B9C03047EE timestamp = 1236785147441 timeToLive = 0 body = null [BlazeDS]03/11/2009 16:25:47.441 [DEBUG] [Endpoint.FlexSession] FlexSession with id '71A76CA22AC435285736F6DB0E38AC11' for an Http-based client connection has been invalidated. [BlazeDS]03/11/2009 16:25:47.444 [DEBUG] [Client.FlexClient] FlexClient with id '7A941468-80E5-8343-A2AE-A3AFFA135734' has been invalidated. [BlazeDS]03/11/2009 16:25:47.444 [DEBUG] [Endpoint.FlexSession] FlexSession with id '1238AA40EF8B016F3942C6D6BDBA29B9' for an Http-based client connection has been invalidated. [BlazeDS]03/11/2009 16:25:47.444 [DEBUG] [Endpoint.StreamingAMF] Streaming thread 'http-8080-1' for endpoint with id 'my-streaming-amf' is releasing connection and returning to the request handler pool. [BlazeDS]03/11/2009 16:25:47.444 [INFO] [Endpoint.FlexSession] Number of streaming clients for FlexSession with id '71A76CA22AC435285736F6DB0E38AC11' is 0. [BlazeDS]03/11/2009 16:25:47.444 [DEBUG] [Endpoint.StreamingAMF] Number of streaming clients for endpoint with id 'my-streaming-amf' is 0. [BlazeDS]03/11/2009 16:25:47.489 [DEBUG] [Endpoint.FlexSession] FlexSession created with id 'E5BCC7617F3937139CCAD377EEB85D45' for an Http-based client connection. [BlazeDS]03/11/2009 16:25:47.489 [INFO] [Endpoint.General] Channel endpoint my-streaming-amf received request. -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
[flexcoders] Flash Player 10 and XML text nodes issue
Hi all, It seems that in FP9, text nodes would have their namespace associated with them. This is what I get in the debugger: value xmlns=http://www.pranaframework.org/objects; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; true /value However, with FP10 the namespace info is gone for text nodes and the xml tags are returned as entities: lt;valuegt;truelt;/valuegt; As a result, calling name() on the node returns null. Has anyone ran into this issue? Is this expected behavior in FP10, since it seems to be causing compatibility issues? regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
[flexcoders] Re: Flash Player 10 and XML text nodes issue
Since I think this is a bug, I posted an issue on the Adobe JIRA: https://bugs.adobe.com/jira/browse/FP-1131 regards, Christophe 2008/12/3 Christophe Herreman [EMAIL PROTECTED] Hi all, It seems that in FP9, text nodes would have their namespace associated with them. This is what I get in the debugger: value xmlns=http://www.pranaframework.org/objects; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; true /value However, with FP10 the namespace info is gone for text nodes and the xml tags are returned as entities: lt;valuegt;truelt;/valuegt; As a result, calling name() on the node returns null. Has anyone ran into this issue? Is this expected behavior in FP10, since it seems to be causing compatibility issues? regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
[flexcoders] Problem consuming ActiveMQ messages from Flex client
Hi, I am unable to consume messages sent via ActiveMQ from my Flex client. Sending messages via the Producer seems to work, I can also see that the Flex client is connected and subscribed via the properties on the Consumer object, however the message event on the Consumer is never fired so it seems like the messages are not received. When I look in the ActiveMQ console, I can see the number of subscribers, the number of messages sent and the number of messages received. The strange thing is that the received messages counter seems to increment and that I can also trace the log statements in the Tomcat console, but again no messages are received in the Flex client. Any ideas? -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Re: Problem consuming ActiveMQ messages from Flex client
Hi George, I'll take a look at the STOMP client. However I'm still wondering why this seems to fail. Do you need to setup the policy only with STOMP? Is it also need when running ActiveMQ, Tomcat and the flex client on the same machine? 2008/9/19 George [EMAIL PROTECTED] I use ActiveMQ and it works just fine. Although, I use the STOMP client, and you need to make sure that you have a flash policy server set up to allow the socket connection to the message server. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Christophe Herreman [EMAIL PROTECTED] wrote: Hi, I am unable to consume messages sent via ActiveMQ from my Flex client. Sending messages via the Producer seems to work, I can also see that the Flex client is connected and subscribed via the properties on the Consumer object, however the message event on the Consumer is never fired so it seems like the messages are not received. When I look in the ActiveMQ console, I can see the number of subscribers, the number of messages sent and the number of messages received. The strange thing is that the received messages counter seems to increment and that I can also trace the log statements in the Tomcat console, but again no messages are received in the Flex client. Any ideas? -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Re: Problem consuming ActiveMQ messages from Flex client
After rebuilding my app from scratch with a fresh install of Tomcat, everything seems to work. Maybe this was caused by the fact that I was using the BlazeDS Turnkey version that contains a preconfigured instance of Tomcat. BTW: This is a great tutorial: http://mmartinsoftware.blogspot.com/2008/05/simplified-blazeds-and-jms.html 2008/9/19 Christophe Herreman [EMAIL PROTECTED] Hi George, I'll take a look at the STOMP client. However I'm still wondering why this seems to fail. Do you need to setup the policy only with STOMP? Is it also need when running ActiveMQ, Tomcat and the flex client on the same machine? 2008/9/19 George [EMAIL PROTECTED] I use ActiveMQ and it works just fine. Although, I use the STOMP client, and you need to make sure that you have a flash policy server set up to allow the socket connection to the message server. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Christophe Herreman [EMAIL PROTECTED] wrote: Hi, I am unable to consume messages sent via ActiveMQ from my Flex client. Sending messages via the Producer seems to work, I can also see that the Flex client is connected and subscribed via the properties on the Consumer object, however the message event on the Consumer is never fired so it seems like the messages are not received. When I look in the ActiveMQ console, I can see the number of subscribers, the number of messages sent and the number of messages received. The strange thing is that the received messages counter seems to increment and that I can also trace the log statements in the Tomcat console, but again no messages are received in the Flex client. Any ideas? -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
[flexcoders] [ANN] Prana Framework 0.6 Released
Dear Community, I'm pleased to announce that the 0.6 version of Prana is now available. For more info, please see http://www.herrodius.com/blog/149 Enjoy this release and have fun coding ! regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Cairngorm ServiceLocator
Hi Vivian, we have recently been talking about this with the development team. I agree with you that video tutorials would be a great aid, so I'll try to put something together. regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org 2008/4/23 Vivian Richard [EMAIL PROTECTED]: Hey Christophe, is it possible that you create some video tutorial of Prana? I guess that way developers will be able to adopt it faster. Just my 2 cents!!! On Tue, Apr 22, 2008 at 9:07 PM, Christophe Herreman [EMAIL PROTECTED] wrote: Hi Eric, have you looked at the modified CairngormServiceLocator in Prana? http://www.herrodius.com/blog/131 regards, Christophe 2008/4/23 Eric Cancil [EMAIL PROTECTED]: I think a little more thought could be put into this class. Due to the fact that it uses describeType to discover the services that have been added to it, and it is not a dynamic class/ does not have any way to dynamically add services at runtime...it makes it in my view impossible to add say for example services that youve loaded in an initialization file at runtime. If an accessor method to add service at runtime was added I think it would make this class a lot more dynamic. Instead it relies on MXML being compiled down to AS and variables automatically being added. Any thoughts? Eric Ps... please dont suggest to roll my own locator, i know ;) -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Cairngorm ServiceLocator
Hi Eric, have you looked at the modified CairngormServiceLocator in Prana? http://www.herrodius.com/blog/131 regards, Christophe 2008/4/23 Eric Cancil [EMAIL PROTECTED]: I think a little more thought could be put into this class. Due to the fact that it uses describeType to discover the services that have been added to it, and it is not a dynamic class/ does not have any way to dynamically add services at runtime...it makes it in my view impossible to add say for example services that youve loaded in an initialization file at runtime. If an accessor method to add service at runtime was added I think it would make this class a lot more dynamic. Instead it relies on MXML being compiled down to AS and variables automatically being added. Any thoughts? Eric Ps... please dont suggest to roll my own locator, i know ;) -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
[flexcoders] [ANN] Prana Framework 0.5 Released
Dear Community, I'm pleased to announce that the 0.5 version of Prana is now available. For more info, please see http://www.herrodius.com/blog/145 Enjoy this release and have fun coding ! regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Dynamic Instance Problem
Hi Dale, did you reference the class somewhere in your code? It needs to be compiled into the swf in order to instantiate it dynamically. My personal preference is to do this with a static code block: { MyClass1, MyClass2 } regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org 2008/4/18, Dale Fraser [EMAIL PROTECTED]: Anyone tell me why this doesn't work. *var* ClassName:String = *'views.pr.ProjectView'*; *var* ClassReference:Class = getDefinitionByName(ClassName) *as* Class; *var* instance:UIComponent = *new* ClassReference(); child.addChild( instance ); ReferenceError: Error #1065: Variable ProjectView is not defined. at global/flash.utils::getDefinitionByName() at Main/addTab()[C:\ Central\Flex\src\Main.mxml:86] at Main/treeChanged()[C:\ Central\Flex\src\Main.mxml:52] at Main/__menuTree_click()[C:\ Central\Flex\src\Main.mxml:138] Regards Dale Fraser http://learncf.com http://flexcf.com -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Dynamic Instance Problem
You could also build your project with Ant and pass in a list of extra classes to the compiler with the include-classes option. The list of extra classes can be derived from your xml file. I need to create object instances based on XML data. Have you checked Prana? (www.pranaframework.org) ;-) regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org 2008/4/18, Dale Fraser [EMAIL PROTECTED]: Doesn't work for my needs. I need to create object instances based on XML data. The component creating the instances isn't aware of what objects might get created. So I would need to declare every type of object just in case. Which means it's not dynamic at all, as soon as there is a new Object I need to modify the code to allow for it. Regards Dale Fraser http://learncf.com http://flexcf.com *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Stephen Downs *Sent:* Friday, 18 April 2008 5:48 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Dynamic Instance Problem You just need to declare it somewhere, its still dynamic, i.e. it may be created it may not. You don't have to actually use the declared var, your just making sure thats its available for creation. private var declared:*views.pr.ProjectView;* -- Stephen Downs Addict, Tink Ltd. e: [EMAIL PROTECTED] t: +44 (0) 7730 838 785 w: http://www.tink.ws -- On 18 Apr 2008, at 08:38, Dale Fraser wrote: Thanks, That kind of makes it non dynamic if I need to reference it elsewhere. Is there a way around this. Regards Dale Fraser http://learncf.com http://flexcf.com *From:* flexcoders@yahoogroups.com [mailto:flexcoders flexcoders@ yahoogroups.com] *On Behalf Of *Christophe Herreman *Sent:* Friday, 18 April 2008 5:08 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Dynamic Instance Problem Hi Dale, did you reference the class somewhere in your code? It needs to be compiled into the swf in order to instantiate it dynamically. My personal preference is to do this with a static code block: { MyClass1, MyClass2 } regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org 2008/4/18, Dale Fraser [EMAIL PROTECTED]: Anyone tell me why this doesn't work. *var* ClassName:String = *'views.pr.ProjectView'*; *var* ClassReference:Class = getDefinitionByName(ClassName) *as* Class; *var* instance:UIComponent = *new* ClassReference(); child.addChild( instance ); ReferenceError: Error #1065: Variable ProjectView is not defined. at global/flash.utils::getDefinitionByName() at Main/addTab()[C:\ Central\Flex\src\Main.mxml:86] at Main/treeChanged()[C:\ Central\Flex\src\Main.mxml:52] at Main/__menuTree_click()[C:\ Central\Flex\src\Main.mxml:138] Regards Dale Fraser http://learncf.com http://flexcf.com -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Re: Mock objects in AS3
Hi all, has anyone made any progress on this? regards, Christophe 2008/1/6, aduston1976 [EMAIL PROTECTED]: Hi, Sorry for being out of the conversation for a few days. I ran into a problem while trying to do this using hxasm. If I write out the bytecode for a class definition to a ByteArray, and the class inherits from a custom class that is part of my swf rather than a standard class like Object, then Loader#loadBytes will throw an exception indicating that the class couldn't be found. I couldn't overcome this behavior no matter what LoaderContext I passed to the loadBytes method. I don't know enough about linking in AS3 to explain what is going on behind the scenes here, though I'm sure that some Adobe employees would expect this behavior and could explain the reason for it very easily To make the behavior more concrete, I would be happy to share my code with you folks. Drew, I will message you offline. I am very happy to see that other people are interested in working on this problem also. The Metal Hurlant blog post looks potentially promising. Adam --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Drew Bourne [EMAIL PROTECTED] wrote: Hi Christophe, Ohh neatness! Thanks for the heads up, I had no idea Haxe had that feature. I'm going to spend some time on this tonight tomorrow. cheers, Drew On 03/01/2008, at 9:53 PM, Christophe Herreman wrote: Hi Drew, just FYI: Adam and I talked about this some days ago. I pointed him to the fact that you could easily convert the Haxe code to AS3 using a flag for the Haxe compiler. In case you are interested, I have uploaded the hxasm code and the as3 version here:http:// www.herrodius.com/upload/hxasm.zip @Adam: Did you make some more progress? regards, Christophe 2008/1/2, Drew Bourne [EMAIL PROTECTED]: As the author of that mock framework Adam linked to I thought I should chip in with my thoughts on the issues that have been raised. Regarding having to hand code the implementation of the class you want to mock I have found that with a couple of snippet templates for TextMate I can write them quite quickly. If you are going to hand-code stubs for use in testing without using a framework you are adding behaviour to a class which means you should then be testing that class too. To ease some of the pain until we can generate mock objects from interfaces I intend to bundle a bunch of support classes that provide mocks for many of the core flash class (think URLLoader, EventDispatcher, Socket, etc). Speak up if you've got suggestions for the classes you would like to see included initially. I have a couple of ideas about what we would need to be able to generate the mock classes: 1) Generate the .as for the mock from reflection information at runtime, then compile the generated .as at runtime with a self-hosted compiler (AS3 compiler in AS3) then load it via Loader.loadBytes and flash.utils.getDefinitionByName 2) Write an AS3 Parser in something like Java or Ruby that would provide access to the Abstract Syntax Tree from which we can generate the mock class, then compile the generated .as with mxmlc along with the test suite. By implementing a tool that provides the AST for an AS3 class we open up the doors for lots of fun like generating mocks, AOP, code mutation (think adding hooks for code coverage reporting, mutation testing, additional metadata directives) There is work in the Tamarin project for a self-hosted compiler however last I checked it wasn't far enough along for our purposes. The hxASM library looks interesting and could definately be an avenue worth exploring for this. Adam, I would be interested in collaborating on getting a port of hxASM to AS3 so that we can generate the necessary bytecodes to create mocks from an interface at runtime. cheers, Drew -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
[flexcoders] Dynamic Proxies feature request
Hi all, I just submitted a feature request for dynamic proxies in Adobe's Jira: http://bugs.adobe.com/jira/browse/ASC-3136 This is directly related to the discussion we have going on about Mock Objects in AS3: http://tech.groups.yahoo.com/group/flexcoders/message/90890 Please consider this an important issue/limitation of the ActionScript language and cast your vote. thx and regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Re: Mock objects in AS3
Hi Drew, just FYI: Adam and I talked about this some days ago. I pointed him to the fact that you could easily convert the Haxe code to AS3 using a flag for the Haxe compiler. In case you are interested, I have uploaded the hxasm code and the as3 version here: http://www.herrodius.com/upload/hxasm.zip @Adam: Did you make some more progress? regards, Christophe 2008/1/2, Drew Bourne [EMAIL PROTECTED]: As the author of that mock framework Adam linked to I thought I should chip in with my thoughts on the issues that have been raised. Regarding having to hand code the implementation of the class you want to mock I have found that with a couple of snippet templates for TextMate I can write them quite quickly. If you are going to hand-code stubs for use in testing without using a framework you are adding behaviour to a class which means you should then be testing that class too. To ease some of the pain until we can generate mock objects from interfaces I intend to bundle a bunch of support classes that provide mocks for many of the core flash class (think URLLoader, EventDispatcher, Socket, etc). Speak up if you've got suggestions for the classes you would like to see included initially. I have a couple of ideas about what we would need to be able to generate the mock classes: 1) Generate the .as for the mock from reflection information at runtime, then compile the generated .as at runtime with a self-hosted compiler (AS3 compiler in AS3) then load it via Loader.loadBytes and flash.utils.getDefinitionByName 2) Write an AS3 Parser in something like Java or Ruby that would provide access to the Abstract Syntax Tree from which we can generate the mock class, then compile the generated .as with mxmlc along with the test suite. By implementing a tool that provides the AST for an AS3 class we open up the doors for lots of fun like generating mocks, AOP, code mutation (think adding hooks for code coverage reporting, mutation testing, additional metadata directives) There is work in the Tamarin project for a self-hosted compiler however last I checked it wasn't far enough along for our purposes. The hxASM library looks interesting and could definately be an avenue worth exploring for this. Adam, I would be interested in collaborating on getting a port of hxASM to AS3 so that we can generate the necessary bytecodes to create mocks from an interface at runtime. cheers, Drew -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Cannot access a property or method of a null object reference
Hi, you need to create an instance of the testClass like this var test:testClass = new testClass(); regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.com 2008/1/1, [EMAIL PROTECTED] [EMAIL PROTECTED]: This compiles but when you hit the test button, it says TypeError: Error #1009: Cannot access a property or method of a null object reference. at Main/test() at Main/__b1_click() Can anyone explain what this means ? It totally does not make any sense to me. main.mxml: ?xml version=1.0? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script source=MainCode.as/ mx:Button id=b1 label=Test click=test();/ /mx:Application MainCode.as: Public function test():void { var test:testClass; test.justtesting(); } testClass.as: package { public class testClass { public function testClass() { } public function justtesting():void { trace(just testing); } } } -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Re: Mock objects in AS3
Hi Adam, I have also been looking into runtime interface implementation to create Mock objects and a basic AOP framework. I'm stuck at the exact same thing as you are and the others that are working on this. My guess is that we will need to have some kind of bytecode manipulation framework to achieve this. In the Java world they use CGLib (which is based on ASM). There already is HXASM which is a Flash9 assembler written in HaXe. The code can easily be converted to AS3 and might suit as the basis for the problem we are trying to solve. The problem is 1) that I don't have enough bytecode knowledge to work on this alone and 2) that I don't know if it will even be possible to solve the problem that way in AS3. Don't hesitate to contact me offlist to discuss this further. I'm interested in working on this. Hope to keep this conversation going. regards, Christophe -- Christophe Herreman http://www.herrodius.com 2007/12/26, aduston1976 [EMAIL PROTECTED]: I started a new project recently and came to a point in testing where I was writing a bunch of custom mock objects. Great place, I thought, to pick up my dream from 2.5 months ago to create a mock framework for flex. I tried Darron Schall's objectToInstance method, but unfortunately it doesn't seem to work when clazz is an Interface type rather than an Object type. It seems that ByteArray#readObject throws an exception because the interface type has no default constructor. Rats! You can see here http://thefoundry.anywebcam.com/index.php/actionscript/mock-as3-released-a-mock-object-library-for-actionscript-3/ that some other guys have created a mock framework for as3, but they seem to have run into the same problem: to create a mock to pass to a method that expects an interface instance, you have to wrap the mock in a class that implements the interface. What a PITA! I am essentially better off hand-coding my mocks! Is there any solution to this problem? Is there any way to get the Flex runtime to believe that a flash.utils.Proxy subclass also implements a particular interface? Adam --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, aduston1976 [EMAIL PROTECTED] wrote: Bjorn, I think this is a hack but it looks like a pretty awesome hack and I'm definitely going to use it. Thank you very much for posting it! I think this is part of the best path to creating a mock test framework for AS3. Adam --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Bjorn Schultheiss bjorn.mailinglists@ wrote: Hey Dave and Adam, That way a quick reply i sent yesterday without much thought. Currently to convert a generic object to a typed instance i've been using a utility provided by Darron Schall. http://www.darronschall.com/weblog/archives/000247.cfm basically the method looks like this, public static function objectToInstance( object:Object, clazz:Class ):* { var bytes:ByteArray = new ByteArray(); bytes.objectEncoding = ObjectEncoding.AMF0; // Find the objects and byetArray.writeObject them, adding in the // class configuration variable name -- essentially, we're constructing // and AMF packet here that contains the class information so that // we can simplly byteArray.readObject the sucker for the translation // Write out the bytes of the original object var objBytes:ByteArray = new ByteArray(); objBytes.objectEncoding = ObjectEncoding.AMF0; objBytes.writeObject( object ); // Register all of the classes so they can be decoded via AMF var typeInfo:XML = describeType( clazz ); var fullyQualifiedName:String = typeInfo.@().replace ( /::/, . ); registerClassAlias( fullyQualifiedName, clazz ); // Write the new object information starting with the class information var len:int = fullyQualifiedName.length; bytes.writeByte( 0x10 ); // 0x10 is AMF0 for typed object (class instance) bytes.writeUTF( fullyQualifiedName ); // After the class name is set up, write the rest of the object bytes.writeBytes( objBytes, 1 ); // Read in the object with the class property added and return that bytes.position = 0; // This generates some ReferenceErrors of the object being passed in // has properties that aren't in the class instance, and generates TypeErrors // when property values cannot be converted to correct values (such as false // being the value, when it needs to be a Date instead). However, these // errors are not thrown at runtime (and only appear in trace ouput when // debugging), so a try/catch block isn't necessary. I'm not sure if this // classifies as a bug or not... but I wanted to explain why if you debug // you might seem some TypeError or ReferenceError items appear. var result:* = bytes.readObject(); return result; } regards, Bjorn On 18/10/2007, at 10:40 AM, dave_defusion wrote
Re: [flexcoders] AsDoc and libraries problem
Hi, check the -external-library-path option. Here's a snippet from an ant build file we have: exec dir=. executable=${FLEX_HOME}/bin/asdoc.exe failonerror=true arg line=-doc-sources . -source-path+=. -window-title 'Salto backend' -output ${asdoc.dir} -main-title 'Salto Backend' -footer 'Salto Backend' -external-library-path+=lib -show-binding-warnings=false -show-actionscript-warnings=false / /exec regards, Christophe --- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org 2007/12/10, Christophe Herreman [EMAIL PROTECTED]: Hi, check the -external-library-path option. Here's a snippet from an ant build file we have: exec dir=. executable=${FLEX_HOME}/bin/asdoc.exe failonerror=true arg line=-doc-sources . -source-path+=. -window-title 'Salto backend' -output ${asdoc.dir} -main-title 'Salto Backend' -footer 'Salto Backend' -external-library-path+=lib -show-binding-warnings=false -show-actionscript-warnings=false / /exec regards, Christophe --- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org 2007/12/10, Rico Leuthold [EMAIL PROTECTED]: Hi, I already have the -doc-sources argument: I'm changing to the project root directory and invoke asdoc like this: asdoc -source-path . -doc-sources . ... and the flexlib is in ./libs/flexlib. So, based on the documention providing . as a -doc-sources or -source-path should recursive include all the files in and under the projects root directory. I think the problem comes from the different namespaces, which should be defined somehow for flexlib but are already set up for the mx components. _rico On 07.12.2007, at 10:07, Christophe Herreman wrote: have you tried using -doc-sources path/to/project instead of -source-path? AFAIK you don't need to specify the libs you're using then. regards, Christophe --- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org 2007/12/7, Rico Leuthold [EMAIL PROTECTED] [EMAIL PROTECTED] : I already have the swc in the source-path. I'm running asdoc from the root of the project folder like this: asdoc -source-path . -doc-sources. thanks_rico On 06.12.2007, at 16:14, Muzak wrote: Add the location of the flexlib swc to the -source-path parameter list asdoc -source-path path/to/project path/to/flexlib ... - Original Message - From: rleuthold [EMAIL PROTECTED] rleuthold%40access.ch To: flexcoders @yahoogroups.com flexcoders%40yahoogroups.com Sent: Thursday, December 06, 2007 12:02 PM Subject: [flexcoders] AsDoc and libraries problem Hi, I want to run asdoc (from command line) for my project, but always getting an error cause of the flexlib components I'm using (Error: Could not resolve flexlib:SuperTabNavigator to a component implementation). Does somebody have an idea how to exclude the flexlib components when running asdoc ? thanx_rico -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/fle xcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%http://www.mail-archive.com/flexcoders%25 40yahoogroups.com Yahoo! Groups Links ... Rico Leuthold [EMAIL PROTECTED] rleuthold%40access.ch +41(0)76 512 05 50 ... -- Christophe Herreman http://www.herrodius.com http:%0A+//www.herrodius.com http://www.pranaframework.org ... Rico Leuthold [EMAIL PROTECTED] +41(0)76 512 05 50 ... -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] AsDoc and libraries problem
have you tried using -doc-sources path/to/project instead of -source-path? AFAIK you don't need to specify the libs you're using then. regards, Christophe --- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org 2007/12/7, Rico Leuthold [EMAIL PROTECTED]: I already have the swc in the source-path. I'm running asdoc from the root of the project folder like this: asdoc -source-path . -doc-sources. thanks_rico On 06.12.2007, at 16:14, Muzak wrote: Add the location of the flexlib swc to the -source-path parameter list asdoc -source-path path/to/project path/to/flexlib ... - Original Message - From: rleuthold [EMAIL PROTECTED] rleuthold%40access.ch To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Sent: Thursday, December 06, 2007 12:02 PM Subject: [flexcoders] AsDoc and libraries problem Hi, I want to run asdoc (from command line) for my project, but always getting an error cause of the flexlib components I'm using (Error: Could not resolve flexlib:SuperTabNavigator to a component implementation). Does somebody have an idea how to exclude the flexlib components when running asdoc ? thanx_rico -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%http://www.mail-archive.com/flexcoders%25 40yahoogroups.com Yahoo! Groups Links ... Rico Leuthold [EMAIL PROTECTED] rleuthold%40access.ch +41(0)76 512 05 50 ... -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] ASDoc tool and packages
Hi Jobe, you need to specify them as arguments when invoking asdoc.exe: -package com.domain.a the a package -package com.domain.b the b package regards, Christophe --- http://www.herrodius.com http://www.pranaframework.org 2007/12/5, Jobe Makar [EMAIL PROTECTED]: Hi, I have been using ASDoc for a while now with great success. However, I cannot seem to find information on how to get documentation to show up for packages. My guess would be putting the docs outside of the package syntax in any class in that package, or by having a text file with a special name. If you know then please fill me in. I appreciate the assistance! ps - I tried this with no noticeable results. /** * blah blah */ package com.electrotank.whatever { Jobe Makar http://www.electrotank.com 252-627-8026 919-609-0408 (mobile) -- Christophe Herreman http://www.herrodius.com
[flexcoders] ValueObject Factories?
Hi all, I was wondering how you guys deal with model objects and their corresponding value objects. We have a pretty big domain model with complex nested classes and we need to create value objects from them before sending them to the server. Right now we create a factory for each model, that can create a vo from a model and a model from a vo. This works, but it is obviously a lot of work and error prone, so it requires more work to write testcases for them. Does anyone have this problem too? Are you only sending VO's to the server or do you only do that for complex types and otherwise send the object itself? Input, comments and ideas are welcome. regards, Christophe -- Christophe Herreman http://www.herrodius.com http://www.pranaframework.org
Re: [flexcoders] Dynamic class creation?
Hi Ian, maybe this will solve your problem (if I understood correctly): var clazz:Class = getDefinitionByName(com.domain.MyClass) as Class; http://livedocs.adobe.com/flex/2/langref/flash/utils/package.html#getDefinitionByName() regards, Christophe 2007/10/22, Ian Thomas [EMAIL PROTECTED]: Hi all, Got a bit of a tricky problem here that I'm banging my head against... If you assume I have some function that returns a Class object - for example: getAssetClass(id:String):Class This returns a Class object which, at some future time, will be called with new SomeClass() to construct an instance of an object. Let's assume that the body of the function looks something like this: function getAssetClass(id:String):Class { return GenericAssetClass; } However, the actual behaviour I need changes depending on the value of 'id'. Effectively what I want to happen is for the returned class to be parameterised in some way - so that when new SomeClass() is called it evaluates to new GenericAssetClass(id). In AS2, this was possible because constructors were just functions. I could happily say: function getAssetClass(id:String):Function { return function():Object {return new GenericAssetClass(id);} } However, in AS3 this won't work, as Class is quite a different thing from Function. Changing GenericAssetClass.prototype.constructor doesn't help, as it's static and applies to all instances of GenericAssetClass. Doing something like this: function getAssetClass(id:String):Class { GenericAssetClass.id=id; return GenericAssetClass; } class GenericAssetClass { public static id:String; public function GenericAssetClass() { // Do something that depends on 'id' } } won't help either, because as soon as you change the static GenericAssetClass.id, that change applies to all the constructors you've handed out. I could do something like this: function getAssetClass(id:String):Class { if (id==id1) return GenericAssetClass1; else if (id==id2) return GenericAssetClass2; // etc. as required } but the trouble is that there is only one, parameterised GenericAssetClass and I can't define all the options up front - it truly is dynamic. *sigh* I've a feeling this ought to be possible, I just can't for the life of me think how. Is there any way I can hook into the new Class() call somewhere? Or uniquely identify each reference to GenericAssetClass that I've handed out, so that I can use a lookup table during the construction phase? Thanks in advance, Ian -- Christophe Herreman http://www.herrodius.com
Re: [flexcoders] Mock objects in AS3
Hi guys, I started looking at the EasyMock framework but haven't had the time yet to play around with this in Prana. I would be very interested in doing so. Maybe it is worth joining the Prana list so we can discuss this in detail. https://lists.sourceforge.net/lists/listinfo/prana-user regards, Christophe 2007/10/17, Bjorn Schultheiss [EMAIL PROTECTED]: try add flash.net.registerClassAlias( attempt.TestInterface, TestInterface ); prior to your cast attempt. regards, Bjorn On 17/10/2007, at 1:06 PM, aduston1976 wrote: lus I see a number of places on the web where the idea is mentioned, e.g. http://www.herrodius.com/blog/?m=200704 . However I cannot find any mock frameworks for AS3. This evening I spent some time trying to mock one up on my own (ok, sorry for the pun!) but I ran into troubles. Is anyone interested in thinking about this problem with me? Here is what I did during my 20 minutes of playing: Define an interface: public interface TestInterface { function setSomething(something : String) : void; } Run the following code: public function flexmock() { var i : TestInterface; var c : Class = flash.utils.getDefinitionByName(attempt.TestInterface) as Class; var desc : XML = flash.utils.describeType(c); var str : String = desc.toString(); var a : Object = new Object(); a[setSomething] = function(something : String) : void { trace(something); }; // will fail on the following line, since a does not implement TestInterface. i = TestInterface(a); i.setSomething(blah); } AS3 doesn't support duck typing like Ruby, and I believe there is no way to get an object in memory that implements the TestInterface interface that my other objects can use as a mock. Any thoughts about this? Am I doomed to use elbow grease or code generation to create these things? BTW, this message is also posted on the ActionScript 3 FlexUnit Library forum in Google Groups. Hopefully that isn't some kind of forum faux pas. Thank you for any comments, Adam -- Christophe Herreman http://www.herrodius.com
[flexcoders] Re: function.apply() and this on instance method
Hi Stephen, that Decorator solution would work, but not in my case. Let me explain why. I'm trying to come up with another approach to Cairngorm's SequenceCommand. The problem with that implementation is that the commands in the sequence know that they are part of a sequence. This makes it impossible to reuse a command outside a sequence or in a another sequence without coding some conditional logic inside the commands. The solution I'm trying to figure out let you define commands as single units and then group together the events that will trigger the commands in a sequence allowing better code reuse. I already wrote some code that lets you define the sequence etc. I have a CommandProxy class that proxies a command and is able to intercept the execute method. This all works fine. The problem is that when you implement IResponder, and you pass the command as a responder to a delegate, you have no control over the result and fault methods because it is not the proxy that is passed but the original command instance. The code to do this in the command proxy (I was hoping to work): _command.execute.apply(this, event); where _command is the proxied command and this is the command proxy. Unfortunately this doesn't work. I sort of worked around this by adding bindings on properties in the ModelLocator and when a property changes because of the result method in a command, the next event is dispatched to invoke the next command. This works, but it assumes that you always update a property in the ModelLocator when a command executes. I hope this all makes sense. If apply() would work with instance methods, I'm sure this solution would be a big improvement to the Cairngorm framework. Any thoughts? (and thanks for your time!) regards, Christophe --- In flexcoders@yahoogroups.com, Stephen Allison [EMAIL PROTECTED] wrote: Hi, To address your case of wanting to execute code before and after the fault and result methods of IResponder, would it be sufficient to create an implementation of IResponder that takes another IResponder and wraps that object's fault and response methods. Something like: class ResponderWrapper implements IResponder { private var _wrappedResponder; public ResponderWrapper(wrapped:IResponder) { _wrappedResponder = wrapped; } public function fault() { // your pre-execution code here _wrappedResponder.fault() // your post-execution code here } // and similarly for result. } You then use ResponderWrapper in place of the 'wrapped' IResponder. Further flexibility could be achieved by passing in additional parameters that are functions defining the pre and post execution operations when constructing this object. I have found this kind of 'decorator' approach quite useful in the past. Regarding the use of 'apply' - I think you are correct that you cannot use 'apply' on a method, for methods 'this' always is the owning object, even if you are referring to a method via a variable of type function. HTH Stephen
[flexcoders] Re: Ignoring a public member during serialization
Hi, check out the [Transient] metadata tag. regards, Christophe --- In flexcoders@yahoogroups.com, vikram [EMAIL PROTECTED] wrote: Hi, I am using .Net web services to communicate with the server in my Flex application. In action script, is there a way to prevent serialization of some of the public variables during a web service request? In .Net, there is am attribute called [XmlIgnore] which will make a variable not to serialize. I am looking for something similar in AS3. Thanks Vikram
Re: [flexcoders] Flex Reflection
Hi André, I have been working on a Reflection API for ActionScript 3 as part of the Prana project. You can find info at http://www.herrodius.com/blog/?p=68 A download link is also provided. regards, Christophe André Rodrigues Pena wrote: Hi all, I'm wondering if Flex has some mechanism for dynamically calling methods and setting properties. I mean, I don't know the name of the method or the property at compile time. Something like Java Reflection. Thanks -- André Rodrigues Pena LOCUS www.locus.com.br
Re: [flexcoders] Prana: IoC container for AS3
Hi Brian, The way I see it, the current implementation has some problems: - As you say, your custom combobox will always know about the RoleFilter. (On a sidenote, it might be even better to pass in an instance of an IRoleFilter so that you have more flexibility in the way the filter is implemented. You could even define the filter and your combobox in the applicationContext and have them wired together by the container at runtime.) - The fact that you have to create a custom combobox for implementing security in your application. And would have to do that for every filtered component. The most elegant solution for this would be an AOP advice that filters the dataProvider before assigning it to the consumer/component. The advantages are: - the consumer doesn't know anything about the filter - you don't need to extend the component(s) to add filtering - the advice can easily be reused and applied to other components with a dataProvider property. You'd need to alter the pointcut (that defines where to intercept accessors or methods) which could also be done in the applicationcontext. Of course, the downside of this is that it bring a bit of extra complexity to your application, but IMO that's mostly because we are not used to thinking in aspects. What do you think? thx for your input, it is greatly appreciated! regards, Christophe Brian Lesser wrote: Thanks Carlos, I'll be interested to see what you come up with. Right now I'm experimenting with the best way to use static methods to handle cross-cutting security concerns within custom components. For example a combo box may only be able to show certain options to a user based on the user's role. The combo starts off with all the options available but must filter them before displaying them. To do that it calls a static method of a RoleFilter class. I'm not sure if that's the best way to go about it though. Here's the script from within a custom combo box as an example: mx:Script ![CDATA[ import com.somecompany.security.RoleFilter; private function init():void{ filterData(); } public function filterData():void{ dataProvider = RoleFilter.filterArrayCollection(unfilteredCollection); } ]] /mx:Script Note: unfilteredCollection is just an ArrayCollection of objects. Now, that's not a lot of code, but what bothers me is that I'd rather my custom combo box not know anything about my RoleFilter class. In fact I'd prefer it not know anything about filters at all. So, even though this works fine, I'm trying to come up with something more elegant. So far having the combo box's container set this up hasn't looked right either. So again, I'm interested to see what you end up with. Yours truly, -Brian Carlos Rovira wrote: I think avoiding repeated code would a great advance if we use an IoC container that allows us only create the different code and inyect the shared functionality. Another great thing is AOP that would be a great thing since many different objects must face equal behaviour and we could do this as as aspect and inyect it by configuration. Maybe the problem is to think about how we must to adapt this kind of functionality to AS3 and Flex and not simply copy from the java/spring world to Flex. But for me is clear that many improvements in the upcoming months could be done with frameworks like Pranaq 2007/4/20, Brian Lesser [EMAIL PROTECTED] mailto:blesser%40ryerson.ca: Hi Carlos, et al, I have a question regarding the need for an ioc container for Flex as opposed to a pure AS3 or Flash project. Flex already provides a hierarchy of containers that contain controls and service proxies. The containers are usually responsible for setting the dependencies between controls and proxies. Setting dependencies can be done with databinding, simple assignment, or by setting up listeners. This is a very different situation from what a Java developer faces without an IOC container when writing servlets or JSP pages. In fact in Flex the built in visual state mechanism means we can set up dependencies and tear them down when states are entered and left. So, here's my question: what would an IOC container add that Flex doesn't provide and how would it improve our work or what we could do? Are you primarily thinking about aspects? Yours truly, -Brian Carlos Rovira wrote: Looks very promising :) Great! C. PD:mmm... no body else seems to be interested in this proyect? people know about the benefits of a IoC container? 19 Apr 2007 04:03:30 -0700, Christophe Herreman [EMAIL PROTECTED] com mailto:[EMAIL PROTECTED] mailto:lists%40herrodius.com lists%40herrodius.com: Hi Carlos, I don't really have an official roadmap, but here are some of the things I'd like to achieve: - IoC container - IoC utils for frameworks like Cairngorm and ARP - AOP framework - Mock Objects
Re: [flexcoders] Prana: IoC container for AS3
Hi Brian, there might indeed be a difference between Flex projects that use Flex Data Services vs. compiled Flex/Flash/AS3 projects. The FDS projects have a huge advantage of having the code compiled on the server. For instance to change Cairngorm's ServiceLocator and define where to find let's say a RemoteObject's endpoint, you could simply replace the services.mxml. In a compiled app, you'd have to recompile it after changing the remote object's details. You could of course write custom configuration code that reads an xml or a text file and defines the remote object's details that way, but if you need to do that for several objects in your application, your code becomes cluttered with configuration code. By using an IoC applicationcontext, you don't need to write custom code for parsing and assigning the properties of an object, because the container does that for you. But also with FDS I can see some advantages in using IoC. I will again refer to Cairngorm where BusinessDelegates typically lookup a service in the ServiceLocator and commands instantiate a business delegate. You now have code like this: this.service = ServiceLocator.getInstance().getRemoteObject( productService ); (in the business delegate) and var delegate : ProductDelegate = new ProductDelegate( this ); (in the command) But what happens if we go from using remoting to using webservices or httpservices? We would have to change the businessdelegate and possibly also the code of our commands to read the data returned by the remote call, the webservice of the httpservice. It would be better if we had an accessor for a businessdelegate on our command and an accessor for a service on our businessdelegates. If everything is typed to an interface the code would not be aware of any implementation details and we would be able to leave that up to the application context. If we would work out this case in a Cairngorm app, it would most likely require some changes in the framework itself. I'll try to work out an example in the coming weeks as a proof of concept. Any thoughts? best regards, Christophe Brian Lesser wrote: Hi Carlos, et al, I have a question regarding the need for an ioc container for Flex as opposed to a pure AS3 or Flash project. Flex already provides a hierarchy of containers that contain controls and service proxies. The containers are usually responsible for setting the dependencies between controls and proxies. Setting dependencies can be done with databinding, simple assignment, or by setting up listeners. This is a very different situation from what a Java developer faces without an IOC container when writing servlets or JSP pages. In fact in Flex the built in visual state mechanism means we can set up dependencies and tear them down when states are entered and left. So, here's my question: what would an IOC container add that Flex doesn't provide and how would it improve our work or what we could do? Are you primarily thinking about aspects? Yours truly, -Brian Carlos Rovira wrote: Looks very promising :) Great! C. PD:mmm... no body else seems to be interested in this proyect? people know about the benefits of a IoC container? 19 Apr 2007 04:03:30 -0700, Christophe Herreman [EMAIL PROTECTED] com mailto:[EMAIL PROTECTED] mailto:lists%40herrodius.com: Hi Carlos, I don't really have an official roadmap, but here are some of the things I'd like to achieve: - IoC container - IoC utils for frameworks like Cairngorm and ARP - AOP framework - Mock Objects for FlexUnit - Reflection API - general utilities Reading this myself, it looks very optimistic ;-) but the motivation is there so, what the heck. A first version of the Reflection API has just been added to the SVN repo BTW. regards, Christophe -- __ Brian Lesser Assistant Director, Application Development and Integration Computing and Communications Services Ryerson University 350 Victoria St. Toronto, Ontario Phone: (416) 979-5000 ext. 6835 M5B 2K3 Fax: (416) 979-5220 Office: POD?? E-mail: [EMAIL PROTECTED] mailto:blesser%40ryerson.ca (Enter through LB99) Web: http://www.ryerson.ca/~blesser http://www.ryerson.ca/%7Eblesser __
Re: [flexcoders] Prana: IoC container for AS3
Hi Carlos, I don't really have an official roadmap, but here are some of the things I'd like to achieve: - IoC container - IoC utils for frameworks like Cairngorm and ARP - AOP framework - Mock Objects for FlexUnit - Reflection API - general utilities Reading this myself, it looks very optimistic ;-) but the motivation is there so, what the heck. A first version of the Reflection API has just been added to the SVN repo BTW. regards, Christophe Carlos Rovira schreef: Hi Christophe, That's s cool :), I saw you first two post as you publish and hope try it soon. Do you have some road map for prana? what could we expect in future versions? A great effort :) 17 Apr 2007 13:08:04 -0700, Christophe Herreman [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: Hi guys, thought some of you might be interested in this: I recently started working on an Inversion of Control container (ala Spring) for ActionScript 3. Some of the core functionalities are working now and I just moved the project to SourceForge where it can be found at http://sourceforge.net/projects/prana/. http://sourceforge.net/projects/prana/. You can read the announcement here: http://www.herrodius.com/blog/?p=67 http://www.herrodius.com/blog/?p=67 best regards, Christophe -- ::| Carlos Rovira ::| http://www.carlosrovira.com http://www.carlosrovira.com ::| http://www.madeinflex.com http://www.madeinflex.com
[flexcoders] Prana: IoC container for AS3
Hi guys, thought some of you might be interested in this: I recently started working on an Inversion of Control container (ala Spring) for ActionScript 3. Some of the core functionalities are working now and I just moved the project to SourceForge where it can be found at http://sourceforge.net/projects/prana/. You can read the announcement here: http://www.herrodius.com/blog/?p=67 best regards, Christophe
Re: [flexcoders] expand entire tree?
Hi Joshua, try this: var dp:XML = tree.dataProvider[0]; tree.openItems = dp..node; Note that this code works for a dataprovider with a root node and with node as the nodenames. regards, Christophe joshua gatcke schreef: Does anyone know how to expand a tree on initialize? I have tried the following with no avail: private function setPageListTree():void{ pageListTree.openItems(pageListTree.dataProvider.getItemAt(1)); pageListTree.expandItem(pageListTree.dataProvider.children(), true); pageListTree.expandChildrenOf(pageListTree, true); } Thanks in advance, Joshua Gatcke - Director *Visua Design Group Inc.* Cell:(403) 815-3265 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Re: [flexcoders] Re: Dynamic constructor invocation?
Hi again, the solution I have so far is to make separate calls for each number of arguments that needs to be passed to the constructor. It works, but of course it is no elegant and generic solution. case 1: result = new clazz(args[0]); break; case 2: result = new clazz(args[0], args[1]); break; etc. regards, Christophe herrodius schreef: 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] mailto:info%40herrodius.com). If you are interested in my progress I can send you some stuff to. regards, Christophe --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.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 mailto:flexcoders%40yahoogroups.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 http://www.mail-archive.com/flexcoders@yahoogroups.com/msg21919.html Any tips? thx, Christophe
[flexcoders] Cairngorm: Switching between BusinessDelegates
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/
[flexcoders] [Cairngorm] - Question about ViewHelpers
Hi guys, I was wondering about the following... Say you have a GetUserCommand the retrieves a user from the db and then updates 2 views: a UserForm where the user's data is shown and the application's HeaderForm where the name of the current user is displayed. How would you handle updating these 2 views? I was thinking: 1) Update the views from within the command through 2 ViewHelpers (UserFormViewHelper, HeaderFormViewHelper) 2) Create one ViewHelper named UserViewHelper that you call inside the command. In that UserViewHelper the 2 forms are updated. This raises another question: Is a ViewHelper bound to a Form/View or to a business entity like User in this case? thx for your time ! regards, Christophe Yahoo! Groups Sponsor ~-- Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM ~- -- 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/ * 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/
Re: [flexcoders] [Cairngorm] - Question about ViewHelpers
Hi Dimitros, thx for the feedback. Things are more clear now. Just another question: How would you handle the same situation in a Flash application? Would it be a good idea to let the Forms/Views register with the ModelLocator for changes in the model? Or does that give the ModelLocator too much responsibility. I see how the binding is done automaticly by Flex and that rocks...if only Flash could do that in such an easy way. regards, Christophe Dimitrios Gianninas wrote: Hi, A ViewHelper is bound to a specific Form/View. If your case you can do it two ways. You can use one ViewHelper to set the data on the different fields OR the command can save the user data on a ModelLocator and that model is bound to the varius controls, like so: mx:TextInput id=name text={ModelLocator.user.name} / mx:TextInput id=email text={ModelLocator.user.email} / As for the header, you can bind its value as well, instead of having to set it everytime, like so: mx:Label text={name.text} / Hope that helps! Jimmy -Original Message- From: flexcoders@yahoogroups.com on behalf of Christophe Herreman Sent: Sat 10/8/2005 7:44 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] [Cairngorm] - Question about ViewHelpers Hi guys, I was wondering about the following... Say you have a GetUserCommand the retrieves a user from the db and then updates 2 views: a UserForm where the user's data is shown and the application's HeaderForm where the name of the current user is displayed. How would you handle updating these 2 views? I was thinking: 1) Update the views from within the command through 2 ViewHelpers (UserFormViewHelper, HeaderFormViewHelper) 2) Create one ViewHelper named UserViewHelper that you call inside the command. In that UserViewHelper the 2 forms are updated. This raises another question: Is a ViewHelper bound to a Form/View or to a business entity like User in this case? thx for your time ! regards, Christophe -- 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 http://groups.yahoo.com/gads?t=msk=Web+site+design+developmentw1=Web+site+design+developmentw2=Computer+software+developmentw3=Software+design+and+developmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ Computer software development http://groups.yahoo.com/gads?t=msk=Computer+software+developmentw1=Web+site+design+developmentw2=Computer+software+developmentw3=Software+design+and+developmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=166.sig=lvQjSRfQDfWudJSe1lLjHw Software design and development http://groups.yahoo.com/gads?t=msk=Software+design+and+developmentw1=Web+site+design+developmentw2=Computer+software+developmentw3=Software+design+and+developmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=166.sig=1pMBCdo3DsJbuU9AEmO1oQ Macromedia flex http://groups.yahoo.com/gads?t=msk=Macromedia+flexw1=Web+site+design+developmentw2=Computer+software+developmentw3=Software+design+and+developmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=166.sig=OO6nPIrz7_EpZI36cYzBjw Software development best practice http://groups.yahoo.com/gads?t=msk=Software+development+best+practicew1=Web+site+design+developmentw2=Computer+software+developmentw3=Software+design+and+developmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=166.sig=f89quyyulIDsnABLD6IXIw YAHOO! GROUPS LINKS *Visit your group flexcoders http://groups.yahoo.com/group/flexcoders on the web. * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service http://docs.yahoo.com/info/terms/ . -- 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 Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM ~- -- 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/ * 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/