Which is best, make a multiple file or single file? - actionscript-3

I am about to start a new project with Flash Professional CS6 and AS3. My project is a huge one with a lot alot of MCs, coding, pictures ... etc. In a previous project with flash 8, I tried to use several files that were working with each others but I faced a lot of problems in loading and interacting with them. It was hard to control specially when it came to the loading stuff.
I don't know if any has been changed in CS6, But I want your advice. Should I use my old strategy by using many files? or should I dump all thing in one huge fla file?
In either case, what will be the best way to arrange the assets, codes, ... etc so they will be well organised and easy to work with in coding and yet give a high performance.
Thank you in advance.

You should go with several source files, especially if your project is huge.
First of all, create dedicated .fla file for UI components and small/handmade elements, — assets.fla and compile it as assets.swc.
If you will compile project by the help of Flash Professional CS6 (but I would recommend some IDE...), you will have one more .fla file, main.fla, It's your entry point with Document Class, and connected libraries(mostly .swc files)
Images, huge animated scenes, all these stuff are external: Bitmaps, swf files you will load in runtime, and unload/dispose, for freeing memory.
Actually, It's an art to organise project, so It will be easily scaleable, and without problems you could work in team, and not interfere with each other

Related

Library items in flash reducing export speed

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.

How to create a Flash Movieclip via a web interface?

Forgive me if this is not the correct place to ask such a question.
Basically, I am looking for a way to allow someone to easily (at least, easier then diving into Flash) create a basic Flash animation (movieclip) with some placed image assets and text, all via a web interface.
I was thinking along the lines of using jQuery to allow drag and drop assets, of which you'd "record" the co-ordinates and relay that to Flash somehow to create the SWF file.
Or would it be better to create a tool in Flash (surely making operations easier) and then have some kind of "save" button to render out the SWF?
I'm totally open to suggestions.
Thank you
If you really need to produce a stand-alone SWF file (and not just a config file for you own "player"), I would probably do it like this;
1) Create your editor in whatever system you feel like (flash, jquery etc).
2) Build a config file in the client. This is used, together with all the resources the user added, to play back the animation.
3) Upload said assets and config file to your web server.
4) Use the flex compiler (on the server) to produce the resulting SWF, combining your player with generated AS3 which embeds the uploaded resources as needed, to make it available to the player.
5) Give the user a download link for the newly generated SWF file.
I don't think there is any swf compiler available for Flash (actionescript). You may create a swf that allows users to create an animation, save it as a home-made vector format, and then replay it. But I don't believe you can create and independant swf file with only the created animation in it.
Just think about a player in Flash, and a format that the player will read (xml, json, name it...). You can either generate the input with jQuery or Flash, and then feed it into your player to display it. You will eventually need two files.
Apparently this library allows you to compile SWFs at runtime. I haven't used it myself (yet) and don't know how stable or flexible it is, but it appears to be what you're looking for. I'd recommend giving it a spin and seeing if it's sufficient.
I'm not exactly sure how it saves the file, so you might run into security problems since it's a web application. Hopefully it should be OK though.

Working with flash with Mercurial: how to handle the FLA?

How do teams do to work all at the same time on the same .fla file when working with version control?
We are a team of 2 working on a flash game right now and we found that, since it is a binary file, we can't work on the .fla file at the same time or one or the other will need to replace his file (because it's almost impossible to merge).
The best solution we could find for short term, is texting the other "lock" and "unlock" whenever we want to work on the file. Yes, it is very inconvenient, I agree. There has to be a clean solution to this.
So how do big teams manage a binary file with version control?
What would be our alternative?
We use flash cs5 along with bitbucket and TurtoiseHg, if that changes anything.
Thank you for your precious time.
refer a following site:
Flash CS5 and Version Control

What are some good ways to Save/Load files in AS3?

I am writing a game in ActionScript3 using Flixel as a base. I have been unable to find a good method for saving and loading files from the player's local hard drive. I know Flixel has a way to save game data to...I think...cookies that the player doesn't really have access to, and I want to avoid this.
I first learned programming in Java, and one thing I've seen a lot of is scanning (Scanner) and printing (PrintWriter) lines of strings to/from text files. Something like this for AS3 would be my ideal, but if there are other methods I'm open.
Does AS3 have anything in its basic library that can do this task well? Are there libraries I can download and include that do this well/better?
If your game is going to run on a webpage your options are limited. Due to security concerns Flash is limited to reading and writing files specifically selected by the user.
Should you be using Air to make a standalone game, you will have regular access to the filesystem and can write files much like with Java.
If not, you will be pretty much stuck with Flash cookie equivalent, SharedObject.

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.