Hi to all,
I am trying to create a gallery using loading of clips from the library when I select one of the thumbnails and then a close button on the clip to unload it. I am using the custom scrolling script I got from here as my stage for the gallery. Can anyone help me on this, I did the custom scrolling file and now I am stuck with it.
Below is the script:
on the main scene the codes
scrolling = function () {
var scrollHeight:Number = scrollbg._height;
var contentHeight:Number = contentMain._height;
var draggerHeight:Number = dragger._height;
var maskHeight:Number = maskedView._height;
//
var initPosition:Number = dragger._y=scrollbg._y; var initContentPos:Number = contentMain._y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
//
var left:Number = scrollbg._x;
var top:Number = scrollbg._y;
var right:Number = scrollbg._x;
var bottom:Number = scrollbg._height-draggerHeight+scrollbg._y;
//
var dy:Number = 0;
var speed:Number = 10;
var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-draggerHeight);
//
dragger.onPress = function() {
var currPos:Number = this._y;
startDrag(this, false, left, top, right, bottom);
this.onMouseMove = function() {
dy = Math.abs(initPosition-this._y);
contentMain._y = Math.round(dy*-1*moveVal+initContentPos);
};
};
dragger.onMouseUp = function() {
stopDrag();
delete this.onMouseMove;
};
btnUp.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y + speed < maskedView._y) {
trace(dragger._y + " " + top);
if (dragger._y <= top) {
dragger._y = top;
contentMain._y += speed;
} else {
contentMain._y += speed;
dragger._y -= speed / moveVal;
}
} else {
dragger._y = top;
contentMain._y = maskedView._y;
delete this.onEnterFrame;
}
};
};
btnUp.onDragOut = function() {
delete this.onEnterFrame;
};
btnUp.onMouseOut = function() {
delete this.onEnterFrame;
};
btnDown.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y - speed >finalContentPos) {
if (dragger._y>=bottom) {
contentMain._y -= speed;
dragger._y = bottom;
} else {
contentMain._y -= speed;
dragger._y += speed/moveVal;
}
} else {
dragger._y = bottom;
contentMain._y = finalContentPos;
delete this.onEnterFrame;
}
};
};
btnDown.onRelease = function() {
delete this.onEnterFrame;
};
btnDown.onDragOut = function() {
delete this.onEnterFrame;
};
};
scrolling();
// I will be putting the thumbnails in the “Content” clip which the scrolling scripts can call it out onto the stage. So the buttons to calling the individual clips of the thumbnails will be place in the “content” clip.
// The sample file is here: http://www.kirupa.com/forum/showthread.php?t=86602
And the loading and unloading of clips from library by neilmmm:
var attached:Boolean = false;
my_mc.onRelease = function() {
if (!attached) {
attached = true;
var t:MovieClip = this._parent.attachMovie(“win_mc”, “win_mc”, this._parent.getNextHighestDepth());
t._x = (Stage.width-t._width)/2;
t._y = (Stage.height-t._height)/2;
t.close_mc.onRelease = function() {
attached = false;
t.removeMovieClip();
};
}
};