问题
I'm planning to build a small application, which uses some features of Flash Player 11. Is it possible to target the Flash Player 11 APIs with the OpenLaszlo? In this discussion it's shown how ActionScript packages can be imported into OpenLaszlo applications, but based on the compiler description of version 4.9 it seems that there is only an swf10 runtime, targeting Flash Player 10 APIS.
回答1:
I implemented the SWF11 runtime feature for OpenLaszlo, but don't know when there will be an official release with the new runtime support. The flex4.6 branch should be very stable for SWFx development, you can use it in production.
Here is a code example showing how you can use the new JSON class in ActionScript, which was added with Flash Player 11.0:
<canvas debug="true">
<script>
var person = {
lastname: "Hendrix",
firstname: "Jimmy",
birthday: "November 27, 1942"
};
var jsonStr = JSON.stringify(person)
Debug.info(jsonStr);
</script>
</canvas>
If you compile the application using the swf11 runtime, you should see the following ouput in the OpenLaszlo debugger:
INFO: {"firstname":"Jimmy","lastname":"Hendrix","birthday":"November 27, 1942"}
If you try to compile the application using the swf10 runtime, you will see the following compiler error:
Compilation Errors
org.openlaszlo.sc.CompilerError: json.lzx: 9: Error: Access of undefined property JSON, in line: jsonStr = JSON.stringify(person);
回答2:
There is a branch of OpenLaszlo which has been created a few weeks ago with SWF11 runtime support. Check the corresponding thread in the OpenLaszlo Community space at Assembla.com
Currently, that version of OpenLaszlo is only available as nightly builds, which can be downloaded here. It seems that it's planned to release the 5.0 version of OpenLaszlo with SWF11 runtime support.
来源:https://stackoverflow.com/questions/11949303/is-it-possible-to-use-the-flash-player-11-apis-with-openlaszlo