case
1Feb/106

Create Flex/AS3 applications for Mobile Devices

elips-studio-3-boxYup! Flex Apps on your mobile. And I'm not talking about Flash Lite and you won't need CS5 either.
ELIPS Studio converts the Flex code in native code for Windows Mobile, Symbian, Android, iPhone and mass-market mobiles. It's still beta and you have to register for a beta account to get it but I think will do wonders for the mobile dev. world.

And in their words:

"ELIPS Studio 3 is a plug-in for Adobe Flex Builder, a widely used IDE for internet & desktop application. Our plug-in allows Flex to go mobile!

The product offers a mobile-optimized Flex Framework, plus numerous Flex extensions, including mobile UI components & access to mobile device features (voice call, SMS, access to calendar and contacts, to the camera, etc.)

The product includes a form-factor device simulator allowing you to see your application behavior on different devices. It also includes a network simulator allowing to generate calls, SMS, etc."

So..get it while it's hot 🙂

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

7Jul/096

How to identify at runtime if the swf is in debug or release mode/build

It may be interesting to know at runtime whether an application is running from a debug or release SWF file. It allows the application to automatically execute debug specific code when the file is a debug SWF file and ignore this code when it is published as a release file. Also, it should be nice to know if you have a debug flash player just for the same reasons. But for the last one, there is a function in the Capabilities class called isDebugger.

One solution would be to use conditional compilation. The other solution is in the following code (hack).

package org.adm.runtime
{
	import flash.system.Capabilities;
 
	public class ModeCheck
	{
		/**
		 * Returns true if the user is running the app on a Debug Flash Player.
		 * Uses the Capabilities class
		 **/
		public static function isDebugPlayer() : Boolean
		{
			return Capabilities.isDebugger;
		}
 
		/**
		 * Returns true if the swf is built in debug mode
		 **/
		public static function isDebugBuild() : Boolean
		{
                        var st:String = new Error().getStackTrace();
			return (st && st.search(/:[0-9]+]$/m) > -1);
		}
 
		/**
		 * Returns true if the swf is built in release mode
		 **/
		public static function isReleaseBuild() : Boolean
		{
			return !isDebugBuild();
		}
	}
}

This code simply searches for line numbers of errors in StackTrace result. Only StackTrace result of a debug SWF file contains line numbers. Then we know that we are running a debug or release SWF file.

This class is also available in the Components Pack at Runtime subpackage

24Jun/093

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/092

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.