A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: ********* movie clip not positioned correctly *********

  1. #1
    Code:
    i = "1";
    dosubfire = "0";
    if (dosubfire == 0) {
        duplicateMovieClip (_root.subfire, "subfire"+i, i);
        _root["subfire"+i]._x = _root.sub.subgraphic._x;
        _root["subfire"+i]._y = _root.sub.subgraphic._y;
        i = i+1;
    } else {
        play ();
    }
    the idea is to position subfire at the current position of subgraphic. both are movie clips, despite their names. everything works except that subfire is positioned way off to the top right of the stage, far away from subgraphic. it's very strange. ideas?

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Posts
    341
    You're using this as a frame action right?

    The problem is you are referencing subgraphic's local coordinates. If subgraphics _x value is 25 inside it's parent MC, then subfire's _x will be 25 on the main stage.

    So you have to compensate for it's parent:

    _root["subfire"+i]._x = _root.sub.subgraphic._x + _root.sub._x;
    _root["subfire"+i]._y = _root.sub.subgraphic._y + _root.sub._y;

    Also for i and dosubfire, take the quotes off the values. It's going to cause problems.

    Alex

  3. #3
    yes its a frame action. i made the adjustments, and now subfire appears slightly offscreen to the right, but the y positioning is correct. btw, my movie is 550x400


    [Edited by banglafreak on 01-20-2001 at 07:18 PM]

  4. #4
    constantly im revising my code, making it better and closer to what i want. heres the most recent version:
    Code:
    subnumber = 1
    function subfire () {
        i = 1;
        dosubfire = 0;
        if (dosubfire == 0) {
            duplicateMovieClip (_root.subfire, "subfire"+i, i);
            _root["subfire"+i]._x = _root["sub" add Number(subnumber)].subgraphic._x+_root["sub" add Number(subnumber)]._x;
            _root["subfire"+i]._y = _root["sub" add Number(subnumber)].subgraphic._y+_root["sub" add Number(subnumber)]._y;
            i = i+1;
        } else {
            play ();
        }
    }
    its very complicated right now...the movie clip "subfire" appears ahead of the moving mc "subgraphic"
    so the x is off, the y is fine. please help, thanks

  5. #5
    -top-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center