Skip to main content
Inspiring
January 14, 2009
Answered

Basic Custom class

  • January 14, 2009
  • 1 reply
  • 373 views
I have a blank FLA. with document class index.

I have an AS file name index saved in same folder. My custom package looks like this, but the movieClip does not display at runtime. I'm just trying to begin work with OOP and custom classes and I'm not sure why this isn't working for me:

package {

import flash.display.MovieClip;

public class index extends MovieClip {

public function Main () {
var D:MovieClip = new dMC();
D.x = D.y = 100;
addChild(D);
}

}
}
This topic has been closed for replies.
Correct answer iRyFlash
Thanks!

Works by changing the function as stated.

1 reply

Participating Frequently
January 14, 2009
Hi,
If you want D to show up without doing anything in your .fla, the Main() function should actualy be the contructor of index:

public function index() {}

But if you did trigger Main() in your .fla, the problem comes from you dMC class.

Also, just for the form, know that an AS3 convention suggests that all class names should begin with a capital letter (Index.as)...
iRyFlashAuthorCorrect answer
Inspiring
January 14, 2009
Thanks!

Works by changing the function as stated.