Library items in flash reducing export speed - actionscript-3

At first i was using [Embed] to load in textures for a game.
I then went through the process of moving all the assets into the library.
The program is working fine, however the "Exporting SWF" takes absolutely ages now. It seems like it's doing an awful lot to process these library assets or something.
Is there any way I could reduce this time?
I wish to avoid going back to Embed if I can.

This might change your workflow too drastically, but my method to avoid this issue is to compile using a code editor (my preference is FlashDevelop, but FDT or Flash Builder work too), and to include any assets authored in the Flash Professional IDE by pre-exporting them to an SWC.
It means there are two steps to perform a complete compilation: the first to export the assets from Flash Pro to SWC (which is still slow), and the second to actually compile the SWF using the SWC and your code (which is much quicker). If you edit your assets as often as your code, this won't save you time at all, but in my experience I'll make many more tweaks to the code once the assets are in place, and overall it saves me time.
To start doing this, you can export an SWC from Flash Pro by going to File > Publish Settings, then checking the 'SWC' option (and unchecking 'SWF'). You can set the SWC path to something convenient for your code editor. Then in FlashDevelop, for example, you would include the SWC in your project (right click and 'Add to Library'), which allows you to access any classes that were set to 'Export for ActionScript' in the Flash Library.
Once it's all set up, I use SHIFT-ALT-F12 to publish from Flash, then tab over to FlashDevelop where the changes will be picked up, ready to compile directly from there.

Related

AS3 preloader with external swc files

I have a project created from many external swc libraries that are included at compile-time.
Normally creating a preloader involves unchecking "export in frame 1" on all classes, then having them on the 2nd frame so Flash can still access them.
With the swc's however, all the classes are in separate swc file libraries. When I uncheck "export in frame 1", I can't access them from the main FLA file, and so flash just can't find them and gives errors saying those classes don't exist. How can I make them loaded properly with the preloader (instead of being loaded all at once before preloader displays), even though they are in other files?
Long story short, how can I properly make a preloader when I'm using multiple swc files at compile-time?
Thanks
You misunderstand what swcs are. Even though they are at development time external files, they are very much part of your compiled app when you publish. If you include a swc that is 50M then your app will end up being 50M bigger and your preloader will have to deal with it. No workarounds.

Could not load scene into memory. Your document may be damaged

today I opened my flash project in CS6 and after it opened in the output I receive this message: "Could not load scene into memory. Your document may be damaged." The only problem I saw was the flash component (textInput, and button) that I use for my project. They was transformed smaller and I can select them. :-o And the problem is that try to open the previous version of the project and I found the same error. I think the only problem is FLASH COMPONENT. How can I make everything like it was (flash component). Is something about library ?I saw in library the TextInput are appear like symbol of component (3cubes).
Thank you for help!
Possible causes / solutions:
Your .fla was originally authored on a computer with a different operating system. Try opening it on the computer it was created.
Your .fla might have been made with a different version of Flash. Make sure you are opening it in the same version of Flash.
Your .fla might have been corrupted. If you look in the folder and it says the file size is something like 7kb, then your .fla file is seriously corrupted. Hopefully you have backups if this is the case.
Unfortunately it doesn't work in some fast way so I had to change all my flash components in the library. After I changed, the new components was looked also strange. But I didn't receive that error again and I can go ahead with my project now. Thank you anyway...

FDT - Where is new Flash Project?

Up until this point I have been doing all of my coding in sublime text 2, and compiling with flash pro cs6. I have gotten pretty good with actionscript 3. I have been uing the mvc design pattern and used external libraries like admobs and electroserver. The real reason why I got fdt and wanted because I wanted to play a source file I downloaded in which the document class was mxml.
In every tutorial though I see them say, "oh just click new flash project". the problem is though that there is no choice "flash project" There is only actionscript project and fdt project or fla.
In flash ide I would use one .fla as a "shell" to publish from, and have another .fla with the assets that would be embedded in as3 from its swf. I'm sure that's not the way to set up files in fdt, but I dont know the right way to do it, or even the right way to start.
Maybe I am not finding the right page, but it seems that the documentation on the site is pretty weak. Are there good tutorials somewhere that will help me start compiling projects? thanks
A tutorial specifically for people transitioning from flash ide to fdt would be helpful too.
I could be wrong, but from this IDE, you can't compile fla.
Instead of this, it provides another approach to build projects.
You have to start "new FDT Project", select base and set main class,
which must be compiled.
In result this approach more flexible and convinient.

as3 extended classes doesn't understand updates

I think my flash has a curse.
I use Flash Professional CS5.5 with Gaia FrameWork in my project. movieclips in the project have extended classes and the problem is that when I give new functionality to my classes they doesn't work in an build project. for example function s cann't be found, trace doesn't work and so on. All the old functionality works. When I change class name then it works fine. but then it happens again.
I made new project and coped all the content, but still it happens. I event rainstalled flash but nothing works.
What can I do?
Are you working from a network drive? Sometimes if your system time and the network time are out of sync Flash thinks your class files haven't changed and does not bother to recompile the latest changes.
When testing your project compile like this: Go to Control > Delete ASO files and test movie.
This option deletes the compiled cache and forces it to be rebuilt ...

How can I speed up the compile / publish time of Flash IDE projects

I'm sick of waiting hours for Flash to publish. .NET / VisualStudio projects are WAAAAY faster - is that only compiling the classes that have changed?
Update: Does the Flash IDE re-encode all your sounds and images every time you publish? Can't it cache them somewhere?
In Flash CS4, disabling Warnings Mode speeds up code compilation by about 30% (still quite slow). Strict Mode also, but I'm not sure to what extent.
As for library assets, the optimal speed is achieved by setting JPEGs to "Use imported JPEG data" and PNGs/GIFs as "Loosless PNG/GIF".
As for sounds, I'm not 100% sure, but I think that ADPCM/mono-to-stereo/5kHz/2bit was the fastest.
The [Embed] tag might also help (it doesn't do any convertion) but it includes quite a bit of Flex code.
And as a tip, in Flash CS4 you can batch select assets in the library and apply settings, so you can easily set the optimal speed settings while on development and then change them for deploy.
Uncheck "Warnings Mode" in File > Publish Settings > Actionscript 3.0 Settings. This makes a huge difference. In a recent project I reduced my compile time from 1 min 20 sec down to 7 secs! Yeah, I was astonished too.
For me it turned out that I removed the character filter on my text fields. This seems innocuous, but in fact it has to embed every fracking glyph it can which resulted in a huge swf file that took forever to compile! Anyhow, definitely check that - I think a lot of people could easily overlook this.
You could try to split up your application to separate .swf files and then load them from the main movie.
Also it might be worth to look at your environment. Maybe your machine is running out of RAM, you are using an network drive or your hard disk is encrypted.
Also if the application is getting that big, is Flash really the right technology?
The compiler is just plain slow in the Flash IDE. I can understand the slowness if you have a lot of images in the library that have to be re-exported, but the compiler is inexplicably slow when only compiling code as well.
For example, I have a super basic Away3d scene that requires five full seconds to compile (no library assets). The exact same code compiles in Flex in less than a second. I don't know what's different between the two compilers, but doing any project with a heavy code base in the Flash IDE is just plain painful. As the project grows you'll have to wait longer and longer.
If you're doing a 3D project or something that requires a lot of code compilation, I recommend doing an Actionscript-only project in Flex/Flash Builder. Maybe CS5 will have a better compiler...
You might want to check your character embedding -- If you accidentally click Embed all characters it could embed 1000s of characters, it would significantly slow down your publishing speed
It all depends on your project. I know of some animators that use Flash for publishing broadcast content and that usually takes a long time to publish. There's no getting around it for them. Otherwise, if it takes hours to publish an SWF that will be viewed on the web, then you're probably not going about things the right way.
Additionally, a few obvious culprits that immediately increase the time that it takes to compile a SWF are embedded video and embedded sound. The more items the IDE must compress for output (this includes images too), the longer it will take to compile.
You can't make the Flash IDE cache embedded media (but images won't be reencoded if you import PNGs/GIFs and set the compression to lossless in the library). But if it's a web project you should be loading media from external files anyway, so you don't have to preload all data before anything shows up on the user's screen. You can either load (or even stream) the media files directly or embed them in a separate SWF and load from there, but I don't recommend the latter as it adds unnecessary complexity.
When compiling is too slow, I usually strip down the library - read load images (png, jpg) and sound via URLRequest.
Usually the thing that really slows down the compiler is importing illustrator (ai) files.
disable warnings in the Publish Settings > Flash > as3
If you're even willing to change languages you could use Haxe. It compiles to SWF and is incredibly fast at compiling. It's probably not worth it to change to a different language at the point where you have hour long compile times, but look into it when you are starting your next large project.