Sliding images off the screen with javafx

I am writing my first javafx app and I am trying to get images to slide on and off the screen. I have accomplished this to some degree using the below code.
the problem is that the images slide off just fine but when they come back on they stop before they get to their original locations.
Any chance someone can tel me what I'm doing wrong?
function slideOut(index:Integer, len:Integer):Void{
    def timeline = Timeline {
            keyFrames: [
                 for(itr in [0..len]){
                     if(itr != index){
                          KeyFrame {
                              time: 0s, values: [
                                        page.content[itr].translateX => page.content[itr].translateX tween Interpolator.EASEOUT
                          KeyFrame {
                              time: 1s, values: [
                                        page.content[itr].translateX => page.content[itr].translateX + 300 tween Interpolator.EASEOUT
                     }else{
                         KeyFrame {
                              time: 0s, values: [
                                        page.content[itr].translateX => page.content[itr].translateX tween Interpolator.EASEOUT
                          KeyFrame {
                              time: 1s, values: [
                                   page.content[itr].translateX => page.content[itr].translateX tween Interpolator.EASEOUT
        timeline.play();
function slideIn(index:Integer, len:Integer):Void{
    def timeline = Timeline {
            keyFrames: [
                 for(itr in [0..len]){
                     if(itr != index){
                          KeyFrame {
                              time: 0s, values: [
                                        page.content[itr].translateX => page.content[itr].translateX tween Interpolator.EASEIN
                          KeyFrame {
                              time: 1s, values: [
                                        page.content[itr].translateX => page.content[itr].translateX - 300 tween Interpolator.EASEIN
                     }else{
                         KeyFrame {
                              time: 0s, values: [
                                        page.content[itr].translateX => page.content[itr].translateX tween Interpolator.EASEIN
                          KeyFrame {
                              time: 1s, values: [
                                   page.content[itr].translateX => page.content[itr].translateX tween Interpolator.EASEIN
        timeline.play();
def page:Group = Group{
    content: [
         for(i in [0..ImageLoader.length.intValue()]){
               ImageView {
                   var bool = true;
                   translateX: 210 * (i+1)
                   translateY: 175 //* (i+1)
                   scaleX: 1.0
                   scaleY: 1.0
                   preserveRatio: true
                   smooth: true
                   image: Image {
                       width: 75
                       height: 75
                       url: "file:/{image_folder}/{imgArray}"
               onMouseClicked: function( e: MouseEvent ): Void {
               if(bool){
               bool = false;
               slideOut(i,ImageLoader.length.intValue());
               zoomIn(page.content[i]);
               }else{
               bool = true;
               zoomOut(page.content[i]);
               slideIn(i,ImageLoader.length.intValue());

Actually, I am not even sure why it worked... Using the same variable on both sides of the => is probably a bad idea.
I could get some result with the following code:
function slideOut(index:Integer, len:Integer):Void{
  def timeline = Timeline {
      keyFrames: [
        for(itr in [0..len]){
          if(itr != index){
            KeyFrame {
              time: 3s, values: [
                  page.content[itr].translateX => getOrig(itr) + page.boundsInLocal.width tween Interpolator.EASEIN
          } else { null; }
    timeline.play();
function slideIn(index:Integer, len:Integer):Void{
  def timeline = Timeline {
      keyFrames: [
        for(itr in [0..len]){
          if(itr != index){
            KeyFrame {
              time: 3s, values: [
                  page.content[itr].translateX => getOrig(itr) tween Interpolator.EASEOUT
          } else { null; }
    timeline.play();
def image_folder = "D:/Documents/Images/Misc";
def imgArray = [ "beetle1.gif", "beetle2.gif", "beetle3.gif", "butterfly.gif", "LeftAnt.gif" ];
def IMG_NB = sizeof imgArray;
function getOrig(index: Integer) { return 210 * (index + 1); }
def page:Group = Group{
  content: [
    for(i in [0..IMG_NB]){
      ImageView {
        var bool = true;
        translateX: getOrig(i)
        translateY: 175 //* (i+1)
        scaleX: 1.0
        scaleY: 1.0
        preserveRatio: true
        smooth: true
        image: Image {
          width: 75
          height: 75
          url: "file:/{image_folder}/{imgArray}"
onMouseClicked: function( e: MouseEvent ): Void {
if(bool){
bool = false;
slideOut(i,IMG_NB);
//~ zoomIn(page.content[i]);
}else{
bool = true;
//~ zoomOut(page.content[i]);
slideIn(i,IMG_NB);
Commented out the zoomIn/zomOut you don't provide, and replaced some unknown variables by my own...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • HT201210 i updated my 4s yesterday, but my phone will not work at all now, and will not turn off. It has a itunes image on the screen with an arrow undernieth and what looks like the charger lead. i've had it on charge! is there anything else i can do?

    i updated my 4s yesterday, but my phone will not work at all now, and will not turn off. It has a itunes image on the screen with an arrow underneath and what looks like the charger lead. i've had it on charge! is there anything else i can do?

    Cconnect it to your computer with the latest version of iTunes installed.

  • How do you turn off the screen with out turning off the computer?

    How do you turn off the screen without turning off the computer?

    FletCheryl wrote:
    In preferences, I assigned screen off to one of the screen corners on my iMac.  when I move teh mouse pointer to fully bottom right, the screen goes black.
    This is what I do

  • MacBook Pro Display (window) shifts off the screen when I move my mouse

    With a slight move with my magic mouse, my entire open window will shift completely off the screen with only a part of the window still visible. I have to click on the exposed edge of the window for it to shift back into place. It's only the window of the program that I have open that moves. The dock and the desktop image stays in place. I'm using an HP external monitor now but it was doing this before I hooked up the monitor. I've tried maximizing and minimizing my window but that does not seem to have an effect. Could it be the magic mouse? Thanks in advance for any help.

    Wow. The power of Google is truly amazing. Just a little while ago, my husband was going nuts with our computer. I googled the words 'when I move my mouse to the left, the screen moves to the right'. And, Eureka! What do you think was the first thing that popped up on Google?
    Well, the answer to my question, of course!:P Which led me right to here. It may not have been me that asked the question, but this did answer MY question!
    Apparently this applies to Leopard too. Thanks alot!
    Message was edited by: Linda Schodowsky

  • Image dropping off the screen

    I am new to Photoshop (CC).  I have been using some tools successfully, but now when I try to use the Healing, Tool, Patch, Type and some others, the image drops off the screen as soon as I place the tool onto the screen. Then I cannot work on the image.  It just started today. Amy ideas???

    Usually any issue thats have to do with the displaying an image or any part of photoshop for that matter, is due to an out dated video driver. Try updating it and see if that fixes the issue.
    If the image is just too large to display, you can hold the ctrl key and the 0 on the numeric panel to zoom out to the full size of that image.

  • I received a notice to my ipad to update ios7 the latest version. i clicked on update now and the ipad is frozen with an itunes logo and a ipad connector image on the screen. anyone help me with this

    I received a notice to update my ipad to the latest version of ios7 and when I did the ipad froze with a itune logo and an ipad connector image on the screen..i have turned it off several times but it remains frozen. anyone help with this?

    Unfortunately, your iPad went into recovery mode and must be restored now. There is no getting around this. You need to use iTunes to do this as well. Read this for more instructions.
    If you can't update or restore your iOS device - Apple Support

  • Today I get issues with thte device. When I in a phone call, the screen don't auto turn off. There is no a screen protector on there and it seems that the built-in proximity sensor is not responding. I have to press the screen with my face accidently.

    today I get issues with my z10 device. When I in a phone call, the screen don’t auto turn off. There is no a screen protector on there and it seems that the built-in proximity sensor is not responding. I have to press the screen with my face accidently. can anyone help me with this?

    Same issue already several weeks.
    And we are not alone:
    http://forums.crackberry.com/blackberry-z10-f254/proximity-sensors-still-not-working-my-z10-891783/i...
    At all there is, I think, 4 threads in parallel about this issue at CB forums. One of the:
    ms.crackberry.com/blackberry-z10-f254/proximity-sensors-still-not-working-my-z10-891783/index5.html
    I already contacted BB Help at Twitter. Answer:
    Thanks for the information. It seems that you have installed an OS version higher than the one supported by your carrier on your device. Please contact your carrier to get the supported OS version and try the proximity and light sensors. Let us know if you need further assistance. Cheers. ^LFC.
    I did replay:
    You are confused me. Phone got updates over network automatically. On crackberry forum a lot of people from different countries and with Different OS version, but with the same problem. Hi, this is thread at CrackBerry: http://forums.crackberry.com/blackberry-z10-f254/proximity-sensor-906493/index3.html
    This my replay was 22 of march. No more answer from BB.
    I can't contact my operator - 3UK, because I bought my from on Amazon from Amazon. This phone not from operator - seller is Amazon.
    What I already done:
    For last week, I read, how to install OS using Sachesi and Autoloader. I used Sachesi to load 3 UK version, I installed autoloader from this links:
    http://supportforums.blackberry.com/t5/BlackBerry-10-OS-Device-Software/Upgrading-OS10-devices-using...
    This
    For Z10 models STL100-1, 2, -3, -4: Download 10.2.1.1925
    Doesn't help
    And this:
    For Z10 models STL100-2, -3, -4: Download the 10.2.0.1803 OS
    No result.
    After install all of them phone wants to update to 10.2.1.2102 by air.
    BBVE in all versions sais: Can not obtain data from sensors.
    Dear BB support, please, can you explain, how to resolve this issue?

  • My iphone 5 died so I plugged it back in to charge and it will not turn on. It will turn to the screen with the apple logo and black screen then turn off again. Any suggestions?

    My iphone 5 died so I plugged it back in to charge and it will not turn on. It will turn to the screen with the apple logo and black screen then turn off again. Any suggestions?

    I leave it charging until it gets back to full, usually it turns on after a little bit of time after plugging it in, but all its doing is going to the apple logo screen and going blank again.

  • My iPad is stuck with a small blue screen saying iCloud Backup, this iPad hasn't been backed up in 4 weeks.Backups blah blah- Click OK. I can't get it off the screen and I can't use the iPad because of it. Can anyone out there help?

    my iPad is stuck with a small blue screen saying iCloud Backup, this iPad hasn't been backed up in 4 weeks.Backups blah blah… Click OK. I can't get it off the screen and I can't use the iPad because of it. Can anyone out there help?

    Have you tried restarting or resetting your iPad?
    Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after the iPad shuts down, then press the On/Off button until the Apple logo appears.
    Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds).

  • My iphone 4 fell off the charger and now it won't turn back on, it's stuck on the screen with the apple icon

    My iphone won't turn back on after it fell off the charger. When I plug it back into the charger, the screen with the apple icon pops up and it buzzes and just keeps repeating the same two steps. What can I do? Help!

    Try these steps: http://support.apple.com/kb/ts3281

  • Having trouble with music apps shutting down, even after I swipe them off the screen. They go off then come back on in a few minutes. This happens in my car either ubs plugged in, or bluetooth. ANy one else have that issue?

    Having trouble with music apps shutting down, even after I swipe them off the screen. They go off then come back on in a few minutes. This happens in my car either ubs plugged in, or bluetooth. ANy one else have that issue?

    Hi, beth.lau.gr.
    Thank you for visiting Apple Support Communities.  
    I understand you have been experiencing issues with your iPhone restarting and showing you a blue screen.  I wont be able to give you an exact answer as to why this is happening.  However, this is the most relevant troubleshooting article for this issue.  This article also provides options to reach out to us via phone for additional assistance.  
    If your iOS device restarts, displays the Apple logo, or powers off while you're using it
    http://support.apple.com/en-us/HT203899
    Cheers, 
    Jason H.  

  • Firefox 4 won't let me save any image off the internet (works fine with IE)

    Ok...Firefox 4 won't let me save any image off the internet. It will let me right click on the image, but I won't let me choose a file type..like jpeg.
    I couldn't figure it out so i completely uninstalled firefox then reinstalled. I'm still having the same problems.
    I can save images normally with IE.

    Yahoo! mail? There are a variety of suggestions but not yet a confirmed solution in this thread: [https://support.mozilla.org/en-US/questions/971042 Firefox suddently stopped downloading email attachments.]

  • Images keep going off the screen

    Hi,
    I have created a simple card game and added motion tween to it, the cards move around in a sqaure but they go off the screen and come back on because when i run the swf file, the window is to small, if i make the window bigger it still does not keep it on the screen. so it will go down off scren then back up on screen.
    I wanted to knrow if i could set it to automticlly set the window so that it does not go off screen.
    Thank you

    Sorry i think i made it more complicated than it is, let me put this way:
    I got an image and everytime i run the image on the flash player the entire image does not show cause it goes off screen, how do i optimize the screen to show the entire image?

  • Refurbished iPod touch 3rd gen won't start.  Just got it today to replace my broken one. It freezes at the screen with the apple logo, then flashes off and tries to restart again. Help,

    Refurbished iPod touch 3rd gen won't start.  Just got it today to replace my broken one. It freezes at the screen with the apple logo, then flashes off and tries to restart again. Help!

    I have tried holding the power home button but all that does is turn it off. When I try to start it again it goes into the same loop.

  • Frozen iPod classic with lock and battery images on the screen

    When I unlocked my iPod classic while listening to music, everything stopped, and i got an image on the screen of the time when this happened (6:30), a lock image below it on the left, and a black horizontal battery on the right. The iPod won't work now, whether locked/unlocked or whether connected/unconnected to my PC/iTunes. What, if anything is the fix?

    Have you tried just a hard reset yet? To do this, first make sure the hold switch is toggled to the off position, then press and hold both the Select/Center and Menu buttons together long enough for the Apple logo to appear.
    B-rock

Maybe you are looking for

  • No link between PR material and PO Material code.

    Dear Gurus My industry is textile industry , here issue is that when MRP run it is giving auto PR based on BOM , but when purchase department is received PR , they start analyzing material the material requirement , they check in stock any raw fabric

  • Trying to restore external HDD

    I was doing regular backups of an external drive to my time capsule, and recently the drive crashed which required me to reformat it. I gave it the same name and thought I could restore it via Time Machine but when I select this drive under Time Mach

  • C309g causes router to stop internet from router

    I bought a c309 and connected wirelessly to a Netgear N-300 router (Comcast modem),  I am able to print from my laptop wirelessly but after a few minutes i find none of the computers in the house can receive internet (though strangely my son's comput

  • Critic error 1603

    Hi all I tried to install the latest version of Skype today. During installation process, it always pops up a message "Could not open key HKEY_LOCAL_MACHINE32\Software\Microsoft\Internet Explorer\Main\Feature Control\FEATURE_MAXCONNECTIONSPERSERVER.

  • How to create .ejb file?

    Hi all. I am trying to deploy a session bean from JDEV 3.0 to Oracle 8i 8.1.5. In the deployment profile wizard (step 2), JDeveloper asks to specify a EJB Definition file (*.ejb). The Enterprise JavaBeans and CORBA Developers Guide for 8.1.5 describe