Posted: August 20th, 2009 | Author: Ayan | Filed under: Flash | 2 Comments »
They are a dime a dozen – a framework for Flash/Flex and AS3. It’s really quite simple making your own framework. You come up with what you want to accomplish and you develop general classes to accomplish that. It is very much like building a product. SWFWindow was my first attempt at building a framework that I designed and I used on a couple of well-known websites (global leaders in their industries). Now, I am finally planning on releasing it so people can pick at it and enjoy it while it’s still applicable. I won’t be supporting this framework as much as I have supported AssetLoader but I will nonetheless provide the documentation, example code, and code base required to get up and running in SWFWindow projects.
More on this later
Share and Enjoy
Posted: August 14th, 2009 | Author: Ayan | Filed under: General | No Comments »
Recently, I noticed something funny in a code base that I view seldomly. I was scrimmaging through the code of a maintained code base and noticed something sour – duplicated code. Duplicated code is not bad, when it is in the form of syntax of a language (haha)! And that isn’t real duplication! What I noticed was something that frustrates me, and surprisingly, wouldn’t have frustrated me 4 months ago. The duplication was basically 10 duplicated functions that were essentially identical to each other with hard-coded differences that should have been parameters and were written when the quantity of functions were low and the purpose was minor. What really irritates me is that this code has been updated many times and someone, in the words of Andy Hunt and David Thomas, did not fix the broken window. I’m not writing this post to complain, but to rather preach.
If you see something you know just isn’t right, take ownership of the code and fix the problem. It is easy to say it’s not yours or that you can do it next time or that the code base is so old it will be replaced. Well those excuses may or may not be true. But chances are, you will have to look at it again, or someone will, and you should fix it now while you know. If you aren’t familiar with this or it sounds familiar, it’s basically the principle of controlling the entropy within your project, which is preached within 3 of the 4 programming books I’ve read in the last 4 months. Whether it’s building an application, playing a game of pool, or anything for that matter, you should try to control the chaos and be pro-active and decisive with reason.
Thankfully, I fixed the problem. This is something that I do regularly and consistently now that I’ve gone through quite a learning curve. I refactor, refactor, and refactor some more. Perfection isn’t what you can add, it’s what you can take away.
Share and Enjoy
Posted: August 12th, 2009 | Author: Ayan | Filed under: Flash | Tags: AssetLoader, Flash | 2 Comments »
As promised, I’ve updated the AssetLoader and pulled it into the 21st century. It is a lot more… flex-ible if you get what I mean (of course you do). Anyways, as a reminder, you can sync up with the following repository to get the code: http://assetloader.googlecode.com/svn/trunk
A word of warning: the new repository is now a home for all my code related to AssetLoader and that means it’s larger and more complex. What could be in there other than the value-added loading code you might ask? Well, I’ve got loader tests, which include examples to prove to myself that video, sound, images, and xml work (I assume images and xml work since it’s been working since the beginning) and I’ve got unit tests (with hamcrest and flex unit 4). Although the tests and the unit tests are not complete, I will be adding more as I get more experience using video in flash and more experience using flex unit.
A note about the video loading: Take a look at the video example in the AssetLoaderTests folder. You will notice that I have to save a reference to the netStream. In order to close out the AssetLoader and remove all references (clean up for garbage collection), I must null all variables created within the AssetLoader. Thus, if you try to add the video without storing a reference to the netStream, you will either see a blank screen or a frame of the video (however far it got until the netStream was deleted). So, keep a reference of the netStream for all videos you load and show (you can delete the references if you don’t need it of course) in order to get around this issue.
If you really only care about the source code, and I expect most of you to fall into that category, sync up with this repo: http://assetloader.googlecode.com/svn/trunk/AssetLoaderSource
It’s got everything you need to get up and running.
And finally, if you really just want the source to play around, you can download the SWC source from google repository: http://code.google.com/p/assetloader/source/browse/#svn/trunk/AssetLoaderSource/bin
or the zip file here: http://www.ayanray.com/downloads/assetloader_v1.3.8
Comments, feature requests, and feedback are always appreciated! I’m making this class available to help you! If it doesn’t do something that you think it should, hit me back.
1.5 -> Array Support
1.6 -> Perhaps I’ll do support for wave files and other embeddable but not loadable files (through ByteArray)
Share and Enjoy