Results 1 to 3 of 3

Thread: Interactive images slider (with images download)

  1. #1

    Default Interactive images slider (with images download)

    I try make images slider with buttons "left", "right".

    I have 3 image objects [left,mid,right]
    and 3 scenes: Stand (no animation), Left (move left), Right (move right)
    Code:
    // for each image object
    ...
    var imgMid = controller.getElementIdById('imgMidID')
    var qsMid =  document.querySelector('#' + imgMid+' img');
    qsMid.src = midImgSrc;
    ...
     pictLoaded();

    Code:
    var pictLoaded= function() {
    ...
            if (animType == 1)
            {
                controller.goToTimelineByName('left')
            } else if (animType == 2)
            {
                controller.goToTimelineByName('right')
            }
    ...
    }
    its work, but images have no time to be displayed (blink)

    then i use "onload"

    Code:
     qsMid.onload = function(){
            pictLoaded();
        }
    qsMid.src = midImgSrc;


    its work almost perfect on Google Chrome and IE, but dont work on FF (FF does not support .onload with sencha object if this image in browser cash)

    Then i try use same hack:

    Code:
     var imgMid = controller.getElementIdById('imgMidID')
     var qsMid =  document.querySelector('#' + imgMid+' img');
     var midImgHack  = new Image();
     midImgHack.onload = function(){
            pictLoaded();
     }
      midImgHack.src = midImgSrc;
      qsMid.src = midImgSrc;
    its work on all brousers, but i think Sencha have some other solutions ?
    For example in Adobe flash i can load all images in the same obects and just make ".visible=false", or ".visible=true" without reloading.

  2. #2
    Sencha User
    Join Date
    Apr 2012
    Posts
    304

    Default

    Hi,

    I suggest you should look into using timelines rather than using separate scenes. This way you are animating same dom objects rather than having to load different ones due to scene switching. Take a look at this project, as it deals exactly with that (slide in/slide out): http://animator.sencha.com/demo/Buildings/

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    304

    Default

    Moved the thread to Help&Discussion, as it's not a feature request.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •