proxied applications:
1. 啟動服務器
2. 編譯一個lzx文件
3. 放到具體的目錄
4. 在瀏覽器中打開
5. 調試和修改程序
6. 重復2-5步,知道調試完畢.
7. 可選:使用KRANK進行優化
8. 最終部署程序
<script>標簽允許放到<canvas>里面,而不允許放到<view>中.
<simplelayout>, <stableborderlayout>, <constantlayout>, <resizelayout> and <wrappinglayout>.
所有在LZX 應用中的數據都包含在datasets中
一個<liberary>只能嵌入到一個application中一次
注釋:
<!-- comment -->
也可以:
<?ignore
<!-- This is a blue view -->
<view bgcolor="blue" width="100" height="20"/>
<!-- This is a green view -->
<view bgcolor="green" width="100" height="20"/>
?>
javascript的注釋還是/* */ 和 //
調試:
<canvas height="200" debug="true">
<script>
Debug.write("Well now how about that!")
</script>
</canvas>
可以使用<debug>標簽,調整調試窗口的位置.
所有的元素放置后,默認的位置是在左上角.需要使用x,y兩個元素調整位置.
但是每一個元素都使用一個相對父元素的x,y屬性,會非常的亂.這時,可以使用: layout
Chapter 6 組件(Components)介紹
組件包括button這樣簡單的組件,同時還包括象form/grid等復雜的組件
*用戶可以自定義自己的組件
創建組件的方法:
1. 使用標簽tag
2. 使用script API
3. 使用databinding
Chapter 7 視圖Views介紹:
<button x="${(immediateparent.width / 2) - (this.width / 2)}"
onclick="this.setAttribute('width', this.getAttribute('width') + 10);" >
immediateparent:對象代表直接的父類
this.getAttribute('width') and this.width是有區別的
this.width 只能用在constraints里面
Chapter 8. Intoduction to Media and Art Assets
簡單介紹如何在laszlo中使用圖片、視頻、音頻
在laszlo中<view>元素是最基本的可視化元素,不能直接插入圖片,而是插入view而view的resource屬性是圖片
LZX加載圖片的方法:
在編譯的時候裝載
使用resource全局標識
<resource name="smileyFaceImg" src="resources/smiley.gif"/>
<view x="50" y="50" resource="smileyFaceImg"/>
在運行時裝載
<view x="25" y="25" resource="http://localhost:8080/laszlo_mini/guide/tutorial/ch8/resources/smiley.gif"></view>
提示:最好使用<resource>來嵌入圖片等資源,這樣可以將資源定義在一處,然后文件中其他地方使用只需要使用全局標識符就可以了.如果要修改的化只需要修改一處就可以了.
Laszlo支持GIF/JPEG/PNG格式的圖片
可以使用屬性stretches控制圖片的尺寸的拉伸,有三個屬性值both, width or height
一個<resource>可以包括多個<frame>,可以理解為一個resource有好多別的resource組成,但是每次只能夠呈現一個.<frame>的順序是從1開始的
<view x="150" y="50" resource="face"
onclick="this.setResourceNumber(2);"/>
嵌入flash的方式可嵌入圖片的方式類似
<canvas width="500" height="150">
<view name="spinningClock" resource="../resources/clock.swf"
onclick="this.stop();"
clickable="true"/>
</canvas>
onclick事件,調用stop方法,stop方法停止flash,同時stop方法還是支持接受一個參數.
同時還有play方法,它也支持接收一個參數,參數說明指具體那一幀
view中還有一些和resource相關的方法:
view.playing :flash是否正在播放
view.frame:當前幀
view.totalframes:falsh中總共的幀數
view.seek(n):在flash當中跳過n秒