The public release of my ActionScript framework is now available. Check out the shiny new site where you can find documentation and a user guide to help you get started. To make it even more simple, the site comes with Boilerplate, a utility that creates either a Flex or pure ActionScript project at a single click of a button.
I really think that the learning curve for this framework is minimal compared to some of the big names out there. I think that this is important for some less experienced programmers and some jobs that just don’t need a giant framework to get it done.
I don’t know how much I’ll be updating this framework, it really depends on the community. If it finds a place out there, then I will add to it and make it better. It also depends on jobs I get where I need to make something in ActionScript. If this framework is suitable for the project, I will probably improve upon it as I see where it needs improvement as I work.
A special thanks to Markus Winkler for taking a look and giving his input. You can check out his site here. You can follow the Cyntaxic framework on Twitter.
I just finished up the first public beta release on my ActionScript MVC framework, Cyntaxic. There is going to be a site launch for it coming soon. Right now, the beta can be checked out from my SVN repository. Comments are very welcome. The best place to put those comments is here until the site launch. The documentation can for the framework can be found here. I may make this prettier, or just less Adobe docs looking, but we will see about that for the official site launch.
Also, check out the demos built with Cyntaxic. The Stickies demo is a pure ActionScript application showing off view management and the Cyntils demo is a Flex application displaying the Cyntaxic’s utility classes. The Stickies demo can be checked out from here and the Cyntils demo can be checked out from here.
I have been using CodeIgniter on my most current project and I am really happy with the way it works. If you know anything about MVC and OOP, there is very little learning curve to get moving with this framework.
CodeIgniter allows you to create views to display information passed in from the controller and the models of the application. Usually if you are sending arrays of information to display you will have to loop over the array. I like to write as little markup as possible so I nest views of markup that are reusable. I came across a problem where I wanted to load a view in the middle of a loop and have that nested view be aware of where it is in the loop. I needed the information from that position in the loop. The nested views have access to the variables sent by the controller, but doesn’t keep track of foreach iteration variables.
Here is the solution that I cooked up to get that information over to the nested view. Instead of using a foreach loop I use just a for loop and pass the iterator over in the view’s data parameter. Below is pseudocode of how this might look.
<?php for($i = 0; $i < count($items); $i++): ?>
<h1><?php echo $items[$i]['title']; ?></h1>
<?php $this->load->view('nestedview', array('i' => $i)); ?>
<?php endfor; ?>
One thing I don’t like about the AddThis API is that it doesn’t give you the ability to get all services to make your own custom visualizations. You can only make a bookmark URL one link at a time. If there was some way to get all the services listed you could loop through them in any programming language and make your own organized listing of all the services and attach the link accordingly. Whether that was a just a scroll box or some kind of crazy over-the-top 3D Flash thing it would be possible with such an API. I suggested this idea of a Supported Services Data API on the AddThis forum. Read more …
While bug hunting I came across this very unusual bug. In a project that I am working on, I am using multiple unique instances of the LocalConnection object to communicate between an AS3 master and an AS2 slave. These LocalConnection instances use a random number to keep them unique, so each time the program is reloaded it makes a new LocalConnection instance. After refreshing the browser exactly 8 times the LocalConnection object stops sending out messages. I remember reading about an 8 connection limit somewhere, but I didn’t connect the dots until right now. These dots suck to connect. Read more …
I went to go upgrade my copy of XAMPP today from 0.3 to 1.7.2. Following the instructions on the XAMPP site I removed the old XAMPP from the Applications folder and put in the new one. The instruction was simple enough. The instruction was singular; not even plural. I went to boot Apache and it started fine. MySQL did not do as hot. I got this dialogue when I tried to boot up MySQL. I went through the next necessary diagnostic steps: curse, restart, retry, and curse. Read more …
Sometimes when I check out other people’s code I see things that I never do when I program. Sometimes they are kind of cool and if I like it enough, it becomes part of my workflow. While looking at some code the other day I saw something that I have never seen before. Variables defined in a comma delimited list. Below is how I normally go about defining variables.
The above can also be defined shorthanded using a few less lines. It’s a little thing, but you end up not rewriting the variable declaration every time this way.
var red:uint, grn:uint, blu:uint;
var i:Number, f:Number, p:Number, q:Number, t:Number;
When externally loading a SWF, the file is casted to a MovieClip object. The top left position is preserved when it loads in but you lose a few things that could be helpful. First of all your background color is gone (As far as I know). This is the color that is set in the Properties panel in Flash or the SWF meta tag in Flex. The other thing is that the dimensions aren’t preserved either. If you trace the SWF file’s width and height it will return the width and height of content inside and not the bounding of the original SWF file. But there is somewhere that this information is preserved. Inside the LoaderInfo object. To obtain the size of the loaded object just write something like this. This short example is an example of snytax and is not actual functional code.
trace(extFile.loaderInfo.width + " " + extFile.loaderInfo.height);
There is the other information that the LoaderInfo object retains like actionscriptVersion and frameRate. A full list can be found in the reference guide. Like everything else AS3.
Here are some quick one line wonders. From reading some stuff here and there I was able to fashion 2 functions for handling the conversion between hex strings and unsigned integers. Most of the time a uint is asked for when it comes to color, but some things like the StyleSheet object asks for a string value of a hex color like you would use in CSS.
I guess these function names got a little long, but they are very descriptive to what they do, and when you use Flex with it’s completion function name brevity isn’t as much of an issue as it is with Flash.
return uint("0x" + hex.split("#"));
return String("#" + (num.toString(16).toUpperCase()));
If you want to get a query string off a SWF file name there is a short line of code that does it. This is one of those things that I just can’t figure out logically; I just have to memorize how to do it. I’ve done this once or twice before in AS2 and it was a little bit easier then. This points to the LoaderInfo of the main SWF file. Then you get the parameters property from there. The FlashVars parameter in the SWF’s HTML page does the same thing as adding a query string to the file name.
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
For the SWF file name “player.swf?src=video.flv” the code to get the src value would be the following.
var src:String = paramObj["src"]; //would get "video.flv"
var srcAlso:String = paramObj.src; //same using property instead