I needed to do some uint to hex conversions for some zip compression stuff I’m working on, so I did the obligatory google search… and only found posts asking ho to do it, but no code. So I wrote it…
public function uint2hex(dec:uint) : String
{
var digits:String = "0123456789ABCDEF";
var hex:String = '';
while (dec > 0)
{
var next:uint = dec & 0xF;
dec >>= 4;
hex = digits.charAt(next) + hex;
}
if (hex.length == 0)
hex = '0'
return '0x'+hex;
}
Commented version after the jump (more…)
Filed under: ActionScript 3 (AS3), Flex by tyler Tags: ActionScript 3 (AS3) > Convert > Function > Hexadecimal
No Comments »
I’ve been getting a lot of emails about Cairngorm Creator going MIA… Don’t worry, I’ve got a replacement for all of you: It’s the AIR version of the app!
I’ve got some bad news too… I’m no longer maintaining the application. Instead I’m working on a little AIR app that allows you to generate code for ANY framework (yes you read that right). I’m calling it Code Helper. It uses XML structure definitions combined with XSL transformers to allow the user to create code for just about anything. Stay tuned for more, but in the meantime:
What you download is what you get; no warranties, guarantees.
It’s free to use but please don’t distribute it (just link to my site).
UPDATE *******************************************
In the version below I set the default templates to a modified version of Cairngorm.
Quick fix (after air app installation):
Select “Templates” on the left
Choose “Command”
paste the text of “command.txt” (in zip file)
click “Apply Selected Template”
Choose “Command (Responder)”
paste the text of “command (responder).txt” (in zip file)
click “Apply Selected Template”
Then click misc->make active templates default
Download CairngormCreator
Filed under: Air, Flex, Tips & Tricks by tyler
3 Comments »
Here’s one from my library… This class will allow you to calculate mortgages, car payments, annuities, etc. The code is after the jump…
(more…)
Filed under: ActionScript 3 (AS3), Air, Flex, Mainline Framework, Tips & Tricks by tyler Tags: ActionScript > Air > Financial > Flex > TVM
No Comments »
I’ve added the first Mainline framework example to the Mainline Page. It shows how to set up a basic project, add commands, add registries, inject values, and the three basic methods of executing commands. Check it out!
Filed under: Mainline Framework by tyler Tags: ActionScript > Air > Dependency Injection > Flex > Mainline Framework
No Comments »
I was playing around with some RSL (Runtime Shared Library) caching in Flex Builder and came across an interesting bug. It seems that when one changes a project’s SDK (from 3.3 to 3.2 or 3 or vice versa), the SWC’s RSL’s URLs in “Project Properties->Flex Library Build Path->Library Path ->Flex 3.x->framework.swc” don’t update! It apparently puts the new RSL contents under the old RSL’s name (both the swf and swz).
This can cause all sorts of errors:
Flex Error #2034: An invalid digest was supplied
Flex Error #1001: Digest mismatch with RSL
It gets better… Framework RSLs are shared across domains, so if a user has already cached a bad RSL, then they’re going to have to download the SWF version of the RSL every time, effectively making RSL caching useless.
To get rid of invalid cached RSLs in OS X delete the contents of [username]/Library/Caches/Adobe/Flash Player/AssetCache/
To fix projects either revert to the original SDK, or delete the project (not the contents) and create a new one with the desired SDK in it’s place.
Link to the bug report: http://bugs.adobe.com/jira/browse/FB-18703
Filed under: Flex by tyler Tags: Errors > Flex
No Comments »
As I was getting everything ready to put every thing for my Mainline Framework up onto googlecode, I realized I was going to need a quick way to get rid of all the hidden “.DS_Store” files that OS X loves to make and the “.svn” folders in the depths of my source folders (I don’t want all that stuff in the zip file… just the good stuff!). I came up with the following solution:
(more…)
Filed under: Tips & Tricks by tyler Tags: Automator > DS_Store
1 Comment »
Mainline for Flex, Air, and ActionScript is an easy to use dependency injection and IoC framework. It’s flexability and ease of use and customization make it the perfect choice for everyone from developers just getting started to developers who want to switch frameworks without completely altering the design patterns they’re used to using, and of course it’s a no brainer for the developer who just needs a new tool in the arsenal.
I’m hosting the project on Google Code:
Download Mainline
Mainline Homepage
Mainline Wiki
I’ll be posting more tutorials and examples so check back soon!
Filed under: ActionScript 3 (AS3), Air, Flex, Mainline Framework by tyler Tags: ActionScript > Air > Dependency Injection > Flex > Mainline Framework
No Comments »