Copy link to clipboard
Copied
I am trying to create outline borders for a shape on the stage and then transform the borders to outline the entire stage.
I got 2 movieclips on my stage :
import flash.display.MovieClip;
import flash.display.Shape;
import com.greensock.*;
import com.greensock.easing.*;
var tw = TweenLite;
var _border:Shape;
var bannerWidth_Exp = bg.width;
var bannerHeight_Exp = bg.height;
var bannerWidth = mask_mc.width
var bannerHeight = mask_mc.height
var startX = mask_mc.x
var startY = mask_mc.y
function DrawBorder():void
{
_border = new Shape();
_border.graphics.lineStyle(1.0, 0x000000, 1.0, false, LineScaleMode.NONE);
_border.graphics.moveTo(startX, startY);
_border.graphics.lineTo(startX+bannerWidth, startY);
_border.graphics.lineTo(startX+bannerWidth, startY+bannerHeight);
_border.graphics.lineTo(startX, startY+bannerHeight);
_border.graphics.lineTo(startX, startY);
addBorders();
}
function addBorders():void{
addChild(_border);
_border.width = bannerWidth
_border.height = bannerHeight
_border.x = startX
_border.y = startY
trace("height: " + _border.height)
tw.to(mask_mc,1,{x:0,y:0,width:bannerWidth_Exp,height:bannerHeight_Exp, delay:0});
tw.to(_border,1,{width:bannerWidth_Exp,height:bannerHeight_Exp+3.5, delay:0,onComplete:tracer});
}
function tracer():void{
trace("width: " + _border.width)
trace("height: " + _border.height)
trace("x: " + _border.x)
trace("y: " + _border.y)
}
DrawBorder();
I am not sure why this actually works, I had to add 3.5px to : tw.to(_border,1,{width:bannerWidth_Exp,height:bannerHeight_Exp+3.5, delay:0,onComplete:tracer});
As the lines never reach the bottom fully.
I am tyring to get this code to work across any size mask_mc/bg combination.
if I dont use LineScaleMode.NONE
Line cut of on the right, are more visible on the bottom etc
Any help is much appriciated.
Regards,
Pavel
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now