PDA

View Full Version : Using the AIR Flash CS3 Update


gyzhor
09-18-2007, 06:14 PM
I'm pretty good at AS2, and just now learning AS3, but I'm super excited about working in AIR. I don't have Flex (which I've really only damped my hands with anyways), so I was ecstatic when Adobe released the the Flash CS3 update allowing me to package AIR straight out of my FLA.

I'm having trouble, though, figuring out how to get some common application functionality to work - drag and drop the transparent window, "always on top", etc. - that are comparatively easy to accomplish in Flex.

I've poked about and most turorials and bloggers' focus still seem entirely Flex oriented. Does anyone have any ideas how to accomplish these functions? Exporting from Dreamweaver? Include an mxml in the AIR package? Cross-format APIs? Actionscripts? Beuller?

Thanks in advance for any advice!
~gyz

senocular
09-18-2007, 06:23 PM
What are you looking for exactly? Do you want to see a Flash CS3 example of drag and drop?

gyzhor
09-18-2007, 06:43 PM
Of a transparent-windowed AIR application, yeah.
Right now, the Flash CS3 Package settings give you the option for a custom chrome (transparent), but nothing for draggable windows or "always on top" options, as you could otherwise define in a Flex mxml script, ie:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" mouseDown="stage.window.startMove()" layout="absolute" width="750" height="550" backgroundGradientAlphas="[0.0, 0.0]" alpha="1.0" backgroundAlpha="0">

Like I said, I'm still brand-spanking-new to AS3, so maybe it's just a matter of finding out how to include "stage.window.startMove()" in an actionscript mousedown, but a lot of what I've read leads me to think there's some external file that needs to be included.

Am I way off?

And thanks, Senocular, for helping me out for the second time in as many weeks! :)

senocular
09-18-2007, 06:52 PM
The Flash settings for AIR are, I think, a little limited. But they consist only of an interface to modify the actuall XML file that will ultimately be used to control your application. You can edit that by hand by finding it in the same folder as your FLA (FLA name + -app.xml).

Similarly, other actions in Flex specific to AIR will also exist in Flash since they are using the same player. stage.window.startMove() for example is the same in Flash. You just need to connect it to an event.

stage.addEventListener(MouseEvent.MOUSE_DOWN, moveWindow);
function moveWindow(event:MouseEvent):void {
stage.window.startMove();
}

gyzhor
09-18-2007, 07:03 PM
And that did it alright. It's always a little embarassing when the answer is something I really should have known already. :rolleyes:

Thanks!

I'll experiment with the XML to see if I can get the "always on top" to work ... unless you know a script for that too. :p

senocular
09-18-2007, 07:05 PM
http://livedocs.adobe.com/labs/flex/3/langref/flash/display/NativeWindow.html#alwaysInFront

gyzhor
09-18-2007, 07:14 PM
Awesome. Thanks!

SirDuke
11-28-2007, 08:25 PM
why does this line of code give me a compile-time error?

stage.window.startMove();

saying "Access of possibly undefined property window..." ?

Did something change from AIR CS3 plug-in beta1 to beta2?
You seem to be easily using it here and i also saw it working on a tutorial at gotoandlearn.com. Anyone has any ideas?

xwielder
11-29-2007, 12:46 PM
stage.Window

to

stage.nativeWindow

SirDuke
11-30-2007, 08:05 PM
that it! thanx alot :)