How to set up MonsterDebugger and FlashDevelop? - actionscript-3

I'm trying to follow directions given by MonsterDebugger I've linked the SWC, added the code. Then built the project.
The last thing they say: "Publish your project and watch the magic happen."
What I got is a SWF that is built to an http directory where my PHP file picks it up and displays it in browser.
What I'm expecting/want is to interact with my SWF application through browser and debug it with MonsterDebugger.
I'm obviously missing something since there it looks like there is no way for Monster tool to attach itself to the SWF? I'm not sure how does Monster will know about my published SWF?
I'm using FlashDevelop/FlashCS5 and Actionscript 3.

Sorry if this is a stupid question, but did you actually started Monster Debugger.exe after publishing and opening your project in browser? Also MonsterDebugger.initialize(); has second argument which is an address if you publishing and accessing your project on the server I suppose. Did you try to change it?

My bad. I had MonsterDebugger.initialize() statement to execute last in constructor of my document file. I moved initialize statement to be the very first line in my constructor. Now it attaches. Apparently there was some code that executed before initialize that caused issue. All is well now that it is the first line in the document file.

Related

Debugging Flash SWF panel

Does anyone think it could be possible to create a custom debugger for swf files using a socket, able to support breaking points and step through code functionality?
I know there are swf debugger's out there but I have not found one that can step through code...
I was thinking of creating one and would like to get some input and ideas.
I know flash has a System.Pause() function that will stop the player and I can get the code line using stackTrace. but I have no idea how to perform the step functionality.
Maybe FlasCC some how?
Or create a server debugger which will call the pause function every step... but how would I know when a new line is being processed?
The reason I would like to create this is to debug Flash extension SWFpanel which wont connect to flash remote debugger
Any thoughts and ideas are welcome .

LWJGL Sound manager issue

I have been working on the Asteroids Game example code that they give in the tutorials section of the wiki and I ran into a strange error.
The code works just fine in my development environment, Eclipse. The game runs without error and exits normally.
I go through the export process in the file menu and create an executable jar that when run with this batch file code
java -Djava.library.path=D:\Tools\lwjgl-2.8.4\lwjgl-2.8.4\native\windows -jar SpaceInvaders.jar
Starts the display and the fails when it trys to load a wav file. Giving this error.
Exception in thread "main" java.lang.NullPointerException
I traced to where in the code this is happening and it is at the location where the wavs are being loaded. Apprently outside of the environment it can't locate the files even though they are right next to the code? All my wav files and gif files are just in the same directory as the java class files right now so calling them from the code looks likes this:
http://i.imgur.com/2gnN1.png
Searching for stuff on google it tells me to zip them into a seperate file and then import to the class folder and refrence from there. I was wondering if there was a way to keep the files inside my main jar file instead of having to create a seperate entity.
Thanks for the replys! Let me know if more information is needed.
You may want to consider using a higher-level API, such as the 3d soundsystem from paulscode. SoundSystem can read from inside the jar(like you are asking), and automatically switch to java sound if LWJGL sound isn't supported on the current hardware.

Facebook ActionScript 3 API not working in FlashDevelop

I am writing a little test program, and I have a problem regarding the ActionScript 3 Facebook API (Graph_API_Web_1_8_1.swc).
I am using FlashDevelop, and I correctly added the SWC file to the "lib" folder.
I also imported the Facebook API correctly in my class file (the auto-finish function of FD recognizes all code from there).
BUT, once I start compiling my code, I get the following error:
Error: Access of undefined property Facebook
for each line of code, that includes a Facebook call (such as Facebook.init(...), Facebook.login(...) and Facebook.logout(...)).
I added a screenshot of my FlashDevelop setup to clarify things:
This is even more mysterious to me, since the AIR application with the FacebookDesktop API is running without any errors.
How do I fix this problem?
This has happened to me several times. Don't waste your time looking into which ActionScript 3 SDK SWC version or Flex SDK you are using. It's just a weird bug. Instead, do the following.
Close FlashDevelop
Create a completely new project
Add the Facebook SWC to library
Then it should work. If not, reboot. It happened to me several times. I hope this helps.

Pass file from AS3 into embedded AS2 wrapper to load

