lyndonwong
10-05-2003, 09:44 PM
Hi Antun,
I've been struggling with how to create a little slideshow 'blog widget' that cycles through a series of jpg images as defined by a list in an external XML file.
What is the simplest approach, and am I on the right track in the code below? I would like to increment the node number of the datapath attribute of the 'slidewindow' view in some manner. Right now, everything works as I wish, but I must edit that node number manually (not!!). Can you show me how to do this automatically, preferably in an infinite loop?
thx -- lww
slideshow.lzx ---------------------------------------------
<canvas width="184" height="584" debug='false'>
<!-- RESOURCES -->
<font name="serif" src="timmonsr.ttf" />
<font name="san" src="helmetr.ttf" />
<!-- App parameter values in an external XML file -->
<dataset name="slideshow_list" src="slideshow_list.xml" />
<!-- APP INTERFACE -->
<!-- Widget border created via two nested views -->
<view x="3" y="3" width="180" height="580" bgcolor="gray" >
<view width="178" height="578" x="1" y="1" bgcolor="black" datapath="slideshow_list:/slideshow/" >
<simplelayout axis="y" />
<text x="29" y="2" height="22" font="san" fontsize="14" width="170" fgcolor='green' datapath='title/text()' />
<!-- Display slideshow image data -->
<view name='slidewindow' x="29" width="170" clip="true" font="serif" fontsize="12" datapath="image[1]/">
<simplelayout axis="y" />
<view name="photo" width="120" height="90" stretches="both" datapath="path/text()">
<method event="ondata">
this.setSource( data );
</method>
<animatorgroup process="sequential" >
<animator attribute="opacity" from="0" to="1" duration="750" relative="false" />
<animator attribute="opacity" from="1" to="1" duration="2000" relative="false" />
<animator attribute="opacity" from="1" to="0" duration="750" relative="false" />
</animatorgroup>
</view>
<!-- <view resource="img02.jpg" /> -->
<text name='imgTitle' fontsize="14" fgcolor='green' width="166" datapath="caption/text()" />
<text name='imgPathValue' fontsize="10" fgcolor='gray' width="166" datapath="path/text()" />
</view>
</view>
</view>
</canvas>
slideshow_list.xml ---------------------------------------
<slideshow>
<title>Southeast Asia</title>
<image>
<caption>An infant</caption>
<path>img01.jpg</path>
</image>
<image>
<caption>Infant's mother</caption>
<path>img02.jpg</path>
</image>
<image>
<caption>Toraja Grandma</caption>
<path>img03.jpg</path>
</image>
<image>
<caption>Hmong Kids</caption>
<path>img04.jpg</path>
</image>
<image>
<caption>Toraja Farmer</caption>
<path>img05.jpg</path>
</image>
</slideshow>
I've been struggling with how to create a little slideshow 'blog widget' that cycles through a series of jpg images as defined by a list in an external XML file.
What is the simplest approach, and am I on the right track in the code below? I would like to increment the node number of the datapath attribute of the 'slidewindow' view in some manner. Right now, everything works as I wish, but I must edit that node number manually (not!!). Can you show me how to do this automatically, preferably in an infinite loop?
thx -- lww
slideshow.lzx ---------------------------------------------
<canvas width="184" height="584" debug='false'>
<!-- RESOURCES -->
<font name="serif" src="timmonsr.ttf" />
<font name="san" src="helmetr.ttf" />
<!-- App parameter values in an external XML file -->
<dataset name="slideshow_list" src="slideshow_list.xml" />
<!-- APP INTERFACE -->
<!-- Widget border created via two nested views -->
<view x="3" y="3" width="180" height="580" bgcolor="gray" >
<view width="178" height="578" x="1" y="1" bgcolor="black" datapath="slideshow_list:/slideshow/" >
<simplelayout axis="y" />
<text x="29" y="2" height="22" font="san" fontsize="14" width="170" fgcolor='green' datapath='title/text()' />
<!-- Display slideshow image data -->
<view name='slidewindow' x="29" width="170" clip="true" font="serif" fontsize="12" datapath="image[1]/">
<simplelayout axis="y" />
<view name="photo" width="120" height="90" stretches="both" datapath="path/text()">
<method event="ondata">
this.setSource( data );
</method>
<animatorgroup process="sequential" >
<animator attribute="opacity" from="0" to="1" duration="750" relative="false" />
<animator attribute="opacity" from="1" to="1" duration="2000" relative="false" />
<animator attribute="opacity" from="1" to="0" duration="750" relative="false" />
</animatorgroup>
</view>
<!-- <view resource="img02.jpg" /> -->
<text name='imgTitle' fontsize="14" fgcolor='green' width="166" datapath="caption/text()" />
<text name='imgPathValue' fontsize="10" fgcolor='gray' width="166" datapath="path/text()" />
</view>
</view>
</view>
</canvas>
slideshow_list.xml ---------------------------------------
<slideshow>
<title>Southeast Asia</title>
<image>
<caption>An infant</caption>
<path>img01.jpg</path>
</image>
<image>
<caption>Infant's mother</caption>
<path>img02.jpg</path>
</image>
<image>
<caption>Toraja Grandma</caption>
<path>img03.jpg</path>
</image>
<image>
<caption>Hmong Kids</caption>
<path>img04.jpg</path>
</image>
<image>
<caption>Toraja Farmer</caption>
<path>img05.jpg</path>
</image>
</slideshow>