A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [flash 9]Duplicating Movie Clips(7 lines of code)

Threaded View

  1. #1
    Member
    Join Date
    May 2006
    Posts
    70

    [flash 9]Duplicating Movie Clips(7 lines of code)

    I'm in the middle of converting my f8 code to f9 and I've been able to convert most of it without too many problems. However, I'm now trying to replace my attachMovieClip() with a class and having some problems.

    Here is my class I'm testing:
    Code:
    package {
    	import flash.display.MovieClip;
    	public class ball extends MovieClip {
    
    
    	}
    }
    And Here's my code in the main timeline:
    Code:
    var test:ball = new ball();
    addChild(test);
    It's that simple, btw there is not one drop of code anywhere else in the file, so its not possible something else could be interfering.

    Now this code does in fact work with just a simple movieclip with a graphic inside. However, if I give the graphic inside this movieclip an instance name, my movieclip can not be duplicated and I recieve this error:

    Code:
    ReferenceError: Error #1056: Cannot create property test on ball.
    	at flash.display::Sprite/flash.display:Sprite::constructChildren()
    	at flash.display::Sprite$iinit()
    	at flash.display::MovieClip$iinit()
    	at ball$iinit()
    	at Timeline0_274b7e9de3dce042beb2659b4677c86/::frame1()
    "test" is the instance name I gave the graphic inside the movieclip. If I remove the instance name, everything works.

    I have attached a zip file with the source(same code I posted above).

    Thanks for your help.
    Attached Files Attached Files
    Last edited by jason merchant; 07-01-2006 at 02:21 AM.

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