PDA

View Full Version : Custom scroll box for text / images...???


croix
03-07-2007, 03:49 PM
Hello,
I have decided to start learing flash, and I have gotten pretty far in the last 2 days just from reading tutorials on here and kirupa.

Now I have run into a problem that I cant find a tutorial or reference for.

I am trying to create a scrollable window, but all of the pieces are custom.

I made the background, and the "scroller" and the mask, but I cant find out how to make it interact.

Here's the link:
http://www.voiceman.com/new/clients.htm

Here's my FLA
http://www.voiceman.com/new/clients.fla

None of the buttons work yet, as this is the first page I have started.

Thanks for your help..

Colin





****************edit****************

Im looking at a few tutorials, and I think Im going to run into trouble because my buttons are in the same swf as my contents.

From what I understand, I should be able to do this, but none of the tutorial I have found are mentioning an option to do it this way.

So should I be removing my buttons and starting over?

croix
03-07-2007, 09:51 PM
OK, so heres what Ive done so far. (That didnt work)

I implemented some code from the tutorial.

I made my content (text and graphics) into a MC named clients_content_mc
I made my mask into a MC name content_masker
I made my scrollface into a MC named fader

I created a scrolltrack, made it invisible, made it a MC, and named it fadertrack

and here's the actionscript:

scrolling = function () {
var scrollHeight:Number = fadertrack._height;
var contentHeight:Number = clients_content_mc._height;
var scrollFaceHeight:Number = fader._height;
var maskHeight:Number = content_masker._height;
var initPosition:Number = fader._y=scrollTrack._y;
var initContentPos:Number = clients_content_mc._y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
var left:Number = fadertrack._x;
var top:Number = fadertrack._y;
var right:Number = fadertrack._x;
var bottom:Number = fadertrack._height-scrollFaceHeight+scrollTrack._y;
var dy:Number = 0;
var speed:Number = 10;
var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-scrollFaceHeight);

fader.onPress = function() {
var currPos:Number = this._y;
startDrag(this, false, left, top, right, bottom);
this.onMouseMove = function() {
dy = Math.abs(initPosition-this._y);
client_content_mc._y = Math.round(dy*-1*moveVal+initContentPos);
};
};
fader.onMouseUp = function() {
stopDrag();
delete this.onMouseMove;
};

btnUp.onPress = function() {
this.onEnterFrame = function() {
if (clients_content_mc._y+speed<content_masker._y) {
if (fader._y<=top) {
fader._y = top;
} else {
fader._y -= speed/moveVal;
}
clients_content_mc._y += speed;
} else {
fader._y = top;
fader._y = content_masker._y;
delete this.onEnterFrame;
}
};
};
btnUp.onDragOut = function() {
delete this.onEnterFrame;
};
btnUp.onRollOut = function() {
delete this.onEnterFrame;
};
btnDown.onPress = function() {
this.onEnterFrame = function() {
if (clients_content_mc._y-speed>finalContentPos) {
if (fader._y>=bottom) {
fader._y = bottom;
} else {
fader._y += speed/moveVal;
}
clients_content_mc._y -= speed;
} else {
fader._y = bottom;
clients_content_mc._y = finalContentPos;
delete this.onEnterFrame;
}
};
};
btnDown.onRelease = function() {
delete this.onEnterFrame;
};
btnDown.onDragOut = function() {
delete this.onEnterFrame;
};

if (contentHeight<maskHeight) {
fader._visible = false;
btnUp.enabled = false;
btnDown.enabled = false;
} else {
fader._visible = true;
btnUp.enabled = true;
btnDown.enabled = true;
}
};
scrolling();


Now, I know there is some extra actionscript in there, (for the up and down buttons which Im not using) but Im not getting any actionscript errors, and my attempts to erase teh extra code are giving my errors.

Anyway, this doesnt do anything for me. The movie plays just like it has before, but there is no scrolling action.

colin

croix
03-09-2007, 07:58 PM
started over, new technique, still dont have it right.

OK, here's the link to the page with the flash.

http://www.voiceman.com/new/index.htm


And the container FLA
http://www.voiceman.com/new/containerpage.fla

And the first content page:
http://www.voiceman.com/new/index.fla


I thought I had this all figured out when I started over, but apparently not as it turns out.
Ideas?

thanks,
colin