-
1. Re: Check distance (within a range) moved in y-axis?
rossfranks Jan 30, 2014 7:17 PM (in response to rossfranks)No one tried this before?
-
2. Re: Check distance (within a range) moved in y-axis?
Saurav Jan 31, 2014 12:47 AM (in response to rossfranks)Hi pancreasboy12 ,
I didn't have a very clean approach but this is what I did :-
I modified the scrollCont() method
function scrollCont(){
x = sym.getComposition().getStage().getSymbol('lab_items').getSymbol('numbers').$('labMarks') ;
if(x.position().top > -2277)
{
sym.getComposition().getStage().getSymbol('lab_items').getSymbol('numbers').$('labMarks') .animate({'top':'-=50px' }, 300, 'linear', scrollCont);
}
else
{
console.log("stop");
sym.getComposition().getStage().getSymbol('lab_items').$('btn').unbind(' mousedown touchstart');
}
}
-
modified.zip 152.8 K
-
-
3. Re: Check distance (within a range) moved in y-axis?
rossfranks Feb 2, 2014 4:25 PM (in response to Saurav)Thanks for getting back to me Saurav,
so if I have a check button that when clicked will only say "correct" if the numbers are stopped in between the x.position of -1048 and -1125, how would I write that? Here's my attempt:
-
4. Re: Check distance (within a range) moved in y-axis?
Saurav Feb 3, 2014 5:31 AM (in response to rossfranks)Hi pancreasboy12,
I have attached the modified composition here . Please refer this will work fine .
Also just wanted to say that you can enclose the text within the button symbol so that you will be able to hit the entire button area.
Thanks
Saurav
-
changed.zip 153.0 K
-
-
5. Re: Check distance (within a range) moved in y-axis?
rossfranks Feb 3, 2014 2:24 PM (in response to Saurav)Thanks for that Saurav.
So if at a certain distance I also wanted an action to happen, would I write it like this?
if(x.position().top == -1048 )
{
alert("message");
}
-
6. Re: Check distance (within a range) moved in y-axis?
Saurav Feb 3, 2014 9:03 PM (in response to rossfranks)Yes, that looks fine .
Thanks
Saurav
-
7. Re: Check distance (within a range) moved in y-axis?
rossfranks Feb 3, 2014 9:11 PM (in response to Saurav)Hmm because I tried that code and it stopped the user trying to scroll a 2nd time if they released their mouse down and also it didn't activate the alert.
Any ideas?
-
8. Re: Check distance (within a range) moved in y-axis?
Saurav Feb 3, 2014 9:20 PM (in response to rossfranks)Hi,
Can you please share your file so that I can look into it ?
Thanks
Saurav
-
9. Re: Check distance (within a range) moved in y-axis?
rossfranks Feb 3, 2014 9:24 PM (in response to Saurav) -
10. Re: Check distance (within a range) moved in y-axis?
Saurav Feb 3, 2014 9:52 PM (in response to Saurav)Hi,
You should not put any statements between If and else condition , they should go together .
if(x.position().top > -2277 )
{
sym.getComposition().getStage().getSymbol('lab_items').getSymbol('numbers').$('labMarks') .animate({'top':'-=50px' }, 300, 'linear', scrollCont);
sym.getComposition().getStage().getSymbol('lab_items').$('btnCheck').bind('click touchstart',function(e){
e.preventDefault();
$(this).unbind('click touchstart');
sym.getComposition().getStage().getSymbol('lab_items').$("feedbackText").html("incorrect" );
});
}
else
{
console.log("stop");
sym.getComposition().getStage().getSymbol('lab_items').$('btn').unbind(' mousedown touchstart');
sym.getComposition().getStage().getSymbol('lab_items').$('btnCheck').bind('click touchstart',function(e){
e.preventDefault();
$(this).unbind('click touchstart');
sym.getComposition().getStage().getSymbol('lab_items').$("feedbackText").html("incorrect" );
});
}
So please do not write any If conditions between the above If and else .
Thanks
Saurav
-
new.zip 153.2 K
-
-
11. Re: Check distance (within a range) moved in y-axis?
rossfranks Feb 4, 2014 4:56 PM (in response to Saurav)Thanks Saurav,
thats exactly it.
Thanks for all your time and help, it's much appreciated.
Ross.
-
12. Re: Check distance (within a range) moved in y-axis?
Saurav Feb 4, 2014 8:44 PM (in response to rossfranks)I'm glad that I could help
Thanks
Saurav
-
13. Re: Check distance (within a range) moved in y-axis?
rossfranks Feb 5, 2014 3:05 PM (in response to Saurav)Hmm my other post got deleted so I guess I have to post here.
If I'm using this on a Responsive Scaling animation how do I get around the issue of coordinates changing if the browser window is resized?
-
14. Re: Check distance (within a range) moved in y-axis?
rossfranks Feb 10, 2014 3:10 PM (in response to rossfranks)Would I have to use percentages rather than coordinates based off the scaled animation?
-
15. Re: Check distance (within a range) moved in y-axis?
Saurav Feb 10, 2014 9:13 PM (in response to rossfranks)Hi,
For responsive you have to use percentages .
Thanks
Saurav
-
16. Re: Check distance (within a range) moved in y-axis?
Saurav Feb 10, 2014 9:14 PM (in response to Saurav)Hi Pancreasboy12,
Can you please create a new thread since this thread is closed and other members might not be able to pay attention to this thread
Thanks
Saurav


