Flex basics (and Flash)
Well, for a lot many people out there, this may be a very basic thing,but its very bad to see people still live in a dark area on the Flash platform. Fortunately(or unfortunately) I was been to a knowledge(regarding Flex and Flash platform) sharing program of a big organisation. To my surprise, the presenters were quite experienced (if we count number of years of their presence in Flash development and the things they have worked on before). But when the talk began I am surprised again that these guys are talking their own assumptions to a very fresh and dynamic crowd(who are following Flash from the early days and really know the inside of flash timeline,AS1,AS2 and AS3).
For people out there who really are following Flash because of its richness in graphics and animation and the easiness of adding interactivity to it, never get a chance to become a Flex developer for they are confused, what Flex is,and whom they think as their mentors are confused by themselves with their own assumptions. These guys(mentors) do not even read internet,never get down to write some code for their own doubts!! So the point is how companies can promote these guys to talk their minds out to such a vibrant resource(who can create wonders if allowed to learn the right thing) and make the work environment from vibrant flash community of developers to a confused-self assumed individuals ?!!
Well without further diving into my experience I am penning down the basics of Flex, what it is and what can I do with my Flash skills? But before that lets see the basics of SWF,FlashPlayer and Flash platform.
1. SWF stands for Shockwave Flash (not Small Web Format)
2. Flash is a Platform (Flex is not. Its a Framework.)
3. Flash does not mean Flash IDE (“Flash IDE” is just another tool to create SWF, so as “FlashBuilder”)
4. SWF struture is one (FlashPlayer never goes on reading the SWF to detect whether its made with FlashIDE or FlashBuilderIDE)
5. What Flex can do is a subset of what the Flash Player can do,not a superset.(ref : Mrinal Wadhwa)
6. Flashplayer internals are not closed,anyone and everyone on Flash world should know it
With all these, what can I do with my flash/actionscript skills? The question is still there for me. Ok,ask yourself what do you do with your skills now? Are you making games,interactive portfolios and engaging product demos? Do you work on each project from ground-up? Are you using some flash libraries out of many available today?I mean for loading assets,adding effects or making animations, do you do all these with Actionscript’s default classes or use some other libraries or you have already made some actionscript classes for all these repeatative kind of work. The last question, have you made atleast one class file which you generally copy-paste in some of your other projects so as to use the functionality you have already made long time back. If yes, this is the starting point of a code library or framework. While the definition of a framework may be much more technical but the beginning of it is code-re-use. So you have a class which can be used in a lot of other projects though not all. Thats good, now write another class which can be as portable as your first class. Now try and use it in another proejct. If you are successful,then think of some classes which can give you power to get rid of the regular tasks of doing the same thing over and again. Roughly put it can be called your own framework which you can use to write your own applications or if you share with someone else, those fellows can use your framework to get-rid-of the regular pain you were facing.
Now if you think,so whats the point? The point is FLEX is a framework! Am I kidding!! No,Flex is a framework and thats the bottom line. Its simply a collection of actionscript classes. So why its making so much of noise?! Because the framework you wrote a while ago might just help a very specific purpose,while FLEX framework helps all kind of data driven applications. Flex framework provides another way of writing your actionscript code too. Well,do not worry,if you think I need to learn another language?! NO,its the same actionscript but written in a declarative language as XML. Adobe(formerly Macromedia) named it MXML. Instead of actionscript in “.as” files you will be writing actionscripts in “.xml”. That simple!! Yeah,but then as in XML,you can define your own tags,in MXML you have to obey some specific tags(like in XHTML,you have to right <HEAD> and <BODY> etc). Wait a min,you just said Flex is a framework,why I will need that MXML to use this framework,can not my actiosncript knowledge do the thing. Ohh yes,of course, you can write only actionscript code to use Flex framework after all this is just another framework. So why are you confusing me with MXML? Because,writing in MXML lessens your line of code. OHH!! :) :) That makes you smile again. Good,lets see what else can we do with Flex framework. Except from the classes which makes your data transactions easy, Flex framework comes with a Layout Manager,Pop-up Mamanger and a lot of components. Now you are thinking,why I have to use components!! I have always neglected them in my FlashIDE. The answer would be, if you would have used components in FlashIDE,you would have come to FlexFramework much easily. I mean Flex framework give you components too. If you want to create a “Button” you can create with “new Button()”. Ohh! That I always used for new symbols from library but never used for components as I always try to neglect them or avoid them. No problem,start using them and you can see they are your friends not enemies. Even FlashCS4 component skinning is straight forward as to design a movieclip. And a last point as Flex comes with a compiler to compile your actionscript code. So you do not need a FlashIDE to produce SWFs. You mean to say from commandline if I write some instructions,that will create a SWF file out of my actionscript code(or MXMl file)? Yes. Then how to customise those Flex-framework components,I always hate those default colored compoenets even in FLashIDE? For these tasks also Flex-framework gives you a lot of classes,by using them you can color,style and animate your components. There is a way even to make your components in Flash and using them in Flex framework. But all those will be a different topic as a whole.
That means, Flash can do what Flex can do.Yes, because Flex is a framework. As your framework was intended for a certain reason,Flex framework too is intended for certain reason. It can effectively used for a data-driven application. But then you can do the same with Flash with a lot and lot of extra code. The same question comes why flash,Flex framework can do my application.Yes,but when you need pixel level perfection in your content Flash can give your artist all the tools to create beautiful and engaging graphics and animation.
If someone says I am a Flex developer and do not know what flash is? Ask him/her, are you talking about the framework? Well,I never come across that kind of projects to use that particular framework but I am quite comfortable at Flash and used a lot many other frameworks for my work,when the requirement will come I will read that framework too. There is nothing wrong in sticking to Flash-actionscript only, if your job requires this. There are a lot of frameworks on actionscript only which do their jobs best and can be helpful to you as a Flash-actionscript developer. But then its always better to know what the other framework is and how it works,so once you get time dive down the Flex-framework and see if it helps your job. There is nothing wrong in studying this,but this is obviously wrong to think someone superior because he/she knows one particular framework and does not know the basics.
Happy Flashing :)