A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: seems like it would so easy...

  1. #1

    seems like it would so easy...

    Hello,

    I was having a problem with duplicating a movie useing duplicateMovieClip().

    Here is the fla/swf
    http://funk.6040.org/flashkit/help/test.swf
    http://funk.6040.org/flashkit/help/test.fla

    Here is the code I am useing... Anyone see anything wrong??

    onClipEvent (keyDown) {
    // Retrieve the ASCII value of the last key pressed and convert it to a character
    lastKeyPressed = String.fromCharCode(Key.getAscii());
    trace("You pressed the '"+lastKeyPressed+"' key.");
    // Defines the key pressed down and tell it to place the animation
    _root.keyPressed.theLetter = lastKeyPressed;
    _root.keyPressed.gotoAndPlay(2);
    //declare x var.
    x =+ 1;
    //attempt to duplicate the MC and move it to the right.
    _root.keyPressed.duplicateMovieClip("dupMC"+x, x);
    _root["dupMC"+x]._x = x*5;
    }

    If anybody can guide me in a direction that would be really cool.

    Thank you,
    Mike
    Attached Files Attached Files

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    something like this?
    code:

    onClipEvent (keyDown) {
    // Retrieve the ASCII value of the last key pressed and convert it to a character
    lastKeyPressed = String.fromCharCode(Key.getAscii());
    trace("You pressed the '" + lastKeyPressed + "' key.");
    _root.keyPressed.theLetter = lastKeyPressed;
    _root.keyPressed.gotoAndPlay(2);
    //
    x++;
    //attempt to duplicate the MC and move it to the right.
    _root.keyPressed.duplicateMovieClip("dupMC" + x, x);
    _root["dupMC" + x]._x = x * 5;
    //
    _root["dupMC" + x].theLetter = lastKeyPressed;
    _root["dupMC" + x].gotoAndPlay(2);
    }


  3. #3
    nunomira

    Thanks a lot for the help!! I knew something stupid was missing.

    This works almost perfectly... Something still isn't working like I want it to however I want to try to figure it out before asking for help.

    Thanks again mang!

    Mike

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