23  Aug
360|Flex wrap-up

The 360|Flex event in San Jose was a success in my book.  I manned the Simplified Logic booth most of the time, but I did find some time to go to some great sessions.  I learned many tips and tricks that I could apply to my own development efforts.

My session on Encrypting Flex was fairly well attended.  There were lots of good questions from the audience.  I probably could have done a better job preparing for my talk, but I’ll wait until the comments come back from the surveys to flagellate myself over that too much.

Without further ado, here are the materials from my presentation.  The audio will have to wait until my presentation gets uploaded to the Adobe Media Player RSS Feed.

Encrypting Flex, Protecting Revenue, and Making Cash (PDF)
flexembeddingexample1 (zip)
flexencryptionexample1 (zip)
flexencryptionexample2 (zip)
flexencryptionexample3 (zip)

Posted by Andrew, filed under 360 Flex, AIR, Flex, as3, security. Date: August 23, 2008, 8:16 pm | No Comments »

I’m working on some new types of SWF file encryption to demonstrate at 360 Flex San Jose.  If you’ve read my Inside RIA articles, you know that the main technique used by NitroLM to encrypt swf files is to create a wrapper application and load/decrypt the real application using a SWFLoader.  The problem with this technique is that it’s a little bit kludgy and adds deployment complexity.  It also has some difficulty in AIR in that if you wrap an <mx:Application> inside an AIR app, you won’t be able use some of the Native AIR functionality.

I’ve been dilligently working on a new technique for encrypting modular applications.  Basically, you’ll write your flex or AIR app as you normally would and break up functionality into modules loaded by <mx:ModuleLoader>.  You could also put pretty much all of your code in a single module if you wanted to.  Then, when you’re ready to deploy, just comment out the <mx:ModuleLoader> tags and replace them with <nitrolm:EncryptedModuleLoader> tags.

There’s a few other steps including encrypting the module SWFs with an AIR application called AssetEncrypter, but the process is much more straightforward than the wrapper technique.  It’s also much easier for the developer to code because they don’t have to deal with the keys and decryption themselves.  All of the complex functionality has been done for you in the <nitrolm:EncryptedModuleLoader>

Posted by Andrew, filed under 360 Flex, AIR, Flex, as3, encryption, security. Date: June 4, 2008, 11:38 am | No Comments »

Here are my 3 articles for InsideRIA on Encryption in Flex applications.

Encryption in Flex Applications 1 - Simulate EncryptedLocalStore

Encryption in Flex Applications 2 - SWC AS3 Library Encryption

Encryption in Flex Applications 3 - NitroLM SWF Encryption

Posted by Andrew, filed under AIR, Flex, as3, encryption, security. Date: April 4, 2008, 12:25 pm | No Comments »

Since attending 360Flex in Atlanta, I wanted to learn a bit about skinning with Degrafa. For one of my own personal projects, I needed to create some nice scrollbars that would go with my black and purple color scheme. Now keep in mind that I am NOT a designer. Most of my coding experience before learning Flex/AIR centered around backend Java Servlets and other hidden technology. View-Source is enabled if you wanted to see how it’s done. I still don’t know how to get rid of the stupid white box between the two scrollbars. If someone would like to comment and let me know, that’d be great.

Posted by Andrew, filed under 360 Flex, Degrafa, Flex, as3. Date: March 9, 2008, 1:07 pm | 7 Comments »

I'm not really sure what Adobe has been thinking regarding DragManagers in Flex/AIR. The code makes a very basic and very WRONG assumption that in an AIR app using WindowedApplication, you will only ever want to use the NativeDragManager class. DragManager loads up a singleton class to handle drag and drop. Depending on whether your app is AIR or Flex and what your top-level container is you either get DragManagerImpl (the flex drag manager) or NativeDragManagerImpl. Unfortunately, this class has some really annoying limitations. You can't specify an alpha level for the drag proxy. It's hardcoded to 0.5 and there's nothing you can do about it. Here's what adobe has to say about it...

When a Flex application runs in Adobe® AIR™, you can control whether the application uses the Flex drag manager or the AIR drag manager. These drag managers are implemented by the classes mx.managers.DragManager (Flex drag manager) and flash.desktop.NativeDragManager (AIR drag manager).

Internally, the Flex mx.managers.DragManager class uses an implementation class to determine which drag manager to use. It uses either the Flex mx.managers.DragManagerImpl class, or the AIR mx.managers.NativeDragManagerImpl class.

By default, a Flex application defined by the <mx:Application> tag uses the Flex drag-and-drop manager, even when the Flex application runs in AIR. If you run your Flex application in AIR, and you want to take advantage of the AIR drag-and-drop manager to drag and drop items from outside of AIR, then you must configure the Flex mx.managers.DragManager class to use the AIR drag-and-drop manager.

There are three scenarios that determine which drag-and-drop manager your Flex application uses when running in AIR:

  1. Your main application file uses the <mx:Application> tag. In this scenario, you use the Flex drag-and-drop manager, and cannot drag and drop items from outside of AIR.
  2. Your main application file uses the <mx:WindowedApplication> tag. In this scenario, you use the AIR drag-and-drop manager, and can drag and drop items from outside of AIR.
  3. Your main application file uses the <mx:Application> tag, but loads the AIR drag-and-drop manager as represented by the mx.managers.NativeDragManagerImpl class. In this scenario, you use the AIR drag-and-drop manager, and can drag and drop items from outside of AIR.

Now what am I to do if I want option 4? I want all the window dressing goodness that comes with WindowedApplication like maximize, minimize, and a status bar, but I want the fully customizable Flex version of the drag manager implementation. Time to MONKEYPATCH!

The first thing you'll need is to copy the framework classes mx.managers.SystemManager and mx.core.Version into your AIR app at the right locations.

Next, you edit one line of code in SystemManager.as so that it loads the DragManagerImpl instead of NativeDragManagerImpl. Find the method docFrameHandler. You should see a bit of code that looks like this...

Actionscript:
  1. if (Capabilities.playerType == "Desktop")
  2.     {
  3.         Singleton.registerClass("mx.managers::IDragManager",
  4.             Class(getDefinitionByName("mx.managers::NativeDragManagerImpl")));
  5.  
  6.         // Make this call to create a new instance of the DragManager singleton.
  7.         // This will allow the application to receive NativeDragEvents that originate
  8.         // from the desktop.
  9.         // if this class is not registered, it's most likely because the NativeDragManager is not
  10.         // linked in correctly. all back to old DragManager.
  11.         if (Singleton.getClass("mx.managers::IDragManager") == null)
  12.             Singleton.registerClass("mx.managers::IDragManager",
  13.                 Class(getDefinitionByName("mx.managers::DragManagerImpl")));
  14.     }

Now change to look like this...

Actionscript:
  1. if (Capabilities.playerType == "Desktop")
  2.     {
  3.         Singleton.registerClass("mx.managers::IDragManager",
  4.             Class(getDefinitionByName("mx.managers::DragManagerImpl")));

Enjoy your AIR app with the Flex DragManager goodness.

Posted by Andrew, filed under AIR, Flex, MonkeyPatch, as3. Date: February 26, 2008, 8:27 pm | 1 Comment »

maven flex flex-mojos maven flex mojos maven adobe flex maven adobe air maven plugin flex