As the RIA worker i am starting on providing free education to college students and freshers on Flex/AIR and java development to prepare them for Interview and to open there mind on a rich development practices .. This will be a experimental step to educate newbies , I will be covering the basic application development methodologies and will help them create applications for their projects. Please feel free to contact me at
Windows 7 TuneUp is a great Window utility which makes you forget about PC maintenance and security, Loaded with many tools such as Registry Cleaner,Registry Defragmenter,Junk Files Cleaner, Duplicate Files Finder,Smart Uninstaller,Service Manager,Startup Manager and many more which help you get rid of all the maintenance problems for the system. I recomend this personally as it saved my sysytem from getting crashed and help me save my formatting time. One of the coolest thing is its very easy installation and free support and service. Check out this amazing software at WINDOW 7 TuneUp
I am pretty sure if we are using a application which interacts with other application we need to invoke it using command propmt . Here is a simple way to invoke the application ..Also while invoking sometime we need to pass variables to the application as we do in flash vars..
First of all we need to set the environment variable for accessing the flex sdk in the system.. Add the following path to the sysytem path variable in your environment variable C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\bin
Note : It should point to the sdk's bin location in mycase it resided in C:/ Drive .
To Run the application we will use ADL(AIR Debug Launcher) using the following syntax:- adl [-runtime runtime-directory] [-pubid publisher-id] [-nodebug] application.xml [root-directory] [-- arguments]
In my case i used the following line on my command prompt F:\PROJECTS\Printing\bin>adl Printing-app.xml -- 321 0 active
First i reach to the point where my application bin folder reside(having compiled swf and application descriptor file) then using adl to invoke my application-app.xml
Note:- After the application-app.xml i added -- and then i gave three arguments separated my space.
In the application i can get the aruments as follows :- We listen the following function in the application invoke="onInvoke(event)"
private function onInvoke(e:InvokeEvent):void { var arguments : ArrayCollection = new ArrayCollection( e.arguments ); }
Here i get all the arguments in a arraycollection.
A browser cookie is a small piece of information sent by a web server to a web browser to be stored for future use. The data in the browser cookie will be sent back to the web server whenever the browser reconnects to the web site.
Cookies are commonly used to store user preference information, such as web site options. Cookies are also used to store shopping cart contents. The most security-relevant use of browser cookies is when they are used to store authentication data, such as user names and passwords.
To Read and write Cookie from a flex application we will use Javascript
//Following function will set the cookie in the user browser function setCookie(c_name,value,expiredays) {
value = document.getElementById('user').value; var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate.toGMTString()); }
//Following function will return Cookie function getCookie(c_name){
if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1 ; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)); } }
return ""; }
For reading a cookie Visitor we will use the following line in Flex code:- var visitorId : String = ExternalInterface.call("getCookie","Visitor");
Wondering when ShareThis would actually provide a .swf file to be loaded in the fash file in stead of calling a JavaScript function to open the ShareThispop in the new window. First of all we need to go to sharethis.com publisher section and customize your widget, you will get a javascript code by registering your email address. Here is javascript code what i got :-
// ACTIONSCRIPT CODE private function shareThis():void { var url:String = "http://www.vrathore.blogspot.com"; var title:String = "VARUN-RATHORE"; ExternalInterface.call("ShareThis", url, title); }
Using a javascript code in the html file for opening the pop window // JAVASCRIPT CODE function ShareThis(url, title) { url = window.location; var s = SHARETHIS.addEntry({ url: url, title: title }, {button:false,popup:true}); s.popup() return false; }
Just as we use the applicationContext.xml in java application where we map the classes to the objecys in the context file and mapping the variables in the class files to the properties in the configuration file, we can use a simialr methodolgy in our flex application and get the changes to the variable by just changing in the configuration file , without building or refreshing the application.
Here is the code sniplet which is used to achive the following :- // spring actionscript config var applicationContext : FlexXMLApplicationContext =new FlexXMLApplicationContext("config.xml"); applicationContext .addEventListener(Event.COMPLETE, onApplicationContextComplete); applicationContext.load();
protected function onApplicationContextComplete(event:Event):void { var appConfig : AppConfig = applicationContext.getObject("appConfig"); model.appConfig = appConfig; resourceManager.localeChain = [appConfig.locale];
}
// HERE model.appConfig is the actionscript class which i have mapped to the object in my configuration file. AppConfig.as file is as follows :- package com.infoswell.model.global { [Bindable] public class AppConfig { // src path used as root to locate images, etc. public var srcPath:String = "";
// locale for menu config path // note: curently resource bundle properties locale from project compile options public var locale:String = "en_US";
Step into the ant folder and execute “ant” to see the options. You can create a debug enabled version, a release, documentation. I created the debug enabled version with the following command. Of course you do have to have ant on your path. Do not forget to change the build.properties. You need to change the FLEX_HOME parameter as described in the readme file that comes with the sources.
ant compile-main-debug
The swc file is created in the antbuild/compile/main/swc folder.
Use the swc created in the project libs folder and use this extra ordinary feture to load configuration from outside.
I am not a multi fan of using fonts in Flex , i had to put a very smaller font which was to be very sharp , Here is a example to add it , i tried it in my css but it can be done with setStyle Attribute too, here is the code sniplet and the result Just define following in your css @font-face { src: url("../font/kroe0555.ttf"); fontFamily: StandardFont; flashType: true; } Application { color : #CCCCCC; focus-thickness : 0.4; font-size : 8; font-grid-fit-type :subpixel; font-sharpness : 1; font-anti-alias-type: normal; font-weight : normal; }