2 Replies Latest reply on Mar 8, 2010 10:40 PM by natanr123

    dynamic font loading form diffent domain The value specified for argument font is invalid

    natanr123

      Hi

       

      I am trying to dyanmiclly load domain from external swf

      First I Embed the font in an SWF called "FontsSWFList.swf"

       

       

      [Embed(source='Assets/fonts/ARIAL.TTF' , fontFamily='Arial Font' , embedAsCFF="true")]

       

      public static var ArialFont:Class;

       

       

      and then I load the SWF in another "main.swf"

      and then get the font Class

      like this:

       

      loader.addEventListener(Event.COMPLETE,OnFinishedLoadingSWF);

      loader.load('http://www.natansites.com/FontsSWFList.swf' );

       

       

      public function OnFinishedLoadingSWF(event:Event):void

      {

       

      var FontLibrary1:Class = this.loader.content.loaderInfo.applicationDomain.getDefinition("FontsSWFList_ArialFont") as Class;

       

      Font.registerFont(FontLibrary1);

       

      }

       

      If the FontsSWFList.swf is found on the same domain as main.swf (using reletive path) then everything is OK. But when they are on diffrent domains

      I get an error:

      "The value specified for argument font is invalid"

       

      There is some disscussion about that here:

      http://www.actionscript.org/forums/showthread.php3?t=182499

       

      But the solotion seems too complicated and it didn't work for me in FLEX 4 and FTE

       

      Please help me