# ApplicationDomain problems

**URL:** <https://forum.kirupa.com/t/applicationdomain-problems/255291>\
**Category:** flash\
**Created:** [March 20, 2008, 8:13pm UTC](https://forum.kirupa.com/t/applicationdomain-problems/255291 "2008-03-20T20:13:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flash\_grenade](https://avatars.discourse-cdn.com/v4/letter/f/f19dbf/32.png) [@flash\_grenade](https://forum.kirupa.com/u/flash_grenade)\
**Post date:** [March 20, 2008, 8:13pm UTC](https://forum.kirupa.com/t/applicationdomain-problems/255291/1 "2008-03-20T20:13:24Z")

</div>

[SIZE=2]I have some fonts stored in SWF’s that load at startup and then are registered with registerFont. It works perfectly well, unless the application that is doing the loading is itself loaded by another application using SWFLoader into a seperate ApplicationDomain. Then registerFont stops working. Has anybody encountered this and knows what the problem is. [/SIZE]

[SIZE=2]Here’s the code (actually part of a test program to isolate the problem):[/SIZE]

```auto
 
private function InitApp():void { 
  var ldr:Loader= new Loader();
  ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, regfont);
  ldr.load(new URLRequest("Bogusflow.swf"));
}
 
private function regfont(event:Event):void {
  var Bogusflow:Class = Class(LoaderInfo(event.target).applicationDomain.getDefinition
    ("Bogusflow"));
  Font.registerFont(Bogusflow.wrFont); 
}

```

[SIZE=2](Works fine unless the SWF containing the above is itself loaded via SWFLoader into a seperate ApplicationDomain.)[/SIZE]

[SIZE=2]Here is the font file:[/SIZE]

```auto
 
package {
  import flash.display.Sprite;
  public class Bogusflow extends Sprite {
    [Embed(systemFont='Bogusflow', fontName='Bogusflow', fontStyle='normal',
      fontWeight='normal',
    mimeType='application/x-font')]
    public static var wrFont:Class;
  }
}

```

[SIZE=2]And the code that loads the application:[/SIZE]

```auto
 
private function InitApp():void {
 
  var swf:SWFLoader = new SWFLoader();
 
  swf.scaleContent = false;
 
 
  //comment this out and the problem goes away:
  //(it needs to stay in though)
  swf.autoLoad = false; 
  swf.loaderContext = 
  new LoaderContext(false,new ApplicationDomain(null));
  swf.trustContent = true;
  ////
 
  Application.application.addChild(swf); 
 
  swf.load("test.swf");
}

```
