AIR - Supress Error messages in debug app? - actionscript-3

In a packaged AIR app, I need to add a file called debug to C:\Program Files (x86)\The App\META-INF\AIR\debug for the software to function 'correctly' - I think it is a database error but I can not find anyway to solve it at the moment.
Is it possible to add this debug flag, but to suppress/hide any modal error boxes that may appear from another possible yet unknown bug?

Not sure I fully understand your problem. If what you need is some specific behavior only happening when you run the app in debug mode, then take a look to conditional compilation for example here.
But again, unsure I fully understand your problem!

Related

Why don't FastInject tags work in my Flex/Air Parsley project when build in release mode?

I've got a project that I am working on that works fine when debugging from IntelliJ but when I do a release build (still in IntelliJ) and install the .air fil to my computer none of the FastInject tags seem to work.
I thought that this might be due to the include-as3-metadata issue but that does not seem to be the case. I have included all the metadata tags that I think I have used.
I have spent some time investigating this and have not made much progress other than getting frustrated!
I created a view that displays the logs created by spicefactory - but this seemed to fix the issue!
I tested to see if I could inject and of classes that are expected to be FastInjected, this also fixed the issue.
It seems that if I add any logging related code to the application the FastInject tags start working.
In fact, I have created a release air file here. If I install this on a computer with Flash debugging turned on the application doesn't work. If I follow the steps here to debug an installed Air application - it starts to work!
If anyone else can confirm this behavior I would appreciate it.
It turns out that this was simply a race condition causing an error in context creation that was not displayed in a non-debug player.
This exception never happened while I was developing the application and any changes to the application to add logging changed the initialisation order of the context and caused the issue.

How can I determine if I am running a side-loaded app or a Store-installed app?

For the sake of testing, knowing that I am running from Visual Studio would be nice. I could see if the debugger is attached, but that is not sufficient if I am running with CTRL+F5.
Here's how to see if the debugger is attached:
if (Debugger.IsAttached) Foo();
But my question is, I wonder if there is a way to ask if the current app is from the Store. So, I thought about install folder, but they are identical. Then I thought about this:
Windows.ApplicationModel.Package.Current.Id;
But this appears to be completely implemented even for apps that are being debugged. So, I am stumped. Does anyone know if we can determine if the app is from the Store?
While certainly not the most elegant solution and there's probably a better one, you can check Package.Current.InstalledLocation.Path
If you are running a debug build developed on your local machine and not side loaded, you'll have /debug/ in your folder path.
In Windows 10 apps (this also should be available in 8.1), you can check the IsDevelopmentMode property on the current package.
Package.Current.IsDevelopmentMode
That should tell you whether the package was installed in development mode (which I believe is synonymous with 'side-loaded').
See https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.package.isdevelopmentmode.aspx
for more information.

Direct all errors to a textfield

I am developing a Flash game. It has a complex loading scheme which could go wrong at many different places.
When I am testing from Authoring Tool, either with "Test Movie" or "Debug Movie", it always succeeds and starts fine.
However, every time I test it by loading it in a browser, it always fails! I am not sure where to look.
The question is this : is there an easy way to direct all internal errors to a TextField on Stage where I can really check what went wrong? Alternatively, is there any other way to catch and show errors when testing on a browser?
Debug player is a must. It allows you use breakpoints and view your application state (like values of variables and so on) at runtime (if you are using an IDE with a debugger, like Flash Builder ofc). Viewing traces in console window is quite annoying, though, so you can use some external debug utility, for example Monster Debugger. It has some nice features, like highlighting MovieClips (and other DisplayObjects) at runtime.
You can use UncaughtErrorEvent to intercept all internal uncaught errors of a swf through a method.
The best way is to install the debug flash player. There is no way that I know of to direct internal errors anywhere. Apparently there is, see other answer. It's still probably easier to install the debug player however.
You can get the debug player from http://www.adobe.com/support/flashplayer/downloads.html (scroll down a bit).
As for the error itself, there are two common reasons:
If the files are hosted elsewhere, you need a crossdomain file set up
The base url of the flash file is not where you think it is, and thus any relative paths fail to resolve correctly.

