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.
Related
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
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.
I am working on a Flash project. In the project there are lots of isolated FLA files which may share the same common classes code. To clarify the project limitation:
I could ONLY use Flash CS6 IDE. No modern tool such as Flash Builder or Flex, just pure Flash CS6 IDE.
I have to export the FLAs to SWFs one by one separately so each one of SWFs would contains a copy of the ABC of the common classes.
I have a loader.swf which was going to load all the other SWFs into a same ApplicationDomain. In other words all the duplicated ABC in the SWFs would be ignored because the loader.swf has also already involved that.
And my questions are:
Is there any way I could pre-compile all the common classes into a SWC or SWF and I could use it just like a DLL or SO?
If so how could I create such a SWC or SWF only by Flash CS6 IDE as I told before?
If I could create such a SWC or SWF how should I use it? Such as How could I change my configuration in the Flash CS6 IDE?
To be honest I don't know my idea is valid or not. Please, any advise would be great helpful.
Thanks.
I found the solution:
Create a FLA which would touch all the common classes
Exrpot the FLA I would get two files: SWF and SWC
Use the SWC as "External Library" in other FLAs
Use the SWF as Run-time Sharing Library to dynamic load it at run-time
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.
I have a problem regarding as3.
I have done a flash application that include an external class in the same folder with the swf. Now the problem is, when I edit the information on the external class (using notepad++), the swf doesn't change. Its like the external class has been hard coded into the application itself.
Do I have to make some changes on the publish setting?
Thanks guys for your time. Really appreciate it.
Yes you have to re-compile your project into the swf. (at least I did when I was writing AS3 programs)
you can't just expect the swf to see your changes sitting there and re-compile itself(although it would be awesome if it did).
just re-build your flash application like you built it the first time.