Adobe labs releases iphone packager update

After all these past days of confusion and curiosity about Flash and iphone ( or I may say Adobe and Apple ), finally the good news is both are working together. Whether they say it or not, for me as a developer (without jumping into behind the scenes) I can see the best of both worlds. Finally, Apple has removed the constraints put forward to third party packagers and Adobe has resumed development of its Flash to iphone packager.

Yesterday Adobe released the first update to its flash to iphone packager as a separate independent downloadable. The download is available at AdobeLabs and here is the direct link.

Happy Flashing πŸ™‚

Encapsulation : How ? Its a Dynamic Class.

This is in continuation to the previous post, Encapsulation:Why? , I thought it makes sense if we talk about the same principles to apply in a dynamic class.
First thing first, what is a Dynamic class?! Well, for those who are from AS1 and AS2 days, its in the blood kind of thing. We create an object then add on some properties to it in the runtime. But AS3 seems to take that freedom out. Well, not really, there are still some dynamic classes out there in AS3. Our very basic MovieClip is still a dynamic class. That means, we can still create new properties and methods in it. While the Sprite class is not.
Any new class we make in AS3 is known to be something called as a Sealed class. These classes cannot be modified to have new properties or methods in runtime. Whatever propeties and methods are declared at compile time is only available at runtime. So how to make a dynamic class, its just to declare a class with dynamic keyword as

public dynamic class MyDynamicClass
instead of
public class MyDynamicClass

Well, thats cool and fine. But why I would make one? The question may be answered by the way one designs an application, chances are you never want to make one or may be you just need some. So its all kind of depends how you want to program your application. Now if we make a dynamic class and add some properties, then how to controll its getter and setter as we have discussed earlier about controlling for a sealed class.
There is a very nice utility available at flash.utils package. Its the Proxy class. This does exactly, the same thing as we are searching for. Its a class, which is never being used by its own. Never instantiated. The only way to use it is to subclass it. Go over to the documentation to see a complete overview of the class.
Now lets jump directly to the code and see how it works. Then we will go on details about what it does. I think that way we can relate things while talking.Β  My proxy class begins like
public dynamic class MyProxyObject extends Proxy
{
}

Continue reading “Encapsulation : How ? Its a Dynamic Class.”

Version control with Flashdevelop


This is probably the most awaited release of FlashDevelop. Now that completes a perfect IDE. The new version of FlashDevelop IDE has built in support for SVN and GIT both. Provided you have to have tortoise SVN and tortoise GIT in your machine. For SVN part, the IDE installer has made it available too by bundling SilkSVN with it. So installing tortoise SVN is just seems to be optional. Thats some kickass IDE feature. I have just tested it with SVN and GIT both and they work out of the box.

These version control systems are not activated by default. You have to go inside settings and activate them. Or else they do not seem to exist in the IDE.
Another nice integration is the option to select whether to install Flex SDK with the FlashDevelop. This is being asked when you install the IDE. That means, if you do not want to take the pain of downloading the FlexSDK separately it will do it for you.

Thats all for the time being, I am so excited and happy that finally this beautiful IDE added up the things which now makes it a perfect tool for flash a developer.

Happy Flashing πŸ™‚

Encapsulation : why?

Now, I remember, I had this question when developing my first framework. At some point in time, when developing your own framework of some kind, you must be asking the same question. The question is “Why I will make properties of a class private?! When everyone is capable of accessing it, why properties would be private ?”
This reminds me of my first dive into the object oriented programming in Java. All most all the books, explained that, all the properties of an object should be private with its getters and setters as public. I asked myself, it does not make any sense to write some more lines of code for the same thing. If at all, user needs to access my properties, I can make them public at the first place.
The answer was not clear at that point in time. But as I went along and developed some couple of more frameworks for my projects, the encapsulation part slowly made sense to me.
Encapsulation is not data hiding. Yes, you heard it right. Its not hiding the data. Its bundling the data with some methods to regulate the process, how those data can be manipulated.
Lets take an example, Ball is an object, which has to be moved across the stage. Well, in that case, we can write a Ball class and use it to move by changing the x and y position of it. Thats straight enough. Now, if there is a requirement that the Ball must be moved in straight line from left to right, then what happens. We comeback to our main file, or the stage file, or wherever we have used our Ball object to move. change the code and we are done. Impressive! In the process actually we are modifying something else, not the Ball Object. Though the requirement for Ball has changed, because of our way of coding, we have to modify some other class so as to fix the problem. There comes the solution of encapsulation. What if all the movement code are there with the Ball class. In order to move it, let there be a method named “moveIt()”

public function moveIt():void
{
//Do code for moving the ball from left to right
}

Now, all we need to do is, hide the ball movement code inside our Ball object. The calling object will just call the method named “moveIt()” of the ball object. Incase there is a requirement change, and now the Ball should move from right to left, there would be no worries as to where and how to change the code. The only thing which will change is the implementation of the moving ball code inside the “moveIt()” method. There may be a direction property of ball object, which will check the direction of movement of the ball. That also could be implemented inside the “moveIt()” method as below.

public function moveIt():void
{
//if the ball is moving from leftToRight
this.direction=”leftToRight”;
//Do code for moving the ball from left to right
if(this.x>=MaxWidth)//ball reaches the rightmost point
{
this.direction=””;//no direction now, as ball is stopped moving
// stop the ball
}
}

Similarly if requirement is to move it from right to left, the code will look as below

public function moveIt():void
{
//if the ball is moving from right To left
this.direction=”rightToLeft”;
//Do code for moving the ball from right to left
if(this.x<=0)//ball reaches the leftmost point
{
this.direction=””;//no direction now, as ball is stopped moving
// stop the ball
}
}

Now we can see that the private property “direction” can not be accessible from outside. but its only used inside the Ball object. So the data is encapsulated. We can still interact with it but not directly. The rules could be set as to how to interact through the public exposed methods.

Another example would be, suppose we have a property of an object, which is always a multiple of 2. But then we do not want our user to know that the property is always a multiple of 2. So we may expose the setter method as to take any integer, but internally we will be storing that as a multiple of 2. The code would be something like below

private var _myNum:int;
public function get myNum():int { return this._myNum; }
public function set myNum(value:int):void
{
this._myNum = 2*value;// we are not storing the user value directly
}

Now it makes a lot of sense to have all the properties as private. Only expose those with setters, which are really needed to be exposed. Another advantage is, any requirement change will just make us change at one place (if the value should be multiple of 3 instead of 2, we just change the setter).

Happy Flashing πŸ™‚

Glimpses of Flash Platform Summit

Well, took me sometime but here are some of presentation videos, comprises of BCI demo by Alvin (@zhangyb).

Happy Flashing πŸ™‚

Back from Adobe Flash Platform Summit

The meet is over and I must say, for me, it was a nice experience. It was the virtual media, the internet which allowed me to connect with so many people in past years. All the time I was thinking of meeting them in person and this meet allowed me to do that. Met with almost everyone I thought I will meet. But then missed some too.
Its the nexus, I was looking forward to and good that I made it.
The community is really vibrant and got inspired by a lot of nice talks.
Alvin (@zhangyb) delivered a talk on BCI ( Brain-Computer Interface ) with the demonstrations, on one of the demo, he changed the colour of an application with his thought.
Mrinal (@mrinal) was excellent with his explanations on the pixels, matrix and how they work on flash world. His demo comprised of effects like “genie effect” on Mac.
Arul (@_Arul) announced and demoed his new opensource framework, which will be available around next week.

Apart from the talks in the auditoriums, the most critical and influential talks happen outside and in very informal way. Glad to meet the never met before Vipin (ohh! people know him as @flashchemist πŸ™‚ ), Mark (@markadoherty), Arul (@_Arul), Mrinal (@mrinal), Abdul (@abdulqabiz), Mariam (@mariamdh), Hu Shunjie (@shinchi), Alvin Zhang (@zhangyb) and a lot many cool ones. Felt bad as I missed some too 😦 . For me it was the connection and glad that I made it to the meet.
One thing for sure, my avtar needs an update πŸ™‚ I have to go to people and an introduce myself as Saumya :), I think for the same reason a lot might have missed me too, sorry for that to all and specifically to Saurabh Mathur(@sawrb).
Overall, it was a good meet for me to get connected. If you think about sessions only, then think again, most exciting things happens outside of it. And the best part is all the cool ones are most social ones too. One can reach out to anyone and start discussing at anypoint. Good to have a community like this.

Happy Flashing πŸ™‚

Game Engines for Flash

Its been a while since I looked into the gaming side of the Flash. In the early days it were all hacks to get things done for an effect to happen. Now as the Flash platform is matured and put itself as a major player for game development, the complexity of the development also increased. Fortunately all the good things, which happened to the matured languages, is happening to Flash now. There are some nice frameworks and engines coming in. When game programming demands a completely different mindset and process, the conventional application development frameworks can not be fit in this place. People and companies have tried and ported the best game engines and physics engines to flash. Below is a list of 3 frameworks/engines , which are kind of setting themselves as the major gaming engines in Flash.

  1. PushButton Engine
  2. Flixel
  3. FlashPunk

All of the above engines are opensource and already showing a fan following and promise to deliver quality gaming.
Personally I have not yet tested anyone of these. Will update once do some hands on.

Happy Flashing