Flash Builder 4 changes not compiled

Im using Flash Builder 4 on the Mac and I have a worrisome problem: The compiler is sometimes not detecting my code changes.
For example I might write some code, compile and run, then add some logging statements, but they will not print. After a clean compile everything runs as expected.
I cannot see a pattern to the exclusion of changes. I'm wondering if anyone else is having the same problem?
Details:
Flash Bulider 4
Pure AS3 project targetting Flex3.5 SDK
Max OS X Snow Leopard
My code does not use semicolons to terminate statements
The problem is with the SDK settings selected for the Compiler.
Try going to 'Project' > 'Properties' > 'ActionScript Compiler'.
Now, in the 'Flex SDK section', try changing the SDK. Click on 'Apply'.
This will force FB to rebuild all settings for the project.
You can try again. FB should now have started compiling with latest code changes again.
Please Note: This is not a permanent fix though!
In case the problem re-occurs, you'll need to again perform the steps mentioned above to get FB back on track.
As bad as it sounds, I am now used to this behavior, I use FB4 on a Mac , but remember having the same issue with Flex.
Practically, I keep clearing the browser cache and cleaning the project. I have thought about adding some random number after the swf url so that it never gets cached but haven't implemented it yet. Force of habit I guess, clearing the cache & cleaning the project has become such a routine!

AS3 Embedding assets - "Warning: Failed to parse corrupt data"

I've got an AS3 project where I'm trying to compile in several images, a soundtrack, and a video via [Embed] metadata. It's a product requirement that these be embedded, so network transfer is not an option.
I'm getting some really strange behavior - a sort of intermittent corruption of the compiled-in data. Sometimes after the project compiles, I run the swf and it closes immediately and writes "Warning: Failed to parse corrupt data" to the flash log. If I delete the binary and clean the project, sometimes it'll run fine after building it again. Sometimes it doesn't.
This is probably the strangest part about this problem, but sometimes when I see that error, I can physically move the video [Embed] lines to the end of the file, then clean the project, and it will build and run no problem. Sometimes I move them back to the beginning of the file and it builds and runs fine.
It kinda seems like it might be a bug in the compiler. Has anyone else experienced something similar? I'm targeting Flash 10.1 and using sprout (http://projectsprouts.org) to build my project. This is the mxmlc line that's being used to compile (mxmlc Version 4.1.0 build 16076):
mxmlc -as3 -static-link-runtime-shared-libraries=true -debug -default-background-color=#ffffff -default-size 712 400 -output=bin/ProjectName.swf -source-path+=.preprocessed/src -source-path+=.preprocessed/assets .preprocessed/src/ProjectName.as
I've tried both removing the -debug compiler option and adding the -optimize option, but no luck.
Everything is being ran through the GNU C preprocessor for some other tasks, so maybe I'll try removing the preprocessor stuff and hardcoding those variables...I'll try that and post the results tomorrow.
Any insight at all would be much appreciated. Thanks!
EDIT:
This project is going to be compiled dynamically with different assets being embedded into the same codebase, so switching to something like Flash Builder for compilation really isn't an option...it must be done via command-line mxmlc.
UPDATE:
Turns out the corrupted data message was due to images created with Photoshop's "Save for web" feature. If I save them outright as PNG images I don't get the message. However, the intermittent nature of the movie compiling properly still seems to be an issue. Now sometimes when the project is compiled it won't throw any compiler errors, but I get a blank flash player window. Right clicking in flash player shows a context menu with a message that says "Movie not loaded..." This doesn't appear to have anything to do with things being ran through CPP first.
[Screenshot]
This is apparently a bug in mxmlc under Mac OS X. After posting this, I observed some other really strange behavior, so I switched the whole codebase to Windows 7. Everything works as expected there (still using Project Sprouts as a build tool).
Flash builder is fine with it.
Can you separate your issue for video or music only, or issue is true for both includes?