Thanks James. Useful stuff. I have some comments interspersed below:
On 2009-09-14, at 00:59, James Robey wrote:
Hello list,
I've been meaning to share my experiences porting a decent sized
OL project to SWF recently. Once i got around some pratfalls that
weren't listed on the wiki, i completely enjoy using SWF9 for
application development. All the speed and extra type checking i
could hope for, and i think the team has found a wonderful balance
in the transition. That said, here's the list of things that i
needed to know to successfully port to SWF9 from SWF8 that i'd like
to repeat for the list, since i didn't find it in the "runtime
differences" wiki entry on the openlaszlo.org wiki.
FIRST - if you download the debugger version of SWF9 from adobe's
site, you will be able to see all the runtime errors that i didn't
know i could even trap until after this list was made. Find it,
download it, use it! When i say "bombed silently" below, i mean that
i couldn't find it (without the debugger)
This is a good point, although with the debug player installed, you
will be amazed at how many public web sites have broken swfs on them. :)
Our goal is to make our runtime robust enough that the OL _user_
(e.g., you) does not need to run the debug player or flex debugger,
although it is a very important tool for the OL _developer_.
If you discover errors that are caught by the swf debug player that
are _not_ caught by the OL debugger, that is a bug. Please report,
especially if you can create a small repeatable test case.
These are random road block I hit that took a lot of time; i hope it
saves someone the same:
- all old style setAttr(val) style calls are changed to setAttribute
(attr, val)
across the whole project
The conversion scripts (convert_setters.pl) should have handled this
for you. Did you not use them, or are there conversions missing?
- all methods that are also used for delegates have a single dummy
argument, 'true' passed as as3 requires across the whole project
This is mentioned at (http://wiki.openlaszlo.org/Runtime_Differences#Methods_called_by_delegates.2Fevents_must_have_a_single_argument
). We're not able to fix this with a conversion script. If you use
<handler>s rather than attaching methods as delegates, the extra
argument is automatically generated for you.
(http://jira.openlaszlo.org/jira/browse/LPP-7816) Is a discussion
about extending the <handler> tag to be able to create "unattached"
delegates, which would give them the correct argument signature. Your
comments solicited.
- found out that for loops in script tags can cause silent infinite
loops, so converted all script tags into nodes with methods across
the whole project. Script tags and SWF9 are not a good combination
Sounds like a bug to me. If you have a small repeatable test case,
please file a bug at jira.openlaszlo.org.
- found out that expressions that resolve to *objects* (not object
attributes) in an attribute
must use the "once" constraint type, not the erroneous ${} active
constraint syntax. changed across the whole project
See (http://jira.openlaszlo.org/jira/browse/LPP-7344) and the related
discussion in (http://jira.openlaszlo.org/jira/browse/LPP-7958) as to
why. LPP-7344 is to create a more informative error message.
- (a few of the fields that used not to be clickable are all of the
sudden -- need to look into that)
Let us know! We want your bugs. :)
- Used try catch to isolate and report the most egregious of the
errors
i encountered (try and catch were not so important when the
debugger caught everything)
There is a feature in WEB-INF/lps/config/lps.properties,
`compiler.catcherrors`, which you can enable to make swf9 more closely
emulate swf8 in production code by having it silently ignore errors.
But in debug mode, as I noted above, our goal is that the OL debugger
catch and display any runtime errors...
- Handlers will also cause the runtime to bomb silently if the
reference attribute is pointed at a nonexistant thing
- If a handler references something
that has not been inited at the time it's evaluated for the first
time, the runtime will bomb silently.
If you have examples of an errors that the OL debugger is _not_
catching in debug mode, those are bugs. Please report them. Small
repeatable test cases are especially welcome!
Thanks for all your feedback.