dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: createEmptyMovieClip and duplicateMovieClip???

  1. #1
    Member
    Join Date
    May 2000
    Location
    germany
    Posts
    55

    createEmptyMovieClip and duplicateMovieClip???

    hi there!

    i've posted this question several times
    on flashMX-forum but not one person answered!!!

    is it that difficult?

    try it please:

    trying to figure out why this happens...
    i am creating an empty movieclip [c0], then
    inside that clip another movieclip [fill] and
    then i am trying to duplicate the initial
    clip [c0] (which contains [fill]) but it only
    duplicates [c0] without the content [fill]...

    makes me crazy!!!
    why does it happen?
    any idea? help?

    here is the code:
    all you need to do in order to test it
    is copying into an empty frame, no lib etc. needed
    __________________________________________________

    Code:
    radius = 50;
    outline = 0;
    
    function create() {
        _root.createEmptyMovieClip("c0", 1);
        c0.createEmptyMovieClip("fill", 2);
        with (c0.fill) {
            var a = radius;
            var b = radius;
            var j = a*0.70711;
            var n = b*0.70711;
            var i = j-(b-n)*a/b;
            var m = n-(a-j)*b/a;
            var x = Stage.width/2;
            var y = Stage.height/2;
            //lineStyle(outline, 0x000000, 100);
            beginFill(0xff0000, 100);
            moveTo(x+a, y);
            curveTo(x+a, y-m, x+j, y-n);
            curveTo(x+i, y-b, x, y-b);
            curveTo(x-i, y-b, x-j, y-n);
            curveTo(x-a, y-m, x-a, y);
            curveTo(x-a, y+m, x-j, y+n);
            curveTo(x-i, y+b, x, y+b);
            curveTo(x+i, y+b, x+j, y+n);
            curveTo(x+a, y+m, x+a, y);
        }
    }
    
    create();
    
    duplicateMovieClip("c0", "c1", 3);
    
    trace ("c0._x: " + c0._x);
    trace ("c0._h: " + c0._height);
    
    trace ("c1._x: " + c1._x);
    trace ("c1._h: " + c1._height);
    
    stop();
    __________________________________________________




    thanx in advance!!!
    deeno
    Last edited by deeno; 01-29-2003 at 05:10 PM.
    2B II ! 2B

    ...shakespear adapted to c++

  2. #2
    Member
    Join Date
    Jan 2001
    Posts
    57
    hi

    i am just a beginner but may be i can give you a hint.

    if you are sure that your code is correct

    put this code :


    radius = 50;
    outline = 0;

    function create() {
    _root.createEmptyMovieClip("c0", 1);
    c0.createEmptyMovieClip("fill", 2);
    with (c0.fill) {
    var a = radius;
    var b = radius;
    var j = a*0.70711;
    var n = b*0.70711;
    var i = j-(b-n)*a/b;
    var m = n-(a-j)*b/a;
    var x = Stage.width/2;
    var y = Stage.height/2;
    //lineStyle(outline, 0x000000, 100);
    beginFill(0xff0000, 100);
    moveTo(x+a, y);
    curveTo(x+a, y-m, x+j, y-n);
    curveTo(x+i, y-b, x, y-b);
    curveTo(x-i, y-b, x-j, y-n);
    curveTo(x-a, y-m, x-a, y);
    curveTo(x-a, y+m, x-j, y+n);
    curveTo(x-i, y+b, x, y+b);
    curveTo(x+i, y+b, x+j, y+n);
    curveTo(x+a, y+m, x+a, y);
    }
    }

    create();

    on an empty frame then put the duplicate code

    onClipEvent(enterFrame) {
    _parent.create();
    }

    and the rest of your code on the empty movie clip in another frame with the fill movie clip ( both in the same frame )

    try this may be it works.

  3. #3
    Member
    Join Date
    May 2000
    Location
    germany
    Posts
    55
    at last!
    someone answering!

    have you tried your solution?

    i dont think it can work because the mc fill does
    not exist, therefore i cannot add there a scipt...

    but again, maybe you mean sth different?
    does it work this way for you?

    thanx for the reply!

    deeno
    2B II ! 2B

    ...shakespear adapted to c++

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