Application vs. WindowedApplication

english mobile

When I first saw Flex and what it could do, I was really excited. I started my working life as a graphic designer, so I'm always interested in the visual possibilities of a new tool. One of the things I spotted right away is that you can make an AIR application that floats on top of the desktop, with a drop shadow and full alpha transparency.

I trotted off to try to make my first AIR app with these features, and it was like hitting a brick wall. I tried everything the Help suggested, to no avail. Finally, I noticed that in the examples, the base tag was Application and not the WindowedApplication you get as the default when you start an AIR project. If you change the base tag to Application, then everything works as expected.

I find that very puzzling, because the main difference between Application and WindowedApplication is that Application is for a file designed to run in a web page and WindowedApplication is designed for AIR. Correct me if I'm wrong, but it seems to me way more useful to have a transparent window for a desktop application than one that is stuck in a window that is decidedly not transparent, ever. Yes, I know about the whole WMode thing, but it seems to me that its chief use is to annoy the snot out of hapless users who find themselves visiting a page that likes to run its ads over the top of the content. I'd be interested in finding out the real reason behind this odd dichotomy.

Updated September 24, 2008:
To find the real solution to this problem, you had to read my comment, follow the links, and then read the comment on the post it linked to. So I'm going to summarize the solution here.

To make the main application window transparent in AIR, you need to edit the {YourAppName}-app.xml file to change these values in the initialWindow section:
systemChrome (set to "none")
transparent (set to "true")

Then, set the showFlexChrome property in the WindowedApplication tag to "false".

Calling Flex from Authorware

english mobile

So I finally had my datagrid calling my ASP page, which squirted out XML. I embedded my Flex swf and could not for the life of me figure out how to call the functionality from Authorware. I did a lot of Googling and banging my head up against a wall, and here is what I came up with:

CallSprite(@"Flash", #CallString, "CallFunction('<invoke
name=\"myFlexFunction\" returntype=\"void\"><arguments><string>hello

If you're not familiar with Authorware, it has two methods for embedding swf files. One is a sort of proprietary method called the Flash Asset Xtra. It actually contains the Flash player so the user does not need to have the player installed. Problem is, it only goes up to Flash 6. So this Flash Sprite is the other type, the Flash 9 ActiveX control embedded in Authorware. #CallString is a method of the CallSprite function that allows you to get access to all methods of a given sprite, even ones that aren't exposed in the way Authorware recognizes. All of this is a long hand way of saying if you're not using Authorware, you'd probably use the CallFunction function some other way.

However, the important part is the XML string, which the Flex documentation doesn't, well, document. I haven't found anything but examples, but I'll give it a stab from my surmises which have borne out through trial and error so far.

<invoke>-root level tag. It has a name property that tells Flex what to invoke (i.e. the name of your function). Those backslashes you see there in my code are to tell Authorware those are literal quotes that should be passed on through to the function. Also has a returntype property, which, presumably, is the return type you expect. Probably this can be any valid return type a function could have from Flex.
<arguments>-nested within invoke, this is a container for all the arguments your function is expecting. Each argument should, again presumably, be wrapped in a tag that tells Flex what type of argument it is. IMO a cleaner implementation would be <argument type="string>foo</argument> but then I'm just a random spong so I don't control these things.

If there's anything else that you could put in here I haven't found it.

Note that I am really curious as to whether a function that returned a value would return it back to Authorware and what form that would take, but not quite curious enough to try it until I need to.

Flex reorders URL String Parameters

english mobile

So now I'm trying to capture the Flex things I've learned in the last couple of weeks with Flex, and most of them are just a big amorphous blur. One thing I do remember is that my ASP page broke when called from Flex. Turns out that Flex doesn't leave the request parameters in the order you put them in when sending to ASP, even when you hard code the full URL string. No I have no idea either why it would rearrange them, but there you have it.

You may be asking yourself why does it matter? Well, I had some pre-existing code that runs stored queries living in my Access database. The SQL for that looks something like "Exec [myQuery] 'param1', 'param2', 'param3'". The ASP code doesn't know anything about what order those parameters are supposed to be in and how many there are supposed to be. So the order needs to come from somewhere.

When I found this bug, I could well have assumed that any code calling the ASP page would use a specific naming convention, and indeed my existing logic does do that. However, I did not want to be tied to a naming convention forever when it should not be necessary. What I could assume is that the parameters would be put together automatically in a loop, since it makes sense to call this logic from a function (and indeed that is how it is called from within Authorware). That meant that the names would be auto-generated and in ascending order.

So, I wrote a function in ASP to reorder the URL parameters in ascending order by name.


english mobile

Hello, my name is Amy and I'm an Authorware-holic. The thing is, Adobe has been deafeningly silent on the future of Authorware, so I'm checking out other tools that can make a web application and a desktop application from the same source code. I have spent the last couple of weeks trying to learn Flex, and honestly I find it quite frustrating.

The Flex documentation, like the documentation of many programs, makes (nearly) perfect sense if you already know what it is talking about. However, when you are trying to learn a software program, you do not already know what it is talking about, so you spend a lot of time puzzling out what the Flex definition of is is.

So, I am starting this blog of my experiences as a Flex newbie trying to get a handle on this beastie. Hope it helps someone.