How to set Flash Player window location in Flash project as3? - actionscript-3

I have 2 monitors on my computer, also am writing a program on AS3 that is exported to standalone SWF. My task is to make my app fullscreen on 2nd screen. How can I do this?
I tried converting my project to AIR project. It is possible there by using nativeWindow property of Stage. (setting x coordinate so that it appears in second screen and then call fullscreen). It works in Flash, but when I'm running compiled swf outside Flash, my app crashes (nativeWindow property not found).
So please do help me to solve my problem. I am disappointed, have been looking for solution for already 3 days...

You have to stick with your AIR application and use it as it is supposed to: run the .air file. You can't launch an AIR swf alone because it will miss all the AIR runtime including the NativeWindow you are insterested in.
To be clear, you can't manipulate windows from a swf launched with the Flash Player.
Another solution would be to execute your swf from a web browser and use javascript called through ExternalInterface to move the windows. But it may be quite painful in comparison with AIR.

Related

Library assets not compiling when publishing for AIR

Yesterday I started messing around with Adobe Scout. It gave me a message that said that my function times are not accurate because I'm running a debug mode (in a file that is compiling as an AIR app) and to try compiling a published version first. Thus began my foray into the exciting world of AIR certificates and Windows Installer packages. I made certificate, published it, opened the published package, installed it, opened the resulting file, and found... fanfare ... a rectangle object I draw with AS3 and nothing else. When I test the movie (debug version) in AIR, it has the rectangle as well as a 20x20 map of tiles that are created at runtime from a bitmap that is blitted into 16x16 tiles.
Huh? Do I need to do something special when publishing for AIR to embed the library item? Anyone have this issue publishing to AIR where library assets are unavailable at runtime?
Of course I'll post code if anyone thinks they would like to see it, but it all works fine in flash player, fine (albeit slow) in Adobe AIR for Desktop (when testing), just missing library assets when published and installed via Windows installer.
update
for that matter, when I publish a swf for playback on the web or flash player, a similar thing: just a colored background (per my .fla file settings) but no rectangle and no blitted bmp tiles. Could I be executing code before something is loaded, and when it is in a debug mode, the setup takes longer, so things have time to get loaded before trying to execute? I've tried to avoid this, but maybe failed?
So, apparently making an .exe file or AIR app doesn't stand alone from the library components. Their is probably a way to embed them in the project, but for my purposes, I found that just making sure that the .exe and necessary .png files are in the same source file solved the issue. The problem was that my .exe file was automatically getting compiled and saved into a different folder, so I thought that folder must have all the needed files in it.
So, the bottom line is just that an .exe or AIR file, when published, won't automatically have the needed files in the right places. It still needs to point to the correct file location for those files.

Possible to step through/breakpoints as3 in flash buider when compiling with flash pro?

As it says in the title, I have a project that is based in a Flash Professional .Fla
However, I am doing all of the code writing and editing in Flash Builder. They are both set to have the same source path.
Although Flash Pro has the step through/ breakpoints functionality, it is not aware of breakpoints I add in from Flash Builder.
Since the project is meant to be compiled through the .fla I also can't simply compile with Flash Builder.
Does anyone have this workflow setup, and have you managed to put breakpoints in your code?
This should work. I use the same setup almost all the time. How did you create your project?
I usually create the fla, then in FB I select new->flash pro project and point it to the fla file.
Now if I add a breakpoint in FB and I test the movie with ctrl(cmd)+shift+enter, the movie is published in Flash and is stopped at the first breakpoint.

Using Bluetooth ANE for Android

