Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Stage outline borders - plz help

Explorer ,
Aug 23, 2013 Aug 23, 2013

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 :

  • mask_mc - (width:500, height:66)
  • bg - (width:500, height:250)
  • stage size - (width:500, height:250)

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

TOPICS
ActionScript
311
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation