Featured FLA
» Author: Bugra Ozden
» Title: Skatalog v9 - product catalog
» Description: Create your product catalog easly and publish on your website or Create your image gallery, documents list, portfolio. Fully XML Driven
» More by Bugra Ozden
Featured Site
» Posted in the Flash Kit Links section
» Title: Creative DW Image Show PRO
» Description: Creative DW Image Show PRO is a Dreamweaver extension which enables the user to create multimedia presentations. It combines the features of the popular Creative DW Image Show with the ability to add professional text effects to slides (similar to After Effects). The product is very customizable: the user can choose the duration of the transition effects, the slide motion start and end position, zoom and panning type for both images and texts.
'
Line Tutorial Page Three
In the next part, our function will look at the magnitude of our slope. If the slope is vertically oreinted or has an absolute value greater than 1, then we will draw our line 1 way, and if the line ihorizontally oriented a different way. It took me a while to realize why my lines where sometimes blurring, but it was becuase I was drawing them to several thousound pixels beyond the Stage's height, and apparently that is too much for Flash to do without some distortion.
// the next block is how we will draw the line
// if the absolute value of the slope is greater than 1
else if( (Math.abs( _slope )> 1) && (_slope != 0) )
{
// the next few variables will be soon be used
// when we draw our line
var newDeltY:Number;
var newDeltY2:Number;
var _newX:Number;
var _bttmX:Number;
// Since Flash coutns the top of the stage as y =0
// newDeltY = the y value of our clip
newDeltY = myClip1._y;
// Now use our slope and the prior variable to find
//the x to which we want to draw our line
_newX = myClip1._x + (newDeltY/ _slope);
newDeltY2 = Stage.height- myClip1._y;
_bttmX = myClip1._x - (newDeltY2 / _slope);
// Now move pen of line to _btttmX and Stage.height
//the latter point is the bottom most point of our line
drawLineInThisClip.moveTo( _bttmX , Stage.height);
// Drw line to _newX and the top of the stage ('0')
drawLineInThisClip.lineTo(_newX,0);
}
// the final block is how we will draw the line
// if the absolute value of the slope is LESS than 1
else
{
//deltaX is from point to total right (Stage.width)
newDeltX = (Stage.width - myClip1._x);
// endY is the y value corresponding with
//newDeltX on a line with our _slope
endY = ( myClip1._y - ( newDeltX*_slope ));
staRtY = ( myClip1._y )+ (myClip1._x*_slope );
//_totalLeft is at the very top of the function and we initialized it to 0
//because we want to start at the total left of the Stage or x =0
//_totalRight we initialized to Stage.width which is the total right of the stage
// both variables are at the very top of the funtion
drawLineInThisClip.moveTo(_totalLeft, staRtY);
drawLineInThisClip.lineTo(_totalRight,endY);
}