I'm relatively new to flash, air and AS3 so I'm sorry if this comes of as a beginners question. I have made an application in AIR to run on windows and communicate with my atmega8 chip through serial communication via serproxy.
Now I want to port that application to android to perform the same basic functions but communicate to the atmega8 via bluetooth. So I created a new Air for android file in Flash CS6 copied my code from my previous application excluding the communication through sockets part and created an apk which ran on an android phone:). It did everything except the communication as expected.
Now I have been trying to implement the as3breeze.com/bluetooth-ane and use it to communicate but I'm not too sure how to go about the whole thing. I have imported the ane through actionscript settings and have implemented the classes but when I try to test I get this error.
The content cannot be loaded because there was a problem loading an extension: Error: Extension namespace is invalid for C:\Users\AppData\Local\Temp\Tmp_ANE_File_Unzipped_Packages\AndroidBluetooth.ane
So after some searching I found posts talking about as3 sdk and flash builder. Do I really need all these things or can I make my bluetooth app work some how with just flash cs6? Also what exactly does my error mean and how can I solve it. Thanks in advance for any help. I have been searching so a solution to this for days and I either get an explanation that does not work or I lack the knowledge to understand.
The path that can't be accessed makes me believe you haven't extracted the ANE (basically you're trying to access a temporary directory). Try extracting the ANE file to somewhere, like My Documents or wherever your flash project is, and include (in the actionscript settings) that path instead.
Hope it helps.

Debugging with the projector AS3 Flash projector

I'm working on a Flash game that runs fine when testing through Flash professional, but once it's exported to a projector, it won't run on either PC or Mac.
I've got a PC (Windows 7) and it basically closes the window with a white screen as soon as the projector opens. FWIW, it used to work on a projector until recently when I implemented some new functionality including stage web view, DesktopFacebook API integration etc.
How do I debug this problem with the projector? Has anyone run into issues like this before?
you can use Monster Debugger
it should be able to solve your problem
You can use Vizzy. It will give you access to all traces and error messages (no code changes required). Or, as AyoubKaanich suggests, you may use a proper debugger.
You must install the projector in debug version first.
Thanks for the responses. It actually turned out that Flash was looking for the StageWebView class which isn't available to the standalone projector-- it compiled and ran fine in Flash Pro because I had it set up to test as an Air Desktop app. When I built the projector it didn't throw a compile error at publish time but just refused to load after.
I ended up diagnosing this problem by running the SWF in the debugger projector, which I probably should have just done from the beginning...

Best way to make a downloadable version of a Flash game?

I already made a game with flash, and I want to provide an easy download for people that would rather play offline. Thing is, i use a folder whole structure to dynamically load content per level. Folder structure looks like this, not that it matters that much:
Game folder
animations
anim1.swf
anim2.swf
sounds
music1.mp3
soundeffect1.mp3
levels
level1.lev
level2.lev
myGame.swf
How should I go to distribute this? Should I just resort to make a zip file for the flash game and assume people know how to extract and open the swf? Is there any other way to port easily as an executable? Perhaps Adobe Air (not sure if this works though)?
Thanks, and please help!
Distributing a zip file is the only option if you really want that structure to prevail. Else,
Embed all the resources in the main (myGame) swf & distribute it.
Provide a html page for people who do not have standalone flash player installed.
Embedding as a single file allows the browser to cache the single swf & allow the player to keep playing offline until cache is cleared. So user might not even need an explicit download.
If you are using Flash Builder it is fairly straightforward to compile the application into a self-installing AIR executable (or DMG on a Mac). It is possible to include the AIR runtime which would avoid potential problems of the user not having the correct flash player for example.
An alternative to AIR would be to create a projector executable from inside the standalone Flash Player or from the Flash authoring environment.
Another option to using a zip file would be to use a free installer creator such as InnoSetup or Nullsoft on Windows, or Packager on Mac. Linux users are generally more tech savvy and so a tar would probably be well understood.
Adobe AIR works wonderfully! I use it for my own project, and your project should transition over to it with little to no modification (any issues should show up in the Compiler Errors and Output). The only downside is that, past AIR 2, there isn't any Linux support.
The other option is obviously to create a standalone .SWF projector inside a zip or installer, but in my opinion, that isn't the sleekest way to deploy for desktop. The advantage of AIR over this is that it gives you access to additional desktop functions that Flash Player doesn't.