miércoles, 16 de junio de 2010

Flex 1.5 Con el branch a cuestas...

Ultimamente andamos con el branch a cuestas, a la hora de añadir codigo en otra parte de la aplicación nos vemos que en otras partes nos aparece este dichoso error.

Aqui dejo información referente al branch:



24. What does "Branch between ... and ... around line ... exceeds 32K span" mean and how do I get rid of it?
Don't panic. Your app is NOT too big for Flex to handle. True, the 32k limit is a real Flash Player limitation to the size of certain structures like if blocks and for loops. But you don't really care about that right now, because you don't have any direct control over those things. Here is some information that will help you get back to coding:

There are two main reasons you might the 32k issue. The primary cause, and the one to address first, is the architecture of your application code. The 32k error message asks you to "refactor" your code. Refactoring is essentially the process of modifying the structure of your source code while keeping the same functionality. In the Flex world, this means moving some parts of the code out of a main file and into separate components. One way to do this is to use
custom mxml components. So instead of, say, having several hundred lines of mxml in a child container of a ViewStack, you put that mxml code into its own component file, and have a single line in the ViewStack to reference it. Do that for all the ViewStack children and 1000 lines of code can become 30. Decreasing the total number of visually rendered mxml tags in a single file will help avoid the 32k limit. Another type of refactoring is to move ActionScript code into its own class. Important note! Just putting the AS code into a file and then using the #include directive or the mx:Script source="myscript.as" method to include the code will NOT help with the 32k problem. You MUST create a true AS class that contains the functionality. Around two thousand lines of mixed mxml and AS code and you are in danger of the 32k error. I have not found an upper limit whatsoever to code length in a class.

The second cause of the 32k error is not your fault. During compile, Flex generates AS code out of your mxml source. Then it compiles that into the Flash swf. In that process it makes decisions on how to break up your source and generate the AS class code. In Flex version 1.5, it doesn't always make the right decision, and the result is the 32k error. IF you are confident that you app is already efficiently "refactored", and you suspect you might be at one of these boundary conditions, first try compiling the app with ?debug="true" in the url. If the app compiles, then you are surely at a boundary condition. What is happening is that debug adds code to your source during generate/compile. This additional code causes Flex to change the structure of the AS classes so that the 32k limit is not hit. Hmm, more code? Yeah. Try just adding 50 or so lines of code, even if it is bogus. Usually, this will get you working. Now, when you add more real code go on and remove the bogus stuff, you don't want it in your production code!

A final hint. After hitting a 32k error, and trying one of the above solutions, if you still get the error, delete the temporary generated as code. It is located in ..\MyAppServer\flex(flexroot or contextroot)\WEB-INF\flex\generated\*. You can delete all the folders safely (make sure to restart your Flex server).

This can be an aggravating and somewhat scary problem, and it always seems to happen just before an important demo. Just use good, modular design, and remember the bogus code trick. Macromedia has stated a committment to improving this situation in the next release.

fte: http://www.cflex.net/showfaq.cfm#Question365


File Sizes or Form Limitations on Flash Forms
Posted At : December 16, 2005 6:41 PM | Posted By : Mark Kruger
Related Categories: CFMX 7 Flash Forms
Ask a Muse Asks:
Do you know if there are limitations to either the file-size or the number of fields in a flashform?

There is indeed a limitation to the "flex compiler" that is included with CFMX. The limit is either 32k or 64k depending on who you ask. I cannot find (off hand) the actual MM document that describes the limit. The limit is to the amount of "compiled actionscript". It is affected by pretty much everything you do in the CFFORM tag. Even adding a style can cause a change in the size.

The leads to the unfortunate situation where you are refreshing a form over and over trying to get pixels to line up or a font to size correctly while you hurl epithets at the screen in frustration because of the uninformative error message:

Branch between 71782 and 104556 around line 0 exceeds 32K span. If possible,
please refactor this component.
After calling MIT you realize that refactoring means to reduce the size of the actionscript in the file.
Keep in mind that flash forms are useful in certain situations - a straightforward wizard, a couple of date boxes, a series of dropdowns etc. Macromedia has included the product to "wet your appetite" regarding the power of Flex. Flex is indeed impressive and worth examining as an option. Sad to say the price tag is simply too great and does not match the level of need in most cases.

If you consult Dr. Google you may find there are numerous work arounds for the 32(64)k limit (some people say just keep adding more components to the form).

Ironically - I used to get this error quite frequently as I have some pretty hefty flash forms on my intranet - but ever since the 7.0.1 updater I haven't hit it once.
# Posted By todd | 12/16/05 8:41 PM
Todd - Thanks for the tip. How does adding more components help?
# Posted By mkruger | 12/17/05 9:45 AM
Not quite sure actually. I wish I could offer up a proper technical explanation but adding more components has honestly worked for me. Will it always work? Don't know - I wonder if once a certain size threshold has been exceeded the flex compiler stops checking the size??? Don't honestly know :( - But while developing I've even gone as far as temporarily copying one of my tab navigators (full of different form elements), renaming all of them to avoid name conflicts and hiding it in a height=0 width=0 formgroup to temporarily allow me to compile the form while I'm adding more code.
# Posted By Todd | 12/17/05 10:42 AM
according to adobe, During compiling, Flex generates ActionScript code out of your MXML source. It then compiles that into the Flash SWF file. During that process it decides how to break up your source code and generate the ActionScript class code. In Flex 1.5 it doesn't always make the right decision, and so the result is the 32K error. They also suggest adding bogus code to solve the problem. Or adding ?debug=true to the url to test the compiler issue
# Posted By Michael White | 7/6/06 11:11 AM
Hi Guys,
I have done quite a bit of Flash Forms development and ran into actually three errors. One at the 32 K limit... One just before the 64K limit and then a final one at the 64K limit... The 32K message appears to be a warning and you can indeed get past it by just continuing to add components. Just make sure that your form isn't dynamic enough to drop below the 32K limit depending on the data served up for the page. The result is a blank page on production if you have the debug turned off...
The second error or the 64K warning is also just a warning but you really do not have much room left. The final 64K error appears to be the point of no return. I could not continue past the final 64K limit no matter what I did. I had to refactor my form. You might be suprised as to what will make a difference. Border on formgroups take some space, the built in CF validation takes a lot and even margin settings like indicatorGap takes a bit.
I have some pretty extensive forms in the app I am working on and have only ran into the final 64K once. I do however run into the 32K warning from time to time and just program past it.:>
Hope this helps!
Ed
eskinner@ourams.com
www.ourams.com;
# Posted By Ed | 8/7/07 8:26 AM
ive been encountiring the 32k limit. just manipulate everything in your form and your surely will get override the error. i confirmed the comments before me. thanks.
# Posted By kapitannwel | 8/11/07 2:52 AM
most of the times, even simple manipulation on the form's content will work. changing width, height, type, etc. stupid as it may seem but it works.

Fte: http://www.coldfusionmuse.com/index.cfm/2005/12/16/flashform.file.size

No hay comentarios:

Publicar un comentario