I have a Flash AS3 application that uses FileReference.browse() to request a SWF from the user. If the chosen SWF is AS3, I'm good to go. However, if it's AS2, I need to load it into an AS2 wrapper first (so my app can alter it). All of these files (including my app and wrapper) are intended to exist locally on the user's machine, but the file they select can exist in any directory. So to be clear: Main application (AS3) -> Wrapper (AS2) -> User's file (AS2)
I know how to get the uploaded file's ActionScript version from the Loader's loaderInfo.actionScriptVersion variable, and that's working correctly. My issue is how to pass the file from the AS3 application to the AS2 wrapper so it can load it.
My first thought was to dump the ByteArray from the FileReference's load() function into a SharedObject "cookie". This method seemed pretty bad from a user-experience point of view, but it seemed most likely to work. However, I've been unable to find any method within AS2 to load the ByteArray as a movie (in fact, AS2 doesn't even seem to have a ByteArray class). So the first potential solution to my problem would be if anyone knew of a method for loading a movie from a ByteArray in AS2.
My second thought was to pass the uploaded file's path to my wrapper via the already-setup LocalConnection bridge, and then just have it load the file from that. However, I can't find any way to get the file's path, and my Googling suggests the security model intentionally prevents it. Not to mention, I'm not sure I can load an arbitrary file from the user's machine.
My "hands up in the air; I give up" solution was to just create separate buttons for loading AS3 and AS2 files (leaving it up to the users to guess which it is!) and have the AS2 button actually within the AS2 wrapper. However, it looks like AS2 doesn't have a file browsing uploading API, and the PHP-hybrid solutions I've found aren't an option (because this is meant to be run locally).
So, I would be eternally grateful if anyone could point me in the right direction for solving any of these three roadblocks. Alternative workarounds are of course welcome.
(Edit)
Ok, I found the documentation for AS2's version of the FileReference class. It supports the same file-browsing capability, but does not support directly loading the selected file into the SWF.
However, the security sandbox doesn't seem as strict for local files as I expected, and it looks like I can load any SWF on the user's machine once I have a path to it. So I should be able use JavaScript and an HTML form with a file input to get and pass the file path to my application. It's not ideal having to do all of this from within a web browser, but it should work. If it turns out satisfactorily I'll submit it as an answer.
(Edit 2)
Scratch the HTML-form idea. Looks like the path is hidden from JavaScript for the same reasons Flash hides it. The only option I can think of now is to have the user copy and paste the path to the file...
After reading over your post, you may be able to retry one of your previous attemps with some new information. Actionscript 2 DOES have a method for looking up files from a browser, same as AS3 does. AS2 also has a FileReference class. Check out the documentation here:
http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001040.html
Also, here is a tutorial:
http://markshu.ca/imm/flash/tutorial/fileReference.html
Well, all of my other leads have dried up, so I'm submitting the two answers that will actually work, although neither is ideal:
A) Use Adobe AIR, which will give more access to the filesystem (such as for getting path info) at the cost of requiring the separate AIR runtime to be installed.
B) Have the user enter the path to the file themselves (cumbersome for the user)

Flexbuilder won't launch...arrrgh!

In a panic since I'm trying to meet a deadline so appreciate any feedback on this.
For some reason, Flexbuilder 3 on my mac won't launch, crashes on startup.
I've never experienced this before.
Checked the .log file and what seems to be the problem is the following
/Users/foo/Library/Preferences/Macromedia/Flash Player/#Security/FlashPlayerTrust/flexbuilder.fbr (No such file or directory)
WTF is the flexbuilder.fbr???
Googled but not much luck.
The only thing I've done that might have caused this is change flash player versions system wide using the official flash player uninstaller...but obviously this should not happen
Any feedback appreciated...
It's hard to know where it went, but this file just contains a number of paths of 'trusted' locations for the Flash Player. Normally when you create a new workspace in FlexBuilder it adds the workspace location to this file, or if you create a project outside of the workspace it adds the project path.
It's surprising the absence of that file would keep FlashBuilder from launching though.
Ok, my workaround was to simply create an empty text file called flexbuilder.fbr in the location of the missing file.
But still would like to know the purpose of this file and how it went MIA...