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

accessing a property in a nested mc

Participant ,
Mar 19, 2010 Mar 19, 2010

Copy link to clipboard

Copied

hi all

really basic question:

I would like to rotate the yellow circle mc, w/ it's nested white circle movie clip, and use the drawing API to have a line continuously drawn to the white circle as it moves around.

I'm using the code below.  The line gets drawn to a static point, and not to the white circle (smBall) movie clip as I would expect.  I'm sure it's a noob mistake...

any tips greatly appreciated!

import gs.TweenLite;

TweenLite.to(bigBall, 10, {rotation:360, onUpdate:drawer});

function drawer()
{
    graphics.clear();
    graphics.lineStyle(1, 0x000000);
    graphics.moveTo(25,25);
    graphics.lineTo(bigBall.smBall.x, bigBall.smBall.y);
}

Picture 1.png

TOPICS
ActionScript

Views

632

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

correct answers 1 Correct answer

Community Expert , Mar 19, 2010 Mar 19, 2010

try:

function drawer() {
    var pt:Point = new Point(bigBall.smBall.x,bigBall.smBall.y);
    pt = bigBall.localToGlobal(pt);
    graphics.clear();
    graphics.lineStyle(1, 0x000000);
    graphics.moveTo(25,25);
    graphics.lineTo(pt.x, pt.y);
}

Votes

Translate

Translate
Community Expert ,
Mar 19, 2010 Mar 19, 2010

Copy link to clipboard

Copied

try:


import gs.TweenLite;

TweenLite.to(bigBall, 10, {rotation:360, onUpdate:drawer});

function drawer()
{
    graphics.clear();
    graphics.lineStyle(1, 0x000000);
    graphics.moveTo(25,25);
    graphics.lineTo(bigBall.x+bigBall.smBall.x, bigBall.y+bigBall.smBall.y);
}

Picture 1.png

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
Participant ,
Mar 19, 2010 Mar 19, 2010

Copy link to clipboard

Copied

thanks kglad--

this seems to get the line drawn to the starting point at least--but it remains static (still won't follow the circle as it rotates)Picture 1.png

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
Community Expert ,
Mar 19, 2010 Mar 19, 2010

Copy link to clipboard

Copied

try:

function drawer() {
    var pt:Point = new Point(bigBall.smBall.x,bigBall.smBall.y);
    pt = bigBall.localToGlobal(pt);
    graphics.clear();
    graphics.lineStyle(1, 0x000000);
    graphics.moveTo(25,25);
    graphics.lineTo(pt.x, pt.y);
}

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
Participant ,
Mar 20, 2010 Mar 20, 2010

Copy link to clipboard

Copied

that did the trick--thanks again kglad!   I'll have to do a little research on your solution

LML

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
Community Expert ,
Mar 20, 2010 Mar 20, 2010

Copy link to clipboard

Copied

LATEST

you're welcome.

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