Union Platform : a multiuser environment with actionscript

While there are alternatives to actionscript for doing a multi-user application, Colin Mook and Derek Clayton had teamed up (to form User1.net) to do Union Platform. The platform itself provides alternative languages to develop application with, the most notable feature is one can create multi-user applications with actionscript only. Thats a lot of good news on itself. Well, even a sample server environment is free for 1000 users at one time! Huge! Its called “tryuion.com” and provides a testing ground to test your skills for a multiuser application.
The even bigger news is Union Platform is now on cloud in collaboration with Influxis and its at unioncloud.io. Union Cloud is free till its in Beta, so the time is now to build a multi user application with Union Cloud , the feature list looks awesome.
Happy Flashing


Basics of a scripting language

I must say, the more I read the basics, the more I get hooked to the basics. I have just finished reading a book on UnityScript Basics for Noobs. Must not confuse with the name of the scripting language. Since actionscript, javascript or UnityScript or any other scripting language for that matter shares the same ideology. So, if you are new to a scripting language, just get this book reading. And I am sure that will make the basics of your clear. As this book itself says its for Noobs, it is for Noobs but then written very nicely to make you understand the core of a scripting language.

Best of all its free to download too.

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 :)

Flash CS5 and dynamic display object initialisation problem!! (added after first comment: should be “my problem” rather than “problem”)

[ added after first comment : I am adding this in the beginning for not to make a fire out of the post. Well, the problem is actually on my side and not Flash CS5. I have a movieclip whose registration point is buttom-left rather than default top-left. So when adding it to the stage with “new myClip()”, it is getting added to the stage but then it stands upward from stage origin. This at the first glance to the stage makes no sense as no one can see anything above the stage. Instead of looking into this option I dig up the whole lot of other things making me believe that the problem is with Flash CS5 visual object initialisation.

I apologize, if any of you got caught by the title.

Anyway, as far as my study went regarding this subject, I do not regret as it gave me some true insights about the SWF loading with TLF RSL issue.

Here follows the original post ]

Well, this came to me as a surprise as I was breaking down a FLA into parts and getting assets from them. This was working perfect since Flash CS4. So I was going ahead with confidence that it will work perfect in Flash CS5 too !!  But it is not the case. Seems like Flash CS5 behaves very differently while initialising the display objects.

First, lets go through the links which people have already found.

After all these readings, it seems if I use one of these methods, its safe for me to go ahead. So I tried merging the TLF engine in my FLA (the easiest of all solutions).
But that also does not help me either. Geting definition from the SWF is working but the display objects do not get rendered!!
So, I continue digging it.  This time, I wanted it to be really simple. Now my target is to just instantiate a library item in the same FLA stage. Made an FLA with a library symbol named “Box” and the class name  “BoxClip” (with “Export for Actionscript” and “Export in Frame 1” ticked). Then in the first frame I have the code
var box:BoxClip=new BoxClip();

To my surprise nothing rendered in stage!! And no errors given. Well, then thought may be I will make a class for it and see if that makes me render my object. So going ahead I made a “BoxClip” class which extends “MovieClip”. Linked it to the library symbol and tested movie. This time too it does not render my library clip. Going forward, I added a component provided in FlashCS5. And the code is modified as below
var b:Button=new Button();

var box:BoxClip=new BoxClip();

This time the Button component got rendered but still my library clip does not render. Finally converted my clip to a compiled clip and tested the same thing to get the same result.
Well the last option I took is changed the FLA format to new XFL format with a hope to render my library clip, but to get the same old result.
Its not that the library symbol definition is not getting into the environment, its the rendering of the display object thats the problem. For when I trace out as below
var box:BoxClip=new BoxClip();
the output is as follows
[object MainTimeline] [object BoxClip] true

So the object is getting created, its visibility is true. And well its being added to the display list too. As when trying to see the numChildren, it counts the object I have created dynamically.
Lastly I thought might be stage.invalidate() will help, but that also does not help here.
Hope, this helps someone out there.
Good night.

Development update for AIR RC from Beta2

This is exciting that recently Adobe has released an update to its AIR runtime and SDK. AIR has gone from BETA2 to RC. That means as a developer we need some update to out original BETA2 applications. Fortunately the change is not much.

Setting up the environment for development is the same as setting up for Beta 2 applications. I mean, just get the RC SDK and overwrite the FlexSDK.

Setting up the runtime is straight forward as to install the new runtime. There is no need to un-install the beta 2 runtime. The new runtime just overwrites the old one. If you have not yet installed the Beta2 runtime, then do not worry, just install the RC runtime.

Lastly,but most importantly we need to update the application descriptor file for AIR applications. Previously for BETA2 apps the descsriptor was as below,

<application xmlns=”http://ns.adobe.com/air/application/2.0beta2″&gt;

Now, for the RC applications, this needs to be updated as

<application xmlns=”http://ns.adobe.com/air/application/2.0″&gt;

Thats all to migrate your application from AIR Beta2 to AIR RC.

Happy Flashing :)

switch-case or if-else ?

While this is a personal choice for a developer, I found while writing applications, sometimes we just need to go ahead with a simple one conditional if-else and finish it. But imagine if we have a number of conditions to check and need to know actually where it all is going wrong. In this case probably we can write something as

trace(‘This is inside ELSE,resultNumber=’,resultNumber);

In the above case, if we need to check for different “correctNumber” values at different time, we may go ahead and put similar IF statements with an accompanying ELSE for each of the IFs. While everything is fine, I personally found using SWITCH-CASE in this kind of scenarios reduces code and puts us right in the debugging mode from the beginning.

case 45 :
case 60 :

default :
trace(‘This is DEFAULT case and not handled yet!! correctNumber=’,correctNumber);

As you can see, any case not handled, will trace out the default block. Much convinient and sweet :) As I was thinking for a lot of time,what could be the exact use of a “default” case in a switch-case statement, I found my answer in this kind of scenarios.

Writing a SWITCH-CASE and always putting a DEFAULT case with the case not handled in the trace output, is always a handy thing to do for the code which will be handling a lot of coparisions.

Hope that helps someone out there.

Happy Flashing :)