A Flash Developer Resource Site

Results 1 to 5 of 5

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

  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.

  2. #2
    Member
    Join Date
    May 2006
    Posts
    70
    Has anyone else done this successfully with f9? Could it be a bug in f9 itself?

  3. #3
    Feeling adventurous? T1ger's Avatar
    Join Date
    Mar 2004
    Posts
    850
    Oh my..

    F9 is so going to give me a headache..
    I don't have a photograph, but you can have my footprints. They're upstairs in my socks.

  4. #4
    Member
    Join Date
    May 2006
    Posts
    70
    Actually a simple attachmovie() type thing doesn't need the class(flash will automatically create one for you in the background).

    All you need to do is use these 2 lines:
    var test:ball = new ball();
    addChild(test);

    The reason I am using the class(although I didn't post the code for this) is because I have want to give the movieclips properties like health, etc.

    What is interesting is that when the class is auto-generated I don't get the error, so I thought maybe something was wrong with my class, but look at it, its as simple and clean as it can be. I can't see what is wrong with it. My best guess is this is a bug that was not caught in Flex(or what ever used as3 before f9) because it could not be caught. I've never used flex but I don't think there is a graphical interface like in flash so this bug would have not been found.

    Mabe I'm blind but I can't find the place to submit as3 bugs, can someone point me to it?

  5. #5
    Senior Member chriserrorplain's Avatar
    Join Date
    Aug 2002
    Location
    london village
    Posts
    623
    edited cos I am thick, I believe

    chrisError//
    Last edited by chriserrorplain; 07-02-2006 at 09:14 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