The solution is in the FAQ
;-)
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
"Q: What
does "Branch between ... and ... around line ... exceeds 32K
span" mean and
how do I get rid of it?
A: 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="filename"> 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."
Best,
Steven