One of the most annoying things when working with Flash/Flex projects is that it takes soo long to build the project. In a Flash game I am doing, it takes more than one minute to build it...
So, the question is simple: Is that normal? Am I doing something wrong? Is there a way to minimize this?
A common way of avoiding the long build-times is to divide your project up into multiple projects and reference them in as SWC's in a Main project.
Actually the shorter build times are mostly considered a positive side effect, as any larger project really ought to be divided into multiple project. Typically you will have more than one library project, handling the service layer/ controller ect.
This way you could for move the controller/ game logic to one project. This would have longer intervals between changes, and therefore you could close this project, building only the one you are currently working in.
If you are using a lot of assets from Flash ect. move those to a SWC as well.
A simple tip that makes compile time from the Flash IDE a bit shorter: Go to 'publish settings' > actionscript 3.0 > settings > disable 'Warnings Mode'
This mode checks if you are using actionscript 2.0 functions. If you know what you are doing (not copy/paste as2.0 code into as3.0 projects), you'll never need these 'warnings'.
Another tip is to use lots of SWC's: if you are using a tweenengine or a framework; most of them are available as SWC files. Use them.
Yes, it is normal. it can take more if your projects get bigger and bigger.
I have a flex project that a full build (using ANT not flex builder) takes 4 minutes.
The best advice I can give you on the subject and is an SSD drive, an SSD drive installed on my Mac cut the times by more then 50%.
I've found embedding assets tends to delay build times considerably. It's hardly noticeable at first but after a while they start stacking up and build time increases.
Maybe try delaying embedding assets a long as you can.
Related
I developed a project in flex and catalyst and the size of swf is too much, sometimes its take too much time to load. Product is already ready, so i cant change in code too much. Please help me to solve this issue. one more thing sometimes its load very fast and sometimes its take lots of time. Why its like that?
Quick answer is that there's no quick solution. There are several things you can do like caching RSLs (using the Adobe signed one), creating your own RSLs, dividing your application into modules, remove all embedded media and make it load on demand, use vectors (FXG) instead of bitmap files (png, jpg, etc) and make sure you don't add things that aren't needed.
All of these can make an application load faster and be much more responsive. The problem is that it's not a quick solution and needs quite a bit of architecting. Normally, you start this from the beginning of your project. From the sounds of it, you didn't know most of these concepts and you've added everything to one massive swf file (including RSLs).
You've got a long road ahead of you.
Do you have any query made to server? In that case it's better to check the server capabilities.
You're exporting a release build, not a debug build, right?
You can download SWFWire Inspector to examine what's in your file, and why it's so big. Like J_A_X said, it's probably mostly embedded assets, which you can try to load separately.
Disclaimer: I wrote this application
I currently have 6 different flex applications (widgets) that run on a main page.
They all depend on one common library project.
I am currently cleaning up the codebase quite dramatically and it is hard to keep overview this way especially since I inherited the codebase.
Does anyone know a tool that can automatically inform me of any dead code?
Cheers
There are a few tools out there. I'd start with this one from Adobe; which I believe is written as an eclipse plugin.
FlexPMD is another tool; also from Adobe.
FlexCover is another.
Keep in mind that the Flex Compiler will automatically remove unused classes from your final SWF; so removing these classes from your project will probably not affect the final SWF size. I can see it helping with long-term maintenance, though..
Considering we have already done the following actions:
Flex Framework as RSL
Compiling with debug=false
Loading most images at runtime
Drawing other simple images with flash draw features
Reducing complex images with pngquant
Creating modules for secondary features
Applying ranges to fonts
Running FlexPMD to find dead code and bad copy-paste
Running FlashOptimizer and secureSWF (with poor results)
Today our application is 1358k:
Code: 978k - 72%
Images: 270k - 20%
Fonts: 110k - 8%
We believe we spent a lot of time into asset optimization and most of the work is remaining on the code.
By analyzing our link-report, our guess is that the heavy part of the code is comming from Flex .mxml nested components. We don't think there is much to do on our pure AS classes.
Is there any analysis or coding best practice in order to reduce the impact of the code on the swf filesize ?
Thanks.
Here is the application : http://www.pearltrees.com/nicolas/137698/
In my practice I usually don't have big final swf files, so I want to mention only one thing. Using mxmlc directly we should not forget to add (for the final build of course) parameter/attribute
debug = "false"
in other way final swf will be almost 2 times bigger.
do you have an objects in the .mxml that are similar to each other that you could turn into a generic class and customize programatically?
Consider looking into preloaders and modules.
Without knowing your application, it's hard to be specific, but a custom preloader can sometimes help a lot with perceived download time. Let's face it, asking the user to idly stare at a progress bar is sad, and you can do better.
The usual example here is that your need your application users to login, or select some basic details before jumping into the main application. By implementation that first form as a preloader, your application will keep downloading in the background while your user interacts with that form.
The downside: Your preloader code doesn't have access to all the Flex goodness. You'll have to draw your UI and implement your interaction in plain old AS3. Still, the extra work can be worth it in some situations.
Flex Modules are the other thing that'd be worth looking into. In a complex Flex app, not everything is commonly used. If you cut the lesser-used bits from the main application and move them into a module you load on-demand, you may be able to save a fair amount of bytes from the initial download size.
I just started making games and I decided for my next project to use either flashdevelop or flex builder. Reason being is because you can embed just about everything and for licensing purposes and it recommended the the game is compiled into one file. flex sdk is good with that type of stuff.
As of right now I decided to use flashdevelop. but recently it's been kicking my behind. First I wasnt able to use ui class (e.i. buttons, and textboxes) probably because of something stupid I did. Now for some reason I can not compile my applications. When I compile, nothing happens, no errors, no nothing. below is a screenshot of what happens when I compile.
Yes i installed debugger and yes I installed sdk
So now I was thinking about just going with flex builder. Not sure which one is more easier to assemble and use. But I do know the flex builder community is bigger, and they have a much better documentation. I am good with actionscript, but I am not so good with using flex.
My ultimate question is...
Which one is easier to assemble
which one is easier to use
which one is BETTER overall
as far as not compiling goes, looks like it compiled just fine.
I don't know what you're expecting to see from the code other than the "Hello"
to see that open up your output window (under View)
Whether you use flex or flashdevelop, you end up using the same compiler.
Like Adam, I find flashdevelop easier to use than flex, but that's because I've used it more (flex trial expired and FD didn't)
And plus I'm fast with FD, like really fast :)
Try some of the shortcuts:
to create getter and setter or
generate function press 'ctrl shift ~' and PRESTO
or for a for loop or for each loop type in the first few
letters and press 'ctrl B'
to find instances of any string in code you
can do F3 and shift F3, whereas F4
will find the object or function
declaration(even in separate files)
FD also adds a lot of the classes as
needed (sometimes I have to do it manually)
and the latest version lets
you generate classes which extend
another class easier.
I'm sure that flax does most of this as-well, but when you're already used to this then switching slows you down.
I had the same issues when I started working with FD. What it boils down to is that flex has a bunch of libraries that it's using that FD doesn't unless you link to them, and sometimes even then.
But once you start compiling your libraries and assets into SWCs you will be able to compile them through Flash and Flex. Which can be handy (like when you're working with other developers)
FD doesn't have a profiler, but this has not prompted me to stop using it. When I need some debugging and trace isn't enough I add the demonsters debugger class: http://www.monsterdebugger.com/ it's pretty powerful, but you still can't step through your code.
** Update - Flash Develop has had a profiler for a few versions now, It's good for watching memory use, but I still end up using monster debugger a lot. You can use debug in Flash Develop as-well and step through your code.**
FD doesn't have the UI that flex does, and for developing mxml it is a bit more tedious, but at pure as3, I find FD is all I need. Well than and Flash to create my SWCs
I think a lot of it is personal preference, and what you have previously used. Some people do have strong opinions though.
Personally I like FlashDevelop, but only because I am use to it, and can get things done a lot faster e.g. setting up projects, workflow, shortcuts etc. But I am sure If I forced myself to only use FlashBuilder (formally FlexBuilder) that I would soon come to grips with its nuances.
Here are a few of my points for either side:
FlashDevelop:
I like how FlashDevelop is so simple,
where as Flash Builder is rather
bulky.
FlashDevelop is totally free, where Flash Builder actually cost quite a bit.
Flash Builder:
Built on Eclipse, so has a massive community, tons of plug-ins etc.
Source control intergrated into the IDE (very important in large projects).
Also might want to check out this article on ActionScript Editors.
I know it's an old topic, but in case someone finds it, here is an interesting thing I've noticed:
I am using pixel fonts in my project, and by default Flash Player blurs part of it (it is a known problem). One solution is to use a bitmap text (some kind of custom class) and the other is to use Text Renderer with some of its related elements to force Flash to render the font correctly. When compiling under the same version of Flex SDK in Flash Builder 4+ the font rendered correctly. But when I compiled with Flash Develop (latest version) the text was really ugly, with missing pixels at random places. It might be caused by the fact that Flash Develop or Flash Builder are sending some hidden arguments to the compiler which either make it work/break.
This is a long running question that has been repeated a few times. Review this question and see if it answers yours.
Web-based Game Development: Flex Builder or Flash CS3?
I have a Flex application that seems larger than it should be. There is a lot of code in it, but not a lot of assets and it just seems large, but I'm not sure how to go about figuring out where the space is going.
I know about the –link-report option, but it only gives the sizes of externally linked library classes. I'm very interested in seeing a report of the sizes of all the classes and resources in my application and it would be a huge bonus if I could also view their dependencies. Not knowing how the code is compiled I'm not sure if this is even possible, but it seems like it should since the compiler can give me the sizes of individual classes linked from other libraries.
I did some searching around, but couldn't find anything helpful. Everything points to the optimization techniques of modularizing and externally linking libraries, which I understand and will implement, but I would really love some more detailed reports of what my compiled application looks like.
To be clear, I'm not really interested in tips on how to reduce the file size, just a report on what is used for and which classes are referencing what.
Anybody have any ideas?
CORRECTION - The link report does show all classes. My particular project in Flex Builder had several CSS files set to compile to swfs. My link report for the main app was being overwritten by these css compiles!
The link report actually contains all compiled classes and not just the ones in external libraries (at least with the Flex 4 SDK). There is an xsl available that will generate an html file of the link report so it is easier to read.
Check this post: http://blog.iconara.net/2007/02/25/visualizing-mxmlcs-link-report/
There is a command-line utility called flash.swf.tools.SwfxPrinter in swfkit.jar, which comes with Flex Builder (or the plug-in or the SDK) and which you can use to analyze information about class sizes. Joe Berkovitz wrote some good instructions on how to make use of it in his blog, and he was working on an AIR-based GUI tool that leverages it, but I'm not sure if he ever published the tool. Still, you can use his instructions to leverage the utility directly from the JAR.
I found a handy little AIR app that really helps organize the link report info.
http://www.kahunaburger.com/2008/03/08/air-link-report-visualizer/
It's old but still works very well.