www.webdeveloper.com
Results 1 to 3 of 3

Thread: [B]Controlling a Action Script transition loop[/B]

  1. #1
    Join Date
    Oct 2008
    Location
    moreno valley, California ,usa
    Posts
    161

    [B]Controlling a Action Script transition loop[/B]

    Hi everyone, my problem is I downloaded a banner transition effect; this effect is called 'picture shuffle', where each picture is briefly displayed and then it slides around behind the next picture which is displayed briefly,etc. I only want the program to loop thru all the pictures ONCE and then stop on the last or first picture (at this point, I don't care which one).

    Unfortunately, my poor knowledge of AS is frustrating me. Can someone look at the following code and tell me how to accomplish the 'once only loop'? the code isn't very long. Here it is:

    image_movieclip_array = [
    // [linkageNameOfMovieClip, waitAfterImage]
    [Image1, 1000],
    [Image2, 1000],
    [Image3, 1000]
    ]
    /* *************************** */


    // init vars
    var waitInterval:Number;
    var stage_img_array:Array = new Array();
    var ticker:Number = 0;
    var depthsTicker:Number;

    // attach movieclip
    for(var i = 0; i < image_movieclip_array.length; i++)
    {
    var img:MovieClip = new image_movieclip_array[i][0]();
    img.alpha = 0;
    addChild(img);
    stage_img_array.push(img);
    }

    // set vars
    var oldImage = stage_img_array[0];
    var newImage;
    var ff_component:ShuffleTransitionEffectAS3;

    // start transition
    nextImage();

    function nextImage(){

    // clear interval
    clearInterval(waitInterval);

    // set vars
    if(++ticker == image_movieclip_array.length) ticker = 0;

    if(ff_component != null)
    {
    ff_component.removeFilter();
    ff_component = null;
    }

    ff_component = new ShuffleTransitionEffectAS3();
    addChild(ff_component);

    // set vars and init filter
    newImage = stage_img_array[ticker];
    ff_component.init(oldImage, newImage, 75, ShuffleTransitionEffectAS3.LEFT_TO_RIGHT, "easeInOutCubic", false);
    ff_component.addEventListener(ShuffleTransitionEffectAS3.ANIMATION_DONE, onComplete);
    }

    // on complete method
    function onComplete(e:Event)
    {
    // set wait interval
    waitInterval = setInterval(nextImage, image_movieclip_array[ticker][1]);
    oldImage = newImage;
    }

    Your suggestions are deeply appreciated.

    captsig

  2. #2
    Join Date
    Sep 2010
    Location
    Melbourne, Australia - on loan from London, UK
    Posts
    56
    Hi
    You could try commenting out the lines below (in red):
    Code:
    // on complete method
    function onComplete(e:Event)
    {
    // set wait interval
    //waitInterval = setInterval(nextImage, image_movieclip_array[ticker][1]);
    //oldImage = newImage;
    }
    If that works... you may also be able to remove the line i've commented out below aswell:
    Code:
    // set vars and init filter
    newImage = stage_img_array[ticker];
    ff_component.init(oldImage, newImage, 75, ShuffleTransitionEffectAS3.LEFT_TO_RIGHT, "easeInOutCubic", false);
    //ff_component.addEventListener(ShuffleTransitionEffectAS3.ANIMATION_DONE, onComplete);
    }

  3. #3
    Join Date
    Oct 2008
    Location
    moreno valley, California ,usa
    Posts
    161

    resolved

    thanks for your reply, I tried that but it only cycled thru one picuture. However, it finally dawned on me how to do it, and I've got it working fine.

    thanks again,
    captsig

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles