case
ADM Blog
12Nov/090

ExtendedImage Component

I just finished writing a Flex3 library that will allow you to read a great number of image formats using flex and actionscript 3. The component uses a codec like rendering system, so each time you provide it with a source, the codecs attempt one by one to read the file signature and decide which one is fit to decode the image.
So doing this, it won't matter the file extension or the way you provide the image asset (archived, link, base64 encoded, plain text, byteArray or embedded at compile time)

It's a work in progress but curently I've made codecs for the following formats:

  • PointLineCAD 3D objects (*.p3d)
  • Photoshop images (*.psd, *.pdd)
  • ZSoft images (*.pcx)
  • Truevision TGA (*.tga, *. icb, *.vda, *.vst, *.win)
  • Windows icon files (*.ico)
  • GIF images (*.gif – static and animated gifs)
  • JPEG images (*.jpg. *.jpeg, *.gfif)
  • PNG (Portable network graphic) images (*.png)
  • Windows Bitmap images ( *.bmp, *.rle, *.dib)
  • Adobe Shockwave Flash (*.swf)

As I said before, the way you provide the source doesn't really matter. You can zip up all your images in an archive and as source you can just point to the file inside the zip.

1
<adm :ExtendedImage id="img" source="archive.zip://image.png" />

This way, you greatly reduce the number of requests to the server. But this is not all. Source can be also provided as a base64 encoded string, or as plain text (only p3d can take advantage of this since the p3d file is plain text as well).

For a bit more details, a demo and API description, visit this page

24Jun/090

Ho-To: Install Alchemy

For those of you who tried but didn't succed, I found some straigthforward instructions for this.

Setup Hell:

Install cygwin to "c:\cygwin" - make sure to check boxes to install Perl, "Archive" (ZIP), and Devel/gcc:g++ (3.4.4.3 presumably) (is Perl necessary?)
Copy the alchemy directory to: c:\cygwin\home\Lee
Copy the flex sdk bin dir from c:\program files\etc to "c:\flex" (to avoid paths with spaces in it!)
Run the alchemy config script once:

   run cygwin
   cd alchemy
   ./config

Edit the textfile "C:\cygwin\home\Lee\alchemy\alchemy-setup" and uncomment and edit line 22 to: add "export ADL=c:\flex\adl.exe"

Edit .bashrc (in C:\cygwin\home\Lee)

   echo "LEE PROFILE"
   export FLEX_HOME=~/flex
   export ALCHEMY_HOME=~/alchemy
 
   # "This should be added before your PATH is modified" !!
   source /home/Lee/alchemy/alchemy-setup
 
   PATH=$ALCHEMY_HOME/achacks:/home/Lee/flex:$PATH
   export PATH
 
   alc-on

Do this (just once, I think):

   cd $ALCHEMY_HOME/bin
   ln -s llvm-stub llvm-stub.exe

Compiling a SW:

CD to the directory with the source
Always do "alc-on" before compiling, cuz it doesn't work without it even though i added it to the startup (dunno)

    gcc stringecho.c -O3 -Wall -swc -o stringecho.swc
    -- should give you a swc.

Import the swc into your flex builder 4 project and make sure compiler targets SDK v4

Shortcuts

alc-home - takes you to the Alchemy install folder.
alc-on - puts Alchemy gcc toolchain replacements at the front of your path.
alc-off - restores original path.
alc-util - shows you various Alchemy-related environment vars

USEFUL TO KNOW

which gcc - tells you which gcc it will use (should be the one in the achacks dir)
ln - links shit
rm - deletes links as well as files

Ugh: Make sure to do "alc-on" and "alchemy-setup" even though you put it in the startup script :( (?)

...

Objects:
AS3_Val
AS3_ArrayValue

Methods:
AS3_Release
AS3_LibInit

9Jun/090

Flex Components Pack

list I've just started working on a set of Flex components which I call Flex Components Pack. I've only managed to make 11 components till now but I'm still working and have a lot of ideas on my to-do list. If any one of you is willing to help I would be very glad to get an extra brain in here. Just drop me a comment or something and I'll share the road-map and SVN path with you.

I've made a page where I will add tutorials, code examples and runnable demos as soon as possible, so check back soon. Till then, you can download the library and take a look.

Update:

(13/06/2009) - Added 5 more components. A simple but nice led light switch and 4 visualisation effects (EQTunnel, EQLine, EQWave, EQBars - winamp style). Just drag and drop the EQ on your app and it will animate any running sound inside your flash.