PDA

View Full Version : Access view through loop


pokermagic
04-17-2007, 03:13 PM
I have a view of images which are "mugshot" in the following code. When the user clicks on one of these images i would like to make all the other images "clickable", false. However, if I make the parent unclickable the children remain clickable except.

How can I loop through the whole dataset and make all the views unclickable?


<view name="innerBottomView" width="500" height="750">
<wrappinglayout axis="x" spacing="10"/>
<view name="allpics" datapath="dset:/clan/team/member">
<simplelayout axis="y"/>
<image name="mugshot" datapath="imageurl/text()" width="70" height="100" stretches="both">
<handler name="onclick">
this.setAttribute("opacity", .3, 3000);
//this.setAttribute("clickable", false);
bottom.info.setAttribute("visible", true);
bottom.info.watermark.bringToFront();
bottom.info.watermark.setAttribute("opacity", .4, 3000);

bottom.info.infopic.datapath.setPointer(this.paren t.datapath.p);
</handler>
</image>
<text font="arial" fontsize="10" datapath="pmsname/text()"/>
</view>
</view>

senshi
04-18-2007, 12:39 PM
Instead of manually looping through all your views, you can use a simple constraint:


<view name="innerBottomView" width="500" height="750">
<wrappinglayout axis="x" spacing="10"/>
<attribute name="clickable_flag" value="true" type="boolean" />
<view name="allpics" datapath="dset:/clan/team/member">
<simplelayout axis="y"/>
<image name="mugshot" datapath="imageurl/text()" width="70" height="100" stretches="both"
clickable="${this.parent.parent.clickable_flag}">
<handler name="onclick">
this.setAttribute("opacity", .3, 3000);
this.parent.parent.setAttribute( "clickable_flag", false );

bottom.info.setAttribute("visible", true);
bottom.info.watermark.bringToFront();
bottom.info.watermark.setAttribute("opacity", .4, 3000);

bottom.info.infopic.datapath.setPointer(this.paren t.datapath.p);
</handler>
</image>
<text font="arial" fontsize="10" datapath="pmsname/text()"/>
</view>
</view>