A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: createEmptyMovieClips & prototypes

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Posts
    190
    Code:
    function Clip(){
    	this.createEmptyMovieClip("ChildClip",3);
    	trace(this.ChildClip);
    }
    Clip.prototype = MovieClip.prototype;
    myClip = new Clip();
    Why doesn't this work?

    Thanks in advance,
    Somar!

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    190
    It works if the movieclip is on the stage at design time, but I don't think Macromedia would make that mandatory... =/

  3. #3
    Senior Member
    Join Date
    May 2001
    Posts
    1,837
    I am not quitely sure about the reason.

    I think, "Class" is an object, not movieClip, so we can not do "Object.createEmptyMovieClip()"; Unless we combine this class to a movieClip by #initClip and Object.registerClass.

    To create a MovieClip dynamically, we have
    1.createEmptyMovieClip
    2.duplicateMovieClip
    3.attachMovie

    It seems that, we can not dynamically create a movieClip by "new" constructor.

  4. #4
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,786
    Originally posted by ericlin
    It seems that, we can not dynamically create a movieClip by "new" constructor.
    myMovieClip = new MovieClip(); // I don't get what you're saying...

  5. #5
    Senior Member
    Join Date
    May 2001
    Posts
    1,837
    I mean, we can not create a new movieClip by "new":

    myMovieClip = new MovieClip();

    trace(myMovieClip._x);
    trace(myMovieClip._name);
    myMovieClip.attachMovie("someId","clip1",2);
    myMovieClip.loadMovie("someSwf");

    None of those codes that a movieClip can implement will work.

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