Attaching custom movie clip to root

Hello

Ive just began work with FlashDevelop and im trying to take a little (lot) more object oriented approach than before :slight_smile:
So ive created a class which extends MovieClip to try and show it in main class.

This is my code for the MC:

class ui.UIPanel extends MovieClip
{
 var mainStopwatch:TextField;
 
 public function UIPanel() 
 {
  initElements();
 }
 
 private function initElements():Void {
  mainStopwatch = this.createTextField("mainStopwatch", this.getNextHighestDepth(), 50, 50, 100, 50);
  mainStopwatch.text = "test";
 }
 
}

And the main class:


import ui.UIPanel;

class Main 
{
 public static function main(swfRoot:MovieClip):Void 
 {
  var userInterface:UIPanel = new UIPanel();
  
  _root.attachMovie("userInterface", "UI_mc");
  
 
  trace(userInterface);
 }
 
 public function Main() 
 {
  
 }
 
}

So basically im asking how you do something like this since the above code doesnt work. And i would also appreciate any advice you have on this matter :slight_smile: