PDA

View Full Version : cs4 air preview


davej
02-02-2009, 07:26 PM
Hi All
sorry I am new to using flash to build air and a little confused. In this tutorial for cs3 http://www.gotoandlearn.com/play?id=41 lets you preview the app with out having to install it. I cant seem to get this to work in cs4. Also when I try the code from this tutorial I get errors such as

1119: Access of possibly undefined property window through a reference with static type flash.display:Stage.

not sure what I am doing wrong

evride
02-03-2009, 08:05 AM
thats because at the time lee was using a prerelease of AIR which means code has changed in the released version. Post your code and i'll help you out.

runawayprisoner
02-11-2009, 06:50 AM
Replace the doDrag function with this:


var globaldistx;
var globaldisty;

stage.addEventListener('mouseDown',getIt);

function getIt(e:MouseEvent):void {
globaldistx = mouseX;
globaldisty = mouseY;
stage.removeEventListener('mouseDown',getIt);
stage.addEventListener('mouseMove',moveIt);
stage.addEventListener('mouseUp',releaseIt);
}

function moveIt(e:Event):void {
NativeApplication.nativeApplication.activeWindow.x += mouseX - globaldistx;
NativeApplication.nativeApplication.activeWindow.y += mouseY - globaldisty;
}

function releaseIt(e:Event):void {
stage.addEventListener('mouseDown',getIt);
stage.removeEventListener('mouseMove',moveIt);
stage.removeEventListener('mouseUp',releaseIt);
}


And it should work. I tested it using CS4, but CS3 should not be much different.