(Flash Professional / AS3)
I have a main fla file that loads a game (with a Loader) and adds it to the stage (addChild(myLoader)). Is there a way to step through/debug the loaded swf? If so, how? My game.swf breakpoints aren't hitting.
Did you debug (Control > Debug Movie) both files?
You need to debug both Main and Game to be able to get breakpoints in the loaded SWF to work. When you Debug a SWF, extra information is added to the file. If you just publish the file there will not be any debug info.
You could try using MonsterDebugger.
Related
I have created a menu for my game with buttons and whatnot as a separate .fla file named Menu. My actual game is another .fla file called Game.fla. I was wondering what the best way would be of loading this menu before the game plays?
Thanks.
I would suggest that you create a .swc with your Menu.fla, and then just add that .swc to your Game.fla
If you are using CS6, make sure that you are setting linkage for any MovieClips you want to create instances of in your code.
In the actionscript settings on the library path tab, you can add a .swc that will be included into your .swf when compiling.
In your code, you can now create an instance and add to the display list :
// Assuming MainMenu was a movieclip with linkage set in your .swc
var mainMenu:MainMenu = new MainMenu;
addChild(mainMenu);
I should note that this does not load the .swc at runtime, it includes the .swc to your .swf at compile time. I would recommend this method over loading a .swf in most cases. Cases where I might not, is if there was a large amount of content that wasn't needed all at once. That would allow you to minimize the amount of memory you were using and reduce the .swf size of your main .swf so it loads quicker.
Anytime you are loading .swf's in at runtime you are adding another layer of complexity, so I'd not recommend it unless you do have a good reason to do so. From what you have described, this doesn't sound like a situation where I'd load an external .swf at runtime.
Load the swf output from Menu.fla and keep a check on the progressEvent from loader. Don't show the game screen until Menu.swf is completely loaded and initialized.
Some more details wrt comment from OP:
You can you http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Loader.html#load%28%29 to load external swfs. init Event would mark that the swf's actionscript has started executing. OTOH, complete event would tell that all the swf bytes have been loaded.
is it possible to open external swf in new flash player with AS3 or AS2? I've been searching everywhere for this, but most of what i found is that it's loading into new browser tab not other flash player.
There is no function to execute a new Flash Player.
If you think in this way: Flash Player is an executable in visitor's computer. If you can launch Flash Player, you can launch any executable you want. This causes security problem.
Therefore, you can't launch a new Flash Player.
fscommand(exec) only works with Windows Projector(exe) File, not SWF.
So I have run into an issue and I think it is mostly because I haven't worked with as2 in about 5 years so things are pretty hazy. Anyway, my problem is that I need to display PDF files within the flash movie. To do so I have resorted to running SWFTools in my backend and converting pdfs to swf for display. SWFTools, though, outputs AS2 files which I can load into AS3 but I can't actually control (for example, calling stop()).
Thus I have resorted to using an AS2 loader which gets loaded into the AS3 project which is responsible for loading the converted pdf swfs. The problem I am running into is that the listener does not seem to be firing when I load the AS2 file in via AS3 but it fires just fine when run on it's own.
This is the code I am running. To summarize when I run this code on it's own "LOADED" correctly prints to the output and the loaded SWF stops. However, when I run it via an AS3 container the swf loads in correctly but the "LOADED" trace never occurs and the stop is not executed.
thanks so much for any help!
var loader:MovieClipLoader
var listener = new Object();
listener.onLoadComplete = function(loadedClip) {
trace("LOADED");
loadedClip.stop();
}
loadFile("data/testing.swf");
function loadFile(target){
loader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(target, holder_mc);
}
SWF Tools does support AS3, you need to change it in the options.
1. Open your PDF in swf tools
2. Edit=>Options
3. Viewer tab
4. Check "No viewer" and flash version 9. (Or use the simple viewer)
- You can also do the "Insert stop after each frame"
I know this because I've done the same thing with a PDF. If you don't have those options, then it's time to download the latest version!
I am working on an Air app for iOS and looking for a way to load an external swf and then add/remove the movieclips in that library to the main stage.
Normally, I can use an addchild routine in the document class of the external swf which I can access from the main document class. But since document classes in externally loaded swfs are not allowed in Air deployment, I can't use this method.
Each external swf will contain up to 10 separate movieclips and there are over 25 external swf's I want to load in/remove from the main stage, all containing unique artwork/animation.
Can anyone please suggest a way to do this?
THANKS!
matt
I had same problem i also had around 10 different external swfs with code. So the easiest way for me was to compile every file to swc and included them after in project.
I want to add Liquid Components to my existing project. I'm new to Flash development so I'm not sure how these components are installed. On the website it says to move .fla file to a specific folder.
I'm using Flash CS5.5 on Windows 7. I moved Liquid.fla file to: C:\Users\MyUserName\AppData\Roaming\Adobe\Flash CS5.5\en\Configuration\Components Note, there wasn't a Flash CS5.5 folder so I created it, it might not be right name, maybe that is the problem.
I also tried moving .fla file to C:\Program Files\Adobe\Adobe Flash CS5.5\en_US\Configuration\Libraries.
When I go to component panel in Flash CS5.5 I don't see these liquid components (even after restarting Flash CS5.5). Am I suppose to see the installed components in Flash CS5.5 Component panel?
Instead of putting that in Roaming folder, put it under "local", like the following
C:\Users\MyUserName\AppData\Local\Adobe\Flash CS6\en_US\Configuration\Components\Liquid
Mine is Flash CS6, but it should not be much different from CS5.5