-
1. Re: Embed Font and change textField font in different swf
eprevot123 Apr 4, 2011 7:06 AM (in response to eprevot123)My application is like this :
View1 contains View 2 (or View 2b depending on the state)
View 2 loads the swfs that contain movieClips. View 2 contains View 3 (or View3b depending on the state)
View 3 contains View 4.
View 4 embed the font, instanciate movieclips from the loaded swfs, and change the font and text of the textfield in the movieClips.
Should I embed and register the font in each view ? or is it ok to do it only on View4 ?
-
2. Re: Embed Font and change textField font in different swf
eprevot123 Apr 4, 2011 9:40 AM (in response to eprevot123)I just see the difference between my test project and my real application :
- In my test project I have one swf containing a MovieClip in the source package. I load the swf from the local package, and then I can use an embedded font.
- but in my real application, MovieClip swfs are in an other directory in my machine. When I load them from that directory, I can't use embedded font in them.
Do you know what I miss to be able to use embedded font in the loaded swf ?
I thought Font.registerFont(myEmbeddedFont) was enough to allow the loaded swf to use myEmbeddedFont...
-
3. Re: Embed Font and change textField font in different swf
Flex harUI Apr 4, 2011 10:07 AM (in response to eprevot123)If the sub-swfs are being loaded into different security sandboxes, then
maybe registerFont won't work. Otherwise, it should.
-
4. Re: Embed Font and change textField font in different swf
eprevot123 Apr 5, 2011 12:47 AM (in response to Flex harUI)I load the same way for the 2 projects, the only difference is the location of the swf I load. I don't know much about securityDomain...
I load that way :
var url:URLRequest = new URLRequest("myMovieClip.swf"); //can embed font in this case
or
var url:URLRequest = new URLRequest("file:///the/path/to/file/myMovieClip.swf"); //can't embed font in this case
var loaderCtx:LoaderContext = new LoaderContext(false);
loader.load(url,loaderCtx); -
5. Re: Embed Font and change textField font in different swf
eprevot123 Apr 5, 2011 2:32 AM (in response to eprevot123)I made some tests, if I use the URLRequest with :
file:///path/to/my/project/sources/myMovieClip.swf --> it works
../../../path/to/my/desktop/myMovieClip.swf --> it does not works
so it does not come from the use of "file://" or a relative path. The font that I registered in my main application can be used in the swf that are in the same location than my application. But I can't use that font if the swf is out of my project (on my desktop or another directory).
I may add that it is an Air application.
As a workaround I could copy all the swf in my project but the problem is that those swfs are used by several projects and I don't want to duplicate all the swfs in each project... So I need another solution.
-
6. Re: Embed Font and change textField font in different swf
Flex harUI Apr 5, 2011 11:07 AM (in response to eprevot123)AIR apps place all SWFs from outside the application-directory in security
sandboxes.
You can try loading the SWF as a bytearray and using loadBytes
-
7. Re: Embed Font and change textField font in different swf
eprevot123 Apr 5, 2011 1:56 PM (in response to Flex harUI)I tried the same code in a Flex application and the result is the same so it's not specific to Air app...
I tried to load the swf in the same security sandbox using :
new LoaderContext(false, null, SecurityDomain.currentDomain);
but it ends in a runtime SecurityError: Error #2142
I don't know how to load the swf in the same sandox then.
I'll try the loadBytes method.



