Well, your Flex application is already in production. But how do you plan to deploy future patches in your code? I mean all the bugs or évloutions specific MXML components or ActionScript classes? Of course, you can recompile the entire application with hundreds of classes to deploy a new version of one of your classes. We will see that there is a way to deploy a single class, leaving the rest of the application intact. In the Java world, the solution is quite simple. A typical Java application contains many files. Jar files (think libraries or swc:)) and there is the concept of "class path". If a program needs to use a class, the Java class loader tries to find it in the jar or classes listed in the "classpath".
If there is more than one version of the class in the path, the "class loader" will take the first. This greatly simplifies the deployment of patches in Java applications in production. Simply make the changes in the classroom and put it in the har that is used in the classpath.
Then deploy this jar in production, and the class loader will be delighted with the news of the verzsion classe.Et Flex in all that you say? You can use the same technique in Flex, which also has the concepts of classpath, class loader and libraries.
Go to the "Properties window" of your project in Flex Builder and look at the "build path" of your application. At a minimum, you can find all the libraries (compiled swc files) that represent the Flex framework itself.
At any time, you can create a new Flex Library project "called" patches "for example. To compile the project in a swc, add an empty ActionScript class here.
We will use "patchs.swc" as the first item in the build path of project proncipal.
Important: We will link the library ave the main project as a "Resource Shared Library (RSL), which means that bojets from" patchs.swc will not be compared to the code of the main application, but will be responsible for the execution of the application.
Add the compiler option-debug = false to your Flex library project "to remove the error message the Flash Player application or the debugger for this RSL is located.
Now go to the path of your Flex application and add main "patchs.swc" at the beginning of the list. Select the type of link RSL as shown below:
Back in the properties of your Flex project and add the patch to the library in the list of references of the project.
Now run your main project - you should see no difference because the "patchs.swc" must not contain code.Ensuite, copy one of your classes from the main application to the patched library project, and change the re-compile the "patchs.swc.
Now Nouy have two versions of this class - the news is in the "patchs.swc" and the former in implementing the run-principale.Re applcations Main.
You will see the new version of the modified class is used. The class loader uses the new version since "patchs.swc is located at the top of your application classpath. That's all there is to besion Each time you need to make minor changes in your application into production, it will suffice to make them in the "patchs.swc" and upload it on the production machine .
Source: Faratea Systems
If you come for the first time on Flex-info.fr, you can subscribe to the RSS feed. Thank you for your visit!




















February 7th, 2008 at 12 h 47 min
Hello!
Bye
Nice site