A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Image Gallery Lingering Undesirably

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    1

    Talking Image Gallery Lingering Undesirably

    Hello, everyone.

    I've made a nice little photo gallery for my website page using AS2 but I've run into a problem. I want the gallery to appear when I click on the "photos" page," then immediately disappear when I click on/load another page. However, the gallery keeps floating on all other pages and blocking all other content. I've placed the code on the "photos" page layer of my website. I prefer loading it off the layer rather then a button. Here's my code.

    import mx.transitions.Tween;
    import mx.transitions.easing.*;

    this.createEmptyMovieClip("container",1);
    var imagesNumber:Number = 9;
    var scrolling:Boolean = true;

    for (i=1; i<=imagesNumber; i++) {
    container.attachMovie("thumb"+i,"thumb"+i+"_mc",i) ;
    myThumb_mc = container["thumb"+i+"_mc"];
    myThumb_mc._x = (i-1)*myThumb_mc._width;
    myThumb_mc._y = (Stage.height-myThumb_mc._height)/2;
    myThumb_mc._alpha = 50;
    myThumb_mc.largerImage = i;
    myThumb_mc.onRollOver = function() {
    this._alpha = 100;
    };
    myThumb_mc.onRollOut = function() {
    this._alpha = 50;
    };
    myThumb_mc.onRelease = function() {
    this._alpha=50;
    for (i=1; i<=imagesNumber; i++) {
    var myClip = container["thumb"+i+"_mc"];
    myClip.enabled = false;
    }
    scrolling = false;
    _root.attachMovie("image"+this.largerImage,"large_ mc",2);
    large_mc._x = (Stage.width-large_mc._width)/2;
    large_mc._y = (Stage.height-large_mc._height)/2;
    new Tween(large_mc, "_alpha", Strong.easeOut, 0, 100, 0.5, true);
    new Tween(container, "_alpha", Strong.easeOut, 100, 50, 0.5, true);
    large_mc.onRelease = function() {
    this.enabled=false;
    scrolling = true;
    var myFadeOut = new Tween(large_mc, "_alpha", Strong.easeOut, 100, 0, 0.5, true);
    new Tween(container, "_alpha", Strong.easeOut, 50, 100, 0.5, true);
    myFadeOut.onMotionFinished = function() {
    for (i=1; i<=imagesNumber; i++) {
    var myClip = container["thumb"+i+"_mc"];
    myClip.enabled = true;
    }
    large_mc.removeMovieClip();
    };
    };
    };
    }
    container.onEnterFrame = function() {
    if (scrolling) {
    this._x += Math.cos((-_root._xmouse/Stage.width)*Math.PI)*15;
    if (this._x>0) {
    this._x = 0;
    }
    if (-this._x>(this._width-Stage.width)) {
    this._x = -(this._width-Stage.width);
    }
    }
    };
    stop();
    All my pages are done in flash on the timeline in different layers. I've done nothing in the way of html right now. I'm running the website as a swf. My menu is entirely made of buttons and the pages themselves are all MCs. Even the text scroll box is made with AS2.

    I'm looking for a solution that can be applied to the code above so that the gallery will disappear when entering another page in my swf. Thanks again

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    You could try using
    PHP Code:
    removeMovieClip(container); 
    on your button commands or when you go to another frame.

    If you are not using more than one frame then you might need to put your gallery code inside a function and call it when required, but the first suggestion should suffice.

  3. #3
    Junior Member
    Join Date
    Jul 2013
    Posts
    22
    Check this image reading gallery which contains the comprehensive image viewing, processing, saving and priting and many more image add-on functions that can be integrated within .net framework developing platfroms and java programming environment.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center