You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by mo...@comcast.net on 2015/03/09 20:07:50 UTC

how enable checkbox when scroll to bottom of Spark TextArea?

I'm trying to implement a clickwrap agreement wherein a user must scroll to the bottom of a spark TextArea or RichEditableText box in order to enable a checkbox that must be selected to a Terms of Service (TOS) contract. This ensures the TOS at least passed by the user's eyes before agreeing to it (of course, we can never be sure the user actually read it). 

What can I use to determine that user has scrolled to the bottom of the text area, so that I can enable the checkbox? Thanks for any comments. 

Re: how enable checkbox when scroll to bottom of Spark TextArea?

Posted by mo...@comcast.net.
Wonderful, thanks Evyatar 

----- Original Message -----

From: "Evyatar Ben Halevi-Arbib" <ev...@gmail.com> 
To: "users@flex apache. org" <us...@flex.apache.org> 
Sent: Tuesday, March 10, 2015 1:21:55 AM 
Subject: Re: how enable checkbox when scroll to bottom of Spark TextArea? 

Hey, 

We had something similar in our application, only an enabling a button, and 
the web version of it was as follows - 

protected function creationCompleteHandler(event:FlexEvent):void{ 
scroller.verticalScrollBar.addEventListener(Event.CHANGE,changeHandler,false,0,true); 
scroller.verticalScrollBar.addEventListener(FlexEvent.CHANGE_END,changeHandler,false,0,true); 
scroller.verticalScrollBar.addEventListener(FlexEvent.SHOW,changeHandler,false,0,true); 
scroller.verticalScrollBar.addEventListener(KeyboardEvent.KEY_UP,changeHandler,false,0,true); 
} 

public function changeHandler(event:Event=null):void { 
agreeButton.enabled = !scroller.verticalScrollBar.visible || 
scroller.verticalScrollBar.value == scroller.verticalScrollBar.maximum; 
if(agreeButton.enabled){ 
scroller.verticalScrollBar.removeEventListener(Event.CHANGE,changeHandler); 
scroller.verticalScrollBar.removeEventListener(FlexEvent.CHANGE_END,changeHandler); 
scroller.verticalScrollBar.removeEventListener(FlexEvent.SHOW,changeHandler); 
scroller.verticalScrollBar.removeEventListener(KeyboardEvent.KEY_UP,changeHandler); 
} 
} 

Good luck, 
Evyatar 

On Mon, Mar 9, 2015 at 9:07 PM, <mo...@comcast.net> wrote: 

> I'm trying to implement a clickwrap agreement wherein a user must scroll 
> to the bottom of a spark TextArea or RichEditableText box in order to 
> enable a checkbox that must be selected to a Terms of Service (TOS) 
> contract. This ensures the TOS at least passed by the user's eyes before 
> agreeing to it (of course, we can never be sure the user actually read it). 
> 
> What can I use to determine that user has scrolled to the bottom of the 
> text area, so that I can enable the checkbox? Thanks for any comments. 
> 


Re: how enable checkbox when scroll to bottom of Spark TextArea?

Posted by Evyatar Ben Halevi-Arbib <ev...@gmail.com>.
Hey,

We had something similar in our application, only an enabling a button, and
the web version of it was as follows -

protected function creationCompleteHandler(event:FlexEvent):void{
scroller.verticalScrollBar.addEventListener(Event.CHANGE,changeHandler,false,0,true);
scroller.verticalScrollBar.addEventListener(FlexEvent.CHANGE_END,changeHandler,false,0,true);
scroller.verticalScrollBar.addEventListener(FlexEvent.SHOW,changeHandler,false,0,true);
scroller.verticalScrollBar.addEventListener(KeyboardEvent.KEY_UP,changeHandler,false,0,true);
}

public function changeHandler(event:Event=null):void {
agreeButton.enabled = !scroller.verticalScrollBar.visible ||
scroller.verticalScrollBar.value == scroller.verticalScrollBar.maximum;
if(agreeButton.enabled){
scroller.verticalScrollBar.removeEventListener(Event.CHANGE,changeHandler);
scroller.verticalScrollBar.removeEventListener(FlexEvent.CHANGE_END,changeHandler);
scroller.verticalScrollBar.removeEventListener(FlexEvent.SHOW,changeHandler);
scroller.verticalScrollBar.removeEventListener(KeyboardEvent.KEY_UP,changeHandler);
}
}

Good luck,
Evyatar

On Mon, Mar 9, 2015 at 9:07 PM, <mo...@comcast.net> wrote:

> I'm trying to implement a clickwrap agreement wherein a user must scroll
> to the bottom of a spark TextArea or RichEditableText box in order to
> enable a checkbox that must be selected to a Terms of Service (TOS)
> contract. This ensures the TOS at least passed by the user's eyes before
> agreeing to it (of course, we can never be sure the user actually read it).
>
> What can I use to determine that user has scrolled to the bottom of the
> text area, so that I can enable the checkbox? Thanks for any comments.
>

Re: how enable checkbox when scroll to bottom of Spark TextArea?

Posted by mo...@comcast.net.
Thank you so much! 

----- Original Message -----

From: "Gaël Chrétien" <ga...@gmail.com> 
To: users@flex.apache.org 
Sent: Tuesday, March 10, 2015 12:50:16 AM 
Subject: Re: how enable checkbox when scroll to bottom of Spark TextArea? 

Hi, 

Here is a small implemntation : 
There is a little problem : the event is distributed "before" the scroll, 
so, you can add a blank line to your texarea, and check if the scroll 
percentage is greater than 99% ;) 



<?xml version="1.0" encoding="utf-8"?> 
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx" 
creationComplete="init(event)" height="768" width="1024"> 
<fx:Script> 
<![CDATA[ 
import mx.events.FlexEvent; 
import mx.events.PropertyChangeEvent; 

protected function handle(event:PropertyChangeEvent):void 
{ 
_chx.selected = (_sc.scroller.verticalScrollBar.value == 
_sc.scroller.verticalScrollBar.maximum); 
} 
protected function init(event:FlexEvent):void 
{ 
for (var i:Number=1; i<20 ;i++) 
{ 
_sc.text += 'Alea Jacta Est\n'; 
} 
_sc.scroller.viewport.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, 
handle); 
} 
]]> 
</fx:Script> 
<s:VGroup> 
<s:TextArea id="_sc" /> 
<s:CheckBox id="_chx" selected="false" /> 
</s:VGroup> 

</s:WindowedApplication> 

2015-03-09 20:07 GMT+01:00 <mo...@comcast.net>: 

> I'm trying to implement a clickwrap agreement wherein a user must scroll 
> to the bottom of a spark TextArea or RichEditableText box in order to 
> enable a checkbox that must be selected to a Terms of Service (TOS) 
> contract. This ensures the TOS at least passed by the user's eyes before 
> agreeing to it (of course, we can never be sure the user actually read it). 
> 
> What can I use to determine that user has scrolled to the bottom of the 
> text area, so that I can enable the checkbox? Thanks for any comments. 
> 


Re: how enable checkbox when scroll to bottom of Spark TextArea?

Posted by Gaël Chrétien <ga...@gmail.com>.
Hi,

Here is a small implemntation :
There is a little problem : the event is distributed "before" the scroll,
so, you can add a blank line to your texarea, and check if the scroll
percentage is greater than 99% ;)



<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
   xmlns:s="library://ns.adobe.com/flex/spark"
   xmlns:mx="library://ns.adobe.com/flex/mx"
   creationComplete="init(event)" height="768" width="1024">
 <fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.events.PropertyChangeEvent;

protected function handle(event:PropertyChangeEvent):void
{
_chx.selected = (_sc.scroller.verticalScrollBar.value ==
_sc.scroller.verticalScrollBar.maximum);
 }
 protected function init(event:FlexEvent):void
{
for (var i:Number=1; i<20 ;i++)
{
_sc.text += 'Alea Jacta Est\n';
}
_sc.scroller.viewport.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE,
handle);
}
   ]]>
</fx:Script>
 <s:VGroup>
<s:TextArea id="_sc" />
<s:CheckBox id="_chx" selected="false" />
</s:VGroup>

</s:WindowedApplication>

2015-03-09 20:07 GMT+01:00 <mo...@comcast.net>:

> I'm trying to implement a clickwrap agreement wherein a user must scroll
> to the bottom of a spark TextArea or RichEditableText box in order to
> enable a checkbox that must be selected to a Terms of Service (TOS)
> contract. This ensures the TOS at least passed by the user's eyes before
> agreeing to it (of course, we can never be sure the user actually read it).
>
> What can I use to determine that user has scrolled to the bottom of the
> text area, so that I can enable the checkbox? Thanks for any comments.
>