Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OpenLaszlo does implement features which are available in certain runtimes only. That's true for MP3 audio playback, Flash Player webcam and microphone access, RTMP streaming. The OpenLaszlo compiler supports inserting ActionScript code directly into scripts and methods.</p> <p>Here is an example application which catches the Event.DEACTIVATE and Event.ACTIVATE events, and lets you exit the application by clicking/touching the red view.</p> <p>ActionScript 3 APIs can be imported using the &lt;passthrough&gt; tag - which can be used inside the canvas, class definitions or any tag instance in your code.</p> <pre><code>&lt;canvas bgcolor="#ffffff" debug="false" height="100%" width="100%"&gt; &lt;passthrough when="$as3"&gt; import flash.events.Event; import flash.desktop.NativeApplication; &lt;/passthrough&gt; &lt;handler name="oninit"&gt; NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, __onDeactivate); NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, __onActivate); &lt;/handler&gt; &lt;method name="__onActivate" args="ev"&gt; Debug.info("onActivate"); Debug.info("frame rate is " + this.getDisplayObject().stage.frameRate) &lt;/method&gt; &lt;method name="__onDeactivate" args="ev"&gt; Debug.info("onDeactivate"); Debug.info("frame rate is " + this.getDisplayObject().stage.frameRate) &lt;/method&gt; &lt;view width="80%" height="50%" bgcolor="red" clickable="true"&gt; &lt;passthrough&gt; import flash.desktop.NativeApplication; &lt;/passthrough&gt; &lt;handler name="onclick"&gt; NativeApplication.nativeApplication.exit(); &lt;/handler&gt; &lt;/view&gt; &lt;/canvas&gt; </code></pre> <p>If you want code to be executed for the SWFx runtime only, you can check put that code into blocks checking the $as3 property:</p> <pre><code>if ($as3) { // Insert some code for the SWFx runtime or AIR applications only } </code></pre> <p>Using the approach, it's easy to re-use LZX code for either DHTML, SWFx or AIR applications.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload