0 Replies Latest reply on Aug 4, 2006 7:55 AM by Metzen2K

    Do I need a preloader for this?

    Metzen2K
      Hi,

      I have this function:
      ---------------------------------
      var font_mc:MovieClip = this.createEmptyMovieClip("font", 1);
      font_mc.loadMovie("fonts/myFont.swf");

      myButton.onRelease = function() {
      var txt_mc:TextField = font_mc.createTextField("txt", 1, 0, 0, 150, 20);
      txt_mc.embedFonts = true;
      txt_mc.text = "testing";

      var my_fmt:TextFormat = new TextFormat();
      my_fmt.font = "myFont";
      txt_mc.setTextFormat(my_fmt);
      };
      ---------------------------------

      But I don't want the user to have to click a button to add the text field, I just want it to happen when the .swf loads.

      But if I change it to:
      ---------------------------------
      fuction addMyTextField(){
      ...
      ...
      }
      addMyTextField();
      ---------------------------------

      It doesn't work. Is it because waiting for the button to appear and click it gives everything time to load and I need to use a preloader? Or is there another way to trigger it when the .swf is done loading?

      Thanks,
      Brian