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

Trouble with line drawing

New Here ,
Mar 29, 2012 Mar 29, 2012

Copy link to clipboard

Copied

Can somebody help me figure out why this isn't drawing a line? The code is in frame 1 by itself, and I'm not getting any errors.

var brownLineDraw:Shape = new Shape();

brownLineDraw.graphics.lineStyle(12, 0x352000, 1);

brownLineDraw.graphics.moveTo(100, 100);

brownLineDraw.graphics.lineTo(200, 200);

Thanks!

TOPICS
ActionScript

Views

414

Translate

Translate

Report

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
New Here ,
Mar 29, 2012 Mar 29, 2012

Copy link to clipboard

Copied

I figured it out, you have to add the line to the stage using, in this case:

this.addChild(brownLineDraw);

Hooray!

Votes

Translate

Translate

Report

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
New Here ,
Mar 29, 2012 Mar 29, 2012

Copy link to clipboard

Copied

However I have a new problem: the line is supposed to follow things on the stage, and every frame, it makes a new line. Does anybody know how to prevent this?

Votes

Translate

Translate

Report

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
LEGEND ,
Mar 29, 2012 Mar 29, 2012

Copy link to clipboard

Copied

LATEST

By default a movieclip will loop. You just need to put a stop(); in the frame script (anywhere) to tell Flash not to run the code over and over.

Votes

Translate

Translate

Report

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