Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi,
I've experienced the same problem yesterday. Flash CS5 or FlexSDK 4.1 latest prod. & AS3.
I can only show what was my problematic code part:
private function methodCalledFromEventDispatcherClonedEventDelegatedToRPennerSignal (medium:Signal)
{
trace('whatever..');
switch(medium.code)
{
case Const.A:
{
scope.method.call();
}
break;
case Const.B:
{
// just some comment
}
break;
case Const.C:
{
// just some comment
/*
multiple
line
comment
*/
}
break;
}
}
After i've tried to delete trace statement line-by-line, when i've deleted the trace("whatever") code, i was getting the same compiler error (stack underflow nasty exception)
But when i've moved my double comments from case Const.C: the problem was solved... so it was not a trace statement that was causing the exception, it was caused by a nested multiline comment inline in a switch statement.
Also i must notice that using nested conditions inside switch statements also can make some headaches, nowadays i'm more preferring using State design pattern or just very simply calls in switch statements (FlexPMD also gives a notice about that if you inspect your code).
About using trace command:
In my development practices i prefer using native API usage as far as possible, so i don't use any external logger class dependency unless it's a huge enterprise level application where i need different report targets (like firebug console, hudson, etc.) - trace is just simply enough to follow code execution or find where the code is broken when the throwen expection is not really exact.
When the project is in implementation phase i'm building test versions with mxmlc debug option enabled (same as in Flash CS omit trace actions unchecked) so all the trace actions are compiled in the code.
After the implementation phase is complete you can switch to Release or Pre-release version where you can turn off the debug option and test/release with optimized code (mxml debug option false or Flash CS omit trace actions enabled) without any trace calls.
If you are using an external logger like Thunderbolt AS3 Logger and you want to exclude these references from the code, you have to use some pre-build filter with the code (with apache ant for example) or a conditional compilation (IFDEF), as far as i've experienced if you are working with a design team which is using Flash IDE these are not really options.
ps.: Joa Elbert's great Apparat is also capable in swf byte level optimalization, so you can write your own pre/post compiler in fact ( http://blog.joa-ebert.com/tag/apparat/ )
Best,
Andrew Csizmadia
www.vpmedia.eu
Copy link to clipboard
Copied
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more