Hi!
Trying to get my scroll to work. It is scrolling, but but more than I want to.
I have this bigHolderMC that is a movieclip that is being filled with pictures dynamiclly. Like I said, my movieclip is scrolling more than I want to. I have a mask that I attach and then setMask to my bigHolderMC.
Here is the part of my code:
class Collection {
public var objRef:Object;
private var scrollBar:MovieClip;
private var barX:Number;
private var targY:Number;
private var scrollAmount:Number;
public function Collection(arrPictures:Array) {
//Collection
objRef = this;
targY = 0;
barX = 5;
startEverything(arrPictures);
}
public function startEverything(arrPictures:Array) {
var nperc:Number = 0;
var xPos = 165;
_root.info_mc._visible = false;
_root.attachMovie("mask", "mask", _root.getNextHighestDepth(), {_x: 165, _y: 150});
_root.createEmptyMovieClip("bigHolderMC", _root.getNextHighestDepth());
_root.bigHolderMC.setMask(_root.mask);
scrollBar = _root.attachMovie("barMC", "barMC", _root.getNextHighestDepth(), {_x: 400, _y:650});
function scrollingPictures(scrollBar) {
scrollBar.onPress = function() {
this.startDrag(false,((Stage.width-_root.mask._width)/2)+scrollBar._width/2,650,1024-((Stage.width-_root.mask._width)/2+(scrollBar._width/2)),650);
}
scrollBar.onRelease = scrollBar.onReleaseOutside = function() {
this.stopDrag();
}
var objRef = this;
scrollBar._x = ((Stage.width-_root.mask._width)/2)+scrollBar._width/2;
barX = _root.bigHolderMC._width/_root.mask._width;
_root.bigHolderMC.onEnterFrame = function() {
objRef.scrollAmount = (this._width-(_root.mask._width/1.3))/(_root.mask._width-_root.barMC._width);
objRef.targY = -_root.barMC._x*objRef.scrollAmount;
this._x += (objRef.targY-this._x)/5;
trace(objRef.targY);
}
}
The function is called after I’ve looped out my pictures!