A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: avatar - actionscript movement problem - help

  1. #1
    Junior Member
    Join Date
    Feb 2001
    Posts
    23
    iv been working on a jabber-php-flash avatar chat for the last month so.

    i desided the easyest (and smallest way) would be to have a master avatar clip.. and dupicate that and load there avatars into it. This compicates the movement a little because each clip has its own name rather then a given.

    heres the basic layout

    Complete Avatar [movie]
    |
    Avatar [movie] - Menu [hidden, movie] - control [movie, contols movment]

    the control movie is where the problem is one of the first frames contains:

    if (runtime == "stopped") {
    with (_parent) {
    trace("playing movie");
    gotoAndPlay(3);
    }
    runtime = "playing";
    }
    if (_parent._x<= tox) {
    if (_parent.avatar.face == "left") {
    _parent.avatar._xscale = "-100";
    _parent.avatar.face = "right";
    }
    setProperty(_parent, _x, _parent._x+8);
    }
    if (_parent._x>= tox) {
    if (_parent.avatar.face == "right") {
    _parent.avatar._xscale = "100";
    _parent.avatar.face = "left";
    }
    setProperty(_parent, _x,_parent._x-8);
    }
    if (_parent._y<= toy) {
    setProperty(_parent, _y, _parent._y+8);
    }
    if (_parent._y>= toy) {
    setProperty(_parent, _y, _parent._y-8);
    }


    A few frames later we evaluate.. to deside if the movement is finished... if it is ..go to the first frame of the avatar.


    if (_parent._x - 8 <= tox and _parent._x + 8 >= tox and _parent._y - 8 <= toy and _parent._y + 8 >= toy) {
    with (_parent.avatar) {
    trace("stoping movie");
    gotoAndStop(1);
    }
    gotoAndStop(2);
    } else {
    gotoAndPlay(3);
    }


    Now, the problem is, when the control plays .. it restarts the full movie

    anyone have any ideas on how to fix this .. or improve appon this script.


  2. #2
    Junior Member
    Join Date
    Feb 2001
    Posts
    23
    ....

    Iv tryed everything i could think of.

  3. #3
    Junior Member
    Join Date
    Feb 2001
    Posts
    23

    Found .. the problem, but how to fix it.

    The restart problem lies in the start of the control unit...

    newfrom = data.firstChild.attributes["from"]
    newfrom = newfrom.replace(_root.message,"");
    newfrom = newfrom.replace("/","");
    set(newfrom + ".control.tox", data.firstChild.firstChild.attributes["x"]);
    set(newfrom + ".control.toy", data.firstChild.firstChild.attributes["y"]);

    with (newfrom + ".control") {
    play();
    }

    the with .. is what is makeing the movie mess up.
    any other way to do this?

  4. #4
    Senior Member
    Join Date
    Apr 2001
    Location
    Candyland
    Posts
    423
    try the eval() function.

    z = eval(newfrom+".control");
    z.play();

    or:

    this[newfrom+".control"].play();

    k.

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