Slider with Animation Engine

Create fast, sprite powered games with Animation Engine, co-developed with DerBrill Software!

Moderators: heatherlaine, kevinmiller, robinmiller, malte

Slider with Animation Engine

Postby vladoportos » Fri Jun 22, 2012 11:49 am

Hello all,

I have been on this for better part of today and was unsuccessful :cry:

I'm trying to do custom slider similar to example for Animation Engine plugin ( yes I'm using AE )

But in the example is used constrainRectangular to constrain movement of slider into the slider background.

In my case the background is smaller than the slider and if I use the same constrainRectangular it will move the slider slightly higher than the background so it looks like ( see attachement ) which is not desirable :-/

So I changed it to constrainLinear and will get the position of background do some math to get first point and second point and set it to it..

I have put the code in button so I can test it, it looks like this:

Code: Select all
on mouseUp
   put first item of loc of image "pPozadie" into x --pPozadie is backboard
   put second item of loc of image "pPozadie" into y
   put x-22 into x1 --get the start point of line I want to move it on
   put x+22 into x2 -- get the last point of line
   put y+7 into y -- move it little bit down so it is centered ( the nob )
   set the constrainLinear of image "posuvak" to x1,y,x2,y  --posuvak is the shuffle nob
end mouseUp


when I press the button and than click and move the nob it is where it should be and all is fine.

PROBLEM:

The whole stack is resizable, and the background can move so I need to automatically set the nob to correct path, so I was thinking
that I put the same code that is in button to resizeControl so it will update the coordinates every time app is resized.

Code: Select all
on resizeControl
   doFitImg -- here it calls the same code that is in button above ..
pass resizeControl
end resizeControl


but it doesn't work behavior is best described as passing the last position before the new, its almost never in the correct position on the background...

What I want to do is to have that slider with just two position on the left and the right, so when user moves it to the right it enable button for DB deletion ( or dome something ) and when it moves it back button gets disabled ( or other thing happen ).

Any help would be great, for sample code I will buy you a beer ! :P
Attachments
normal look.png
normal look.png (5.23 KiB) Viewed 2769 times
bad look.png
bad look.png (7.49 KiB) Viewed 2769 times
vladoportos
 
Posts: 17
Joined: Wed Jun 20, 2012 8:21 pm

Re: Slider with Animation Engine

Postby Klaus » Fri Jun 22, 2012 12:42 pm

Hi Valdimir,

sorry, never worked with AE so far, but will move this thread to the correct forum: Animation Engine 8)


Best

Klaus
Klaus
 
Posts: 9491
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany

Re: Slider with Animation Engine

Postby bn » Fri Jun 22, 2012 2:07 pm

Hi Vladimir,

the object does not get a resizeObject message when the object is resized by a script. (see dictionary -> resizeObject)

you probably could put a resizeStack handler in the card like this:
Code: Select all
on resizeStack
   doFitImg -- here it calls the same code that is in button above ..
   pass resizeStack
end resizeStack

that should work since the resizeStack message is sent when the stack is resized.

Kind regards
Bernd
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3175
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Slider with Animation Engine

Postby vladoportos » Sun Jun 24, 2012 3:50 pm

Thanks Bern I will try that out.
vladoportos
 
Posts: 17
Joined: Wed Jun 20, 2012 8:21 pm


Return to Animation Engine

Who is online

Users browsing this forum: No registered users and 2 guests