26  Apr
flexvizgraphlib

I was working on enhancements to the NitroLM admin tool for visualizing users in the system and what computers they’ve used. When it comes to licensing software, knowledge is power, and the visual links really demonstrate well when someone isn’t doing what they’re supposed to be doing. We called this guy in the UK about how his demo of our software was going. He thought it was great and really useful software, but he didn’t want to have his boss actually “PURCHASE” it for him. His solution was to keep re-registering for demos under new gmail accounts. His machine is going to be blacklisted in the system in short order.

To do the visualization, I used the open-source library flexvizgraph. You may remember it from the BirdEye application. This new feature in NitroLM really highlights the power of the Flex/AIR visual environment.

stealing software

Posted by Andrew, filed under AIR, Flex. Date: April 26, 2008, 5:47 pm | 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 »

Well, my flight has been booked. I’m officially going to 360 Flex in Italy. It was really cool of the 360 Flex conference guys making the first of 3 days free and open to the public. Hopefully it’ll get those people who were on the fence about it to make the trip.

I haven’t worked much on this blog lately because I’m finishing up 3 articles for InsideRIA.com on Encrypting Flex Applications. I’ll post links to them here once they go live.

Posted by Andrew, filed under 360 Flex, Flex. Date: March 29, 2008, 5:42 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 | No 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.
monkeypatch1

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 | No Comments »