taboca
09-11-2003, 04:04 PM
I might be doing something wrong, I can't really find it. Here is the code, it's suppose to fade in / out views. There is something wrong because I see fade overlaps.
Code is here:
<!--
////
/// mgalli' simple xml fadein/out ticker module.
//
-->
<canvas width="600" height="140" bgcolor="#EAEAEA">
<splash/>
<view name="wd_buttons" x="30" y="30">
<button name="b1" label="method 1" width="70" height="20" onclick="wd_buttons.callIt()" />
<simplelayout axis="x" spacing="3" />
<method name="callIt">
this.current=null;
this.previous=null;
this.counter=-1;
this.aniNext();
</method>
<method name="aniNext">
this.counter++;
if(this.counter < canvasArea.collection2.subviews.length) {
this.current=canvasArea.collection2.subviews[counter];
this.current.setAttribute("opacity",0);
anm=this.current.animate('opacity',1,1000,false);
var d = new LzDelegate ( this , "aniNext2" );
d.register ( anm , "onfinish" );
}
</method>
<method name="aniNext2">
if(this.counter>0) {
this.previous.setVisible(false);
}
this.previous=this.current;
this.aniNext();
</method>
</view>
<simplelayout axis="y" />
<view name="canvasArea" x="0" y="0" width="500">
<view name="collection2" >
<view opacity="0">
<text y="50" x="260">hi!</text>
</view>
<view opacity="0">
<text y="50" x="260">hi! hey there</text>
</view>
<view opacity="0">
<text y="50" x="260">Yo! how are yo!!</text>
</view>
</view>
</view>
</canvas>
Code is here:
<!--
////
/// mgalli' simple xml fadein/out ticker module.
//
-->
<canvas width="600" height="140" bgcolor="#EAEAEA">
<splash/>
<view name="wd_buttons" x="30" y="30">
<button name="b1" label="method 1" width="70" height="20" onclick="wd_buttons.callIt()" />
<simplelayout axis="x" spacing="3" />
<method name="callIt">
this.current=null;
this.previous=null;
this.counter=-1;
this.aniNext();
</method>
<method name="aniNext">
this.counter++;
if(this.counter < canvasArea.collection2.subviews.length) {
this.current=canvasArea.collection2.subviews[counter];
this.current.setAttribute("opacity",0);
anm=this.current.animate('opacity',1,1000,false);
var d = new LzDelegate ( this , "aniNext2" );
d.register ( anm , "onfinish" );
}
</method>
<method name="aniNext2">
if(this.counter>0) {
this.previous.setVisible(false);
}
this.previous=this.current;
this.aniNext();
</method>
</view>
<simplelayout axis="y" />
<view name="canvasArea" x="0" y="0" width="500">
<view name="collection2" >
<view opacity="0">
<text y="50" x="260">hi!</text>
</view>
<view opacity="0">
<text y="50" x="260">hi! hey there</text>
</view>
<view opacity="0">
<text y="50" x="260">Yo! how are yo!!</text>
</view>
</view>
</view>
</canvas>