Rich Rodecker’s blog on flash, flex, actionscript, javascript, and php, with a dash of randomness
Archive for April, 2008
Simple Spark
Apr 23rd
So while Internal Server Error was down again…err, sorry, while MXNA was down again, I went and checked in over at Web Worker Daily and found this gem: Simple Spark, a catalog of over 8500 Web Apps, broken down by category with reviews and ratings for each. It’s pretty impressive, I’ve already found a few I would probably have never heard of that look pretty interesting.
(side note: does this now mean that web 2.0 has folded over onto itself and has begun to implode?)
Embedding Bitmap Text in Flash CS3
Apr 19th
Lost a few hours to this one today. I was trying to embed a font in a textfield with the antialising set to ‘Bitmap Text (no anti-alias)’. No matter what though, the font would not display in the text field when embedded. Turns out that internally flash actually renames the font, to ‘FontName_8pt_st’ (substite the 8 for whatever font size you embedded into the textfield). Not sure what the ‘_st’ part is but so far it seems constant, doesn’t ever change. I’m curious to know the reasoning behind this. Anyway, just remember to use the ‘updated’ font name instead of the normal font name, and you should be good.
Flex Builder vs. TextMate
Apr 16th
I was doing a bunch of Flex work for the past few months, and get really comfortable with Flex Builder. There are so many awesome features to aid development it simply kicks ass.
However, my current project is Flash CS3-based, so I went back to TextMate, which I also love. There are many great features in TextMate which eclipse does not do that really make me miss working in it.
My main points of comparison:
TextMate:
- Perceptual Bulk – TextMate feels so lean, where FlexBuilder just feels so heavy. Probably due to eclipse not being a native mac app, but still, I just feel ‘cleaner’ working in TextMate.
- Tab Triggers – I can’t count how much typing I’ve saved using tab triggers in TextMate. Type in a few key strokes and hit tab, and some templated code gets placed…with tabstops mixed in so you can simply tab to the next appropriate place to type. I only pray that someone tells me you can do that in eclipse.
- Column Selection – Another tool of TextMate that i find incredibly timesaving. being able to select a rectangular area of text, and have whatever you type repeated on each of the selected lines, is a blessing. Another thing I wish eclipse would support.
Flex Builder (eclipse):
- Integrated debugger – That pretty much puts the smack down right there.
- Code Sense/Code Completion – Another swift backhand. For being such an awesome text editor, why can’t TextMate handle this better? (yes I know about using the escape key for auto-complete, but that’s pretty weak compared to what you get in eclipse).
- Find in Language Reference – I use this constantly, and as far I know it doesn’t exist in TextMate (for actionscript anyway)
There’s probably a few more but those are what jump out at me. If anyone knows how to get some of the features listed above into the other app, please do tell
Sending Negative Integers through AMFPHP
Apr 11th
There is a weird bug in AMFPHP regarding sending negative integers. If you try and send a number such as -87, it shows up as 4294967209 in php. I did some digging and found on the amfphp forums that it has to do with amfphp's readAmf3Int() method in AMFDeserialzer.php. Here is the updated function that was posted on the forum:
-
function readAmf3Int()
-
{
-
$res = 0;
-
$int = $this->readByte();
-
-
if($int <128) {
-
return $int;
-
} else {
-
$int = ($int & 0x7f) <<7;
-
-
$tmp = $this->readByte();
-
-
if($tmp <128) {
-
$int |= $tmp;
-
}else{
-
$int = ($int | ($tmp & 0x7f)) <<7;
-
$tmp = $this->readByte();
-
if($tmp <128){
-
$int |= $tmp;
-
}else{
-
$int = ($int | ($tmp & 0x7f)) <<8;
-
$tmp = $this->readByte();
-
$int |= $tmp;
-
}
-
}
-
}
-
-
$mask = 1<<28;
-
$res = -($int & $mask) | $int;
-
-
return $res;
-
}
For those unfamiliar: An overview of Flex, FlexBuilder, and the Flex SDK
Apr 4th
I wrote this up for a client, and realized I had given some version of this many times, so since I had it all written out I figured I'd post it here. I was trying to keep it somewhat high-level, as it's generally targeted towards the non-developers.
Originally there was Flash. Flash was built as an animation tool and followed a timeline-based approach. When i say timeline-based, think of a filmstrip, and how it is made of a strip of individual, consecutive frames....that was the concept behind Flash, to make editing those long sequences of animation easier. If you open up an .fla file, you can clearly see that each layer is made up of consecutive frames...those consecutive frames are collectively referred to as a ‘timeline’.
Eventually, people figured out that they could build really cool stuff in flash, even full-blown applications that didn’t really have too much to do with traditional animation. Eventually the timeline metaphor, more than just becoming irrelevant, started getting in the way. People were building apps based more an an individual screen-based metaphor, and creating each of those screens on individual frames of the timeline could often be a chore.
So, in order to accommodate Flash application developers, as well as developers coming from other languages into Flash development that were getting scared off by Flash’s awkward development environment, the Flex framework and FlexBuilder were created. In general, the Flex framework is a code library of components which help to facilitate building applications that run within Flash Player. FlexBuilder is the Flex IDE (integrated development environment...big term for a code editor with some other development-related features thrown in) offered by Adobe, which really just a specialized build of Eclipse, which is an industry-standard open source IDE.
In addition to (or instead of) using FlexBuilder, the Flex SDK (software development kit) is open source, and it contains the Flex source code library and compiler, so you can develop Flex apps in any IDE. Setting up and using the SDK will provide the same results as using FlexBuilder, but requires more time and effort to set up...so you get all the tools for free, but you have to set them up yourself. That’s the tradeoff to using FlexBuilder where everything is prepackaged and set up for you already.
Flex application are written using a tag-based approach, so Flex apps are generally made up of text files containing a mix of markup that looks like html (this is called mxml), and Actionscript 3 code. When the flex application source code is compiled, the compiler turns the mxml tags are into normal Actionscript 3 code, and a .swf file is produced. That .swf file runs in Flash Player, the same as a .swf file produced from Flash.