PDA

View Full Version : ActionScript help


BenP
2007-11-20, 20:48
OK, in Flash 8 - I've got a slider bar that is basically a rectangle that slides along a line. I'd like for the rectangle to stretch to fill the line as it's dragged, much like a volume bar. It doesn't have to be the dragged bar; I'm trying to use another rectangle at the beginning of the bar right now. Here's what I have so far:

(slider definition)
<snip>
this.pos=0;
dragger.onPress=function(){
this.startDrag(true,0,0,line._width,0);
this.onEnterFrame=function(){
pos=dragger._x;
}
}
dragger.onRelease=dragger.onreleaseOutside=stopDra g;


(Scene 1)

this.onEnterFrame=function(){
myGreenChart._width=myGreenMix.pos;
}

(myGreenChart is a rectangle I'm trying to resize to fill the bar; myGreenMix is the slider instance)

myGreenChart resizes but it doesn't change width at the same rate as I drag the slider bar (dragger). Any ideas why? Sorry if this post is unintelligible; I'm really feeling my way along here.