Flex remoting (mx.rpc) classes in an ActionScript only project? - apache-flex

Is it possible (and if so recommended) to use Flex remoting (mx.rpc) classes in an ActionScript only project?
I'm creating an application with login and registration to a PHP backend using AMFphp.
As an option I was wondering if it made sense to take advantage of the mx.rpc flex classes.

Actionscript only projects still use the flex framework, so you're fine. Are you trying to do it with the Flash IDE, or are you using FlexBuilder? If Flex Builder, then it doesn't matter at all.

You can use NetConnection class too.

You can use the entire RPC framework, including remote objects, but you have to manually initialize it by registering a number of class aliases (the Flex framework would do this for you, otherwise).
This great blog post explains the how and why.
If you're not really interested in the details and just want to get going, I wrote a tutorial on how to integrate BlazeDS with RobotLegs, which includes a framework-agnostic example you can use as a turnkey.

Related

How to make custom UIComponent Accessible?

I added a MXML component in flex and selected the base as UIComponent. I want to make it accessible so that automated testing tools can Access it. I am using TestComplete for automated testing. As TestComplete uses Microsoft Accessibility classes. Now it treat my component as the Graphics.
How Can I do this??
It should work, if the application was correctly prepared for testing with TestComplete. Check the Preparing Flex Applications for Testing with Automation APIs topic to learn more.
You won't have much luck automating Flex using MSAA, because the object hierarchy and information reported by MSAA is very limited. To improve things, you could try compiling your application with accessibility enabled and also creating a custom accessibility implementation for your component. However, I doubt it will make much difference.
Having said that, you should really consider upgrading to the TestComplete 8.20, because this version has proper support for Flex. By "proper" I mean that it identifies all objects inside Flex applications (including custom components), provides extra test objects for automating Flex controls and also lets you automate controls using their native properties. In addition, this version can dynamically load the testing library into Flex applications, so that no changes to the application's source code or build process are required.
Please look at the official documentation about Creating Applications for Testing
Especially the part about instrumenting custom components

Is it possible to create a separate file for httpservices in flex and what are the best practices

Hi I am new new to flex development.
I am building a flex application which uses rest APIs.
Right now I have created different for different API calls (login, logout, search etc.) And all these services are in main mxml application file.
I am wondering if I can create a separate mxml file like services.mxml that I can use to call any service.
Is this the right approach?
And can you tell me how t do this?
Thanks
Priyank
Yes, you can encapsulate Flex code so it is not all in the same file. Yes, you can also do this with services. In fact the Cairngorm framework uses that exact approach. [And I assume other frameworks do too].
When you create a component architecture the trick is figuring out how components communicate with each other. In Flex, a component can dispatch events to communicate with it's parent. And it can have methods or properties so the parent can communicate with the child.
Encapsulating all services to a single is fine, but you'll need to figure out components will access those services and how those services will send results back to the components. It's not a simple proposition.
I think you need to research the flex component lifecycle a bit and read up on creating Flex Components or ActionScript classes.
Here are a few resources:
http://www.adobe.com/devnet/flex/components.html
http://www.adobe.com/devnet/flex/articles/creating_components.html
http://livedocs.adobe.com/flex/3/html/help.html?content=Part4_CreateComps_1.html

Dojo or flex with Grails?

I plan to build a database management system using Grails as the main framework. On the client side, I'm thinking whether to use dojo or flex to make a nice front end.
Could some experts here enlighten me on the pros and cons of choosing either, or both?
or any other options?
thanks!
I tried using Dojo in a project and even brought a few books. And while Dojo Looks good I found that JQuery and JQuery-UI was a lot lighter and worked faster.
This is just my opinion and it may help you.
From the description of the flex plugin at http://www.grails.org/Flex+Plugin
"This plugin was created as an experiment to prove that it's possible to communicate from Flex to Grails services without any configuration in Flex. There
is no plan to add functionality or whatsoever. It's not sure if the plugin works in production mode as it is only tested in development mode. This plugin
can be seen as an example on how to integrate Flex and Grails with Convention over Configuration in mind."
There is no scaffolding generation for flex, see this bug
Another disadvantage of Flex is its lack of accessibility for screen reader users with the default configuration. There is some work being done to address this but it isn't publically available yet.
I don't have experience with DOJO but according to this link if you use the standard Grails Ajax tags you should be able to switch libraries with out to much trouble and won't be tied to Dojo. For fancy UI stuff such as tabbed interfaces and data tables I've found GrailsUI works well for me. A demo project showing its features can be found at http://code.google.com/p/guidemo/ although you'll have to check the code out to run it.
I am developing an information-management application with Dojo 1.9.2 and Grails 2.3.9 (lots of simle/complex forms, listing screens...etc). The application has a single-page interface as well (a workspace) which was the primary reason for a heavy JavaScript library.
Overall, Dojo is fairly suitable for this kind of workload and I haven't bumped into any show-stoppers yet.
I needed to do a lot of work on integrating the Dojox DataGrid into the application (extending QueryReadStore to fit with Grails better...etc) and a set of custom widget extensions (e.g. a real, working AutoComplete).
After this larger, initial integration work is done, you can expect a fairly smooth ride.

Does Flex require PHP framework?

I am new to Flex and have written code in PHP before, but not used any PHP framework like Zend, CakePHP etc...
I plan to use Flex with PHP, for that do I need to use any MVC PHP framework? Do any of the frameworks integrate with Flex for the View?
Although no framework is strictly needed, it can be very helpful. This might help you get started: Flex/PHP framework download and Zend's Flex and PHP. (Google is your friend)
Flex is a client side technology and is completely loose from the serverside technology.
You can use PHP for exposing webservices but just as well java or asp.net
Flex does not require a framework, you could work without. However, using a framework will make it a lot easier, especially for big projects.
A framework is not required but using one will greatly improve your productivity.
You can start looking at the flex tutorials on this site.
You can easily connect your Flex app to a PHP backend simply by outputting your php query results as XML, Flex can read that XML with an HTTPService with resultformat = e4x.
No frameworks required and it's super simple to do.
Hope it all works out for you.

Handling Dependency Injections - Where does the logic go?

I'm working on an ASP.Net website along with a supporting Class Library for my Business Logic, Data Access code, etc.
I'm EXTREMELY new and unfamiliar with the Unity Framework and Dependency Injection as a whole. However, I've managed to get it working by following the source code for the ASP.NET 3.5 Portal Starter Kit on codeplex. But herein lies the problem:
The Class Library is setup with Unity and several of my classes have [Dependency] attributes on their properties (I'm exclusively using property setter injections for this). However, the Global.asax is telling Unity how to handle the injections....in the Class Library.
Is this best practice or should the Class Library be handle it's own injections so that I can re-use the library with other websites, webapps or applications? If that is indeed the case, where would the injection code go in this instance?
I'm not sure how clear the question is. Please let me know if I need to explain more.
Though not familiar with Unity (StructureMap user) The final mappings should live in the consuming application. You can have the dll you are using define those mappings, but you also want to be able to override them when needed. Like say you need an instance of IFoo, and you have one mapped in your Class Library, but you've added a new one to use that just lives in the website. Having the mappings defined in the site allows you to keep things loosely coupled, or else why are you using a DI container?
Personally I try and code things to facilitate an IOC container but never will try and force an IOC container into a project.
My solution breakdown goes roughly:
(Each one of these are projects).
Project.Domain
Project.Persistence.Implementation
Project.Services.Implementation
Project.DIInjectionRegistration
Project.ASPNetMVCFrontEnd (I use MVC, but it doesn't matter).
I try to maintain strict boundaries about projects references. The actual frontend project cannot contain any *.Implementation projects directly. (The *.implementation projects contain the actual implementations of the interfaces in domain in this case). So the ASPNetMVCFrontEnd has references to the Domain and the DIInjectionWhatever and to my DI container.
In the Project.DIInjectionWhatever I tie all the pieces together. So this project has all the references to the implementations and to the DI framework. It contains the code that does the registering of components. Autofac lets me breakdown component registration easily, so that's why I took this approach.
In the example here I don't have any references to the container in my implementation projects. There's nothing wrong with it, and if your implementation requires it, then go ahead.

Resources