Loading external swf fonts created with fontswf, loaded with a Loader, compatible with iOS
Let me immediately start out by saying that I do in fact have a current working solution for using embedded fonts, generated by fontswf and working in an AIR ActionScript mobile application, and also currently working fine with iOS.
My current app needs CFF fonts, so I currently use the fontswf tool to pre-generate the .swfs using:
fontswf -4 -a [SomeAlias] -o [SomeFont.swf] [SomeFont.ttf]
and then I am currently embedding them in my app source code .as for compilation using:
[Embed(source="/swf/SomeFont.swf", symbol="SomeAlias")]
public static var SomeFontClass:Class;
I then have no problem registering them using Font.registerFont(SomeFontClass) and everything works fine.
However, I would prefer to take the use of these swf fonts one step further and load them dynamically using a Loader so that I do not have to take the hit of having multiple CFF font swfs embedded in the main compiled SWF and so that I could even load an unknown future set of fonts without having to supply them as part of the app build.
Now I have seen and read many blogs and tutorials where people have exported font swf from Flash Builder where you add an explicit 'Class' name or even made standalone .as static files compiled into standalone swfs only including the two lines:
[Embed(source="/swf/SomeFont.swf", symbol="SomeAlias")]
public static var SomeFontClass:Class;
so that you also have a 'Class' involved. Then people use some form of appropriate applicationDomain.getDefinition("className") as Class
to pull out the class for the font registration.
My question is, how does one perform the same font loading and registration of fonts using a Loader only loading the .swfs produced directly from fontswf?
It seems only a DefineFont4 is tagged in the swf, there doesn't seem to be a 'Class' per se to call on.
More importantly, iOS apps cannot load external swfs with code in them, so my understanding is any extra wrapped swf that would contain a custom Class technique would fail the iOS requirement of only having one main SWF with any ActionScript compiled code.
Is there an alternative to the 'Class' technique by grabbing the DefineFont4 tagged resource from the swf and instantiating a proper working Font class from that? One that would still be compatible with the restrictions placed on AIR mobile apps running on iOS?
Ironically, just after posting this, Adobe released AIR 3.5 beta onto labs, and added multiple SWF support for iOS.
While this new support makes it easier to manage your content across multiple SWFs and technically allows you to use the class based separate .swfs for each font if desired, the system still requires that all these SWFs be present at compile time when making the final app .ipa for iOS.
So this still doesn't solve trying to load fonts after the app is already built. For example, as part of a downloaded in-app purchase mechanism.
Similar Messages
-
Trouble loading an external swf file implemented with AS3
I am using Adobe Flash CS3
At first, I tried
swf_mc.loadMovie("//swf file
location");
It gave me
quote:
Warning: 1060: Migration issue: The method loadMovie is no
longer supported.
USE: var l = new Loader(); addChild(l); l.load(new
URLRequest("your url"));.
Well, the given code isn't working at all.
But since it is a migration error, I thought maybe I can just
save it into Flash5 format with AS1. Then it worked with most
external swf files. However, the one I am trying to load is a swf
file with AS3, so my older version swf can't load it at all.
Anyone has any ideas about how to load an external AS3 swf
file?AS3 is a completely different beast than AS1 or 2. loadMovie
was removed from the language.
The answer to your question is two fold. First, Adobe was
kind enough to give us the code when it finds a migration issue.
var _ldr:Loader = new Loader();
addChild( _ldr );
_ldr.load( new URLRequest( "your url") );
Handling progress has also changed. I have a ContentLoader
package on my site that you're free to use that should familiarize
you with the new way that things are done in AS3.
http://sd-dezign.com/blog/?page_id=10 -
External swf Font.enumerateFonts()
Hello,
I'm coding a FontRegister class that register fonts from an
external library.swf.
Instead of writing 'manually' all the font class names as
strings ("MyFont1","MyFont2",...) to be registered via
getDefinition(), I wanted the script to automatically list and
register all the fonts in the loaded swf.
Font.enumerateFonts() only works on the current
ApplicationDomain.... How do I check enumerateFonts in library.swf
when loading is complete?
Thanks in advance,
TYou need to load the library into a new LoaderContext in your
ApplicationDomain or access the loaders domain directly:
_loader.contentLoaderInfo.applicationDomain.getDefinition("com.domain.MyClass");
There is a tutorial in CS3 about it. -
Can we resize swf file created with AIR API in AIR application?
Hi,
I created a .swf file with AIR API.
I want to open and resize it in AIR application. This .swf file taking dimensions as default in which it opens.
I want to change its width and height.
Is there any way to change its dimensions?
Please suggest me the solution.
thank youLoading a Flex WindowedApplication into another is not supported. However,
you might be able to access the WindowedApplication and size it. Sub-Apps
in AIR should be based on Application, not WindowedApplication. -
PrintJob unable to print my external swf which created from a pdf.
Hi Everybody,
We developed a tool which split pdf's uploaded by user into single page and convert each single page into swf. We used swftools to convert pdf to swf.
after converting swf files we show each swf as a single page to user, where user can add more colors, clip arts, text, images to it and later we can take print out, for testing we will print the final output as pdf.
Most of the times everything is working fine, but when pdf page have many layers, we are able to convert into swf successfully, but while printing some layers (mainly images) are missing in final print. We tried converting pdf to AVM1 swf and AVM2 swf files, in both cases the result is same. Did anybody have idea about this issue?
Regards
VikramHi Karthik,
Please check below
You can view Log files on 14 hive folder <System Root>:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS . Use the ULS Logviewer tool to eficiently view the Log files http://ulsviewer.codeplex.com/.
Search for Log file with the viewer or check the latest file with time provided by Error page. That will show exact issues.
or
BCS supports null columns, but make sure the column is set to IsNullable in the db schema.
Please remember to click 'Mark as Answer' on the answer if it helps you -
Missing data in SWF files created with Batch Utility SP1
Hi All and happy new year !
I have a problem using Xcelsius 2008 batch Utility SP1. On the new SWF file, some of my data are missing. I used a grid component to identify the problem and there are no data where it should have some.
Is there a table size or data range limit?
Or another solution for my problem?
Regards,
E. OLIMEProbably, this Note will be useful: 1394826 - Xcelsius Batch Utility: Data can not be changed when the original data cell is blank
-
External SWF controlling main timeline
Hi all --
I have a main SWF file that I am loading a smaller, external
SWF file into (with loadMovie, if you care to know). Within that
smaller file, I have a button -- ideally, this button should
trigger an action within the main SWF file.
My problem is that I cannot get the external SWF file to
control an action within the main SWF. I'm guessing there must be a
way to do this, but I'm having some trouble here.
Thanks in advance... please advise!Well.... there may be a reason if it is set up correctly and
still doesn't work....
Is this external SWF hosted on another server?
If so, you might be running into crossdomain policy problems.
I've had the issue that remotely-hosted SWFs will not OBEY commands
from the root timeline while they are remote, but work just fine
when they are copied onto the same server as the main SWF.
Do a search on crossdomain policy XML in Flash help. It may
help you get around this problem. -
External swf question...
Hey all
I found this code for loading external swfs and playing them in succession.
It works when I use the external swfs that come with the code, but not when I try to use any other external swfs.
I can't figure out why - does anything seem obvious (the clip swfs are here http://www.flashandmath.com/intermediate/externalclips/clip0.swf http://www.flashandmath.com/intermediate/externalclips/clip1.swf http://www.flashandmath.com/intermediate/externalclips/clip2.swf ):
// Array of external clips to use. Variable index refers to next clip to be displayed.
var clips:Array = ["clip0.swf", "clip1.swf", "clip2.swf"];
var index:int = 0;
// Stuff to load swf files
var thisLoader:Loader = new Loader();
thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
//loader.contentLoaderInfo.addEventListener(Event.COMPLETE, dataOnLoad);
var thisMC:MovieClip = new MovieClip();
stage.addChild(thisMC); // Add empty MC initially so the nextClip function can be generic
// Removes old MC and gets the next one, waiting until when it has initialized beore adding it to the stage
function nextClip():void {
thisLoader.load(new URLRequest(clips[index]));
// Tell AS that the loaded file is a movie clip and add it to the stage.
function doneLoading(e:Event):void {
stage.removeChild(thisMC);
thisMC = MovieClip(thisLoader.content);
thisLoader.unload();
thisMC.addEventListener(Event.ENTER_FRAME, runOnce);
stage.addChild(thisMC);
thisMC.gotoAndPlay(1);
// When thisMC has finished, play the next clip.
function runOnce(e:Event):void {
if (thisMC.currentFrame == thisMC.totalFrames) {
thisMC.removeEventListener(Event.ENTER_FRAME, runOnce);
index = (index + 1)%(clips.length);
nextClip();
// Call the nextClip function initially to get the ball rolling
nextClip();
Thanks for taking a look guys.
ShaunOne of the swfs returns:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::AVM1Movie@26f9b3a1 to flash.display.MovieClip.
at alt2_fla::MainTimeline/doneLoading()
(I'm pretty sure it's an AS3 swf)
The other, which I had just built using AS3, returns:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.rsl::RSLPreloader/loadContent()
at _001_fla::MainTimeline__Preloader__/frame2()
Error: Error #2099: The loading object is not sufficiently loaded to provide this information.
at flash.display::LoaderInfo/get width()
at loader_animation_fla::MainTimeline/frame1()
Error: Error #2099: The loading object is not sufficiently loaded to provide this information.
at flash.display::LoaderInfo/get width()
at loader_animation_fla::MainTimeline/frame1()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.rsl::RSLPreloader/loadContent()
at _001_fla::MainTimeline__Preloader__/frame2() -
Making link to external swf stop
Using flash 8. Inserted a link to a 2:15 second swf on the internet (get URL xxx.swf) at the beginning of my fla file, it plays fine but when the swf is over, how can I make it go away, in order to continue on with my presentation?
This is an onstage presentation so there are no buttons available, just
letting it play through. Doesn't sound favorable. Thanks very much for
your help.
From:
Ned Murphy <[email protected]>
To:
rwcorgis <[email protected]>
Date:
07/16/2012 11:22 AM
Subject:
making link to external swf stop
Re: making link to external swf stop
created by Ned Murphy in ActionScript 1 and 2 - View the full discussion
If you have no control over that external swf there probably is not much
you can do outside of opening it in a separate browser window so that the
window can be closed and your original page is still showing in its
browser window..
Replies to this message go to everyone subscribed to this thread, not
directly to the person who posted the message. To post a reply, either
reply to this email or visit the message page: [
http://forums.adobe.com/message/4560470#4560470]
To unsubscribe from this thread, please visit the message page at [
http://forums.adobe.com/message/4560470#4560470]. In the Actions box on
the right, click the Stop Email Notifications link.
Start a new discussion in ActionScript 1 and 2 by email or at Adobe Forums
For more information about maintaining your forum email notifications
please go to http://forums.adobe.com/message/2936746#2936746.
STATEMENT OF CONFIDENTIALITY
The information contained in this email message and any attachments may be confidential and legally privileged and is intended for the use of the addressee(s) only. If you are not an intended recipient, please: (1) notify me immediately by replying to this message; (2) do not use, disseminate, distribute or reproduce any part of the message or any attachment; and (3) destroy all copies of this message and any attachments. -
Fontographer PS fonts issue with Yosemite
I have created a number of PS fonts (.otf) with Fontagrapher 5. They have been working flawlessly ever since on my MacBook Air (mid 2012) 8GB RAM and 512GB SSD.
Since moving yesterday from Mavericks to Mac OS X Yosemite, things are terrible. All fonts created with Fontographer are not displaying and printing correctly …. my 6 indian music books and numerous documents in hindi/english diacritical are thus unusable. I tried with Nisus Writer Pro, Text Edit and Mellel to no avail.
Checking with the Apple software FontBook, it says all my Fontographer Fonts are « usable » (green ok check) and that there is no conflict/problem. To be sure, I removed all factory fonts which could potentially make problems (orange warning), rebooted the Mac but, despite that, nothing works properly. Fonts are incredibly SCRETCHED on display (space between characters is huge) and some of them don't print as they are displayed. I also naturally updated the printer (Xerox Work Center 6605 DN) driver to the latest Yosemite compatible version (oct.16, 2014) but that doesn't change anything. I also tried different ways of making pdf from the different word processors but the same thing occured on pdf.
Please, kindly check and inquire about this important issue with Apple fonts experts. Number of us, using Fontographer Fonts, must be facing the same incompatibility with Yosemite.
Please do let me know what I can do to solve the problem. I don't even know how I can downgrade to Maverick yet.
Thanking you in advance for a quick reply
Patrick MOUTALWell, Kurt Lang did solve my problem and I won't ever be enough thankful to him. He tried one of my font and took the time to examine it with FontLab Studio. In case other persons experiment the same type of troubles, I am pasting the mail I got (along with the corrected font) for info :
Hi Patrick,
I did find one issue in particular. OpenType fonts should have a UTM setting of 1000. These were at 2048. So I changed those and had FontLab Studio rebuild the names (I just let it do its thing).
The originals you had sent wouldn’t even appear in Office 2011. The rebuilt ones do, though for whatever reason, bold italic won’t show. However, you can click the italic and bold buttons and the correct font is used. Otherwise, the new fonts all work as expected in Photoshop, Illustrator, InDesign, TextEdit and others. I tested them in both Mavericks and Yosemite.
Can’t guarantee success, but give these a shot.
Kurt
That guy is an angel. He spent a tremendous amount of time examining, testing on Mavericks and Yosemite and on several apps until resolving the problem. Too helpful, too nice and too competent. That's a treat. -
Loading font from external *.swf
So!
I have 3 movies.
1)Main movie - index.swf
2)Movie with created & checked in linkadge "Export for
runtime sharing" fonts in library - fonts.swf
3)movie with text fields which need embeded fonts to work in
a proper way. Fonts in the library checked in linkage as "import
for runtime sharing" - content.swf
What happens:
I strike CTRL+ENTER and run movie index.swf.
on the (for ex.) 10 frame it loads fonts.swf with
movieClipLoader class..
then in the same way on (for ex.) 100 frame, i load content
swf
BUT!!! before it starts loading process IT DOWNLOADS FONT.swf
again
SO HOW DO I PRELOAD fonts from external *.swf..
maybe there is yhe way without using runtime sharing..
but i've heard that loaded whith movieClipLoader movies don't
adds objects from their library to main movie liblary...
HOW DO I SOLVE THIS PROBLEM!can you give your erroe source code,and then i will give you the success code.
in the function
private function onLoadComplete(e:Event):void {}
ApplicationDomain.currentDomain.getDefinition("com.scottgmorgan.ExternalMovie") ;
use like this:
var EMClass:Class=loader.contentLoaderInfo.applicationDomain.getDefinition("com.scottgmorgan.ExternalMovie") ;
then you can new a instance :
var emInstance:Object=new EMClass();
emInstance.alert("hello word");
and we also can use other method. so email me [email protected] -
Loading an external swf with a loader
I have a .swf that loads different external swf's into
loaders based on what frame it is in. For all but one frame this
works fine. There's no lag, they load quickly and can be interacted
with with no problem. But, for one .swf it gets really choppy. The
swf itself runs fine but once it is loaded into another swf through
the loader the performance really goes down the drain. I guess I am
wondering if anyone has any suggestions or perhaps different
methods I should try. Thanks in advance.It isn't creating it on the fly.
Insert a new symbol and give it the instance name
placeholder_mc. Drag that onto your timeline and scale it so that
it is the exact same size as your external swf. Then just align the
empty movie clip on the stage where you want to align the external
swf.
loadMovie("external.swf",_root.placeholder_mc);
This just tells it "Okay, take this external flash file, and
stick it INTO that empty movieclip" -
Loaded external SWF gets blurry fonts/bitmaps
Hi all
When i load an external swf file it looses quality and
renders blurry. But the swf itself (the external one) looks
perfectly fine standalone. Now i ask myself, is this really a
flashbug or what the heck is it?
Because i wrote an elearning player wich references hundreds
of this files, its not very funny to see the quality dropping. To
get some meat for you, i created a small site, wich should make the
problem much clearer:
Click here and
explore the strange bug
If anybody has some useful information about it, i am more
than glad to hear it!
tks for all the fish and goodbye
rogerHow was the swf generated? If you were using Camtasia Studio,
there are
issues with using Flash 8 player.
Lon Hosford
www.lonhosford.com
Flash, Actionscript and Flash Media Server examples:
http://flashexamples.hosfordusa.com
May many happy bits flow your way!
"StevenMcQueen" <[email protected]> wrote in
message
news:e5mu9e$dmd$[email protected]..
Hi all
When i load an external swf file it looses quality and
renders blurry. But
the
swf itself (the external one) looks perfectly fine
standalone. Now i ask
myself, is this really a flashbug or what the heck is it?
Because i wrote an elearning player wich refences hundert of
this files,
its
not very funny to see the quality dropping. To get some meat
for you, i
created a small site, wich should make the problem much
clearer:
<a target=_blank class=ftalternatingbarlinklarge
href="
http://lux.to/tests/ppt2swf/index.html">Click
here and explore the
strange bug</a>
If anybody has some useful information about it, i am more
than glad to
hear
it!
tks for all the fish and goodbye
roger -
Loading external SWF with masked content - get size of masked area
I am loading an external swf using the SWFLoader component. The swf that is being loaded is masked so that only a portion is being shown. However, when it's loaded the actual size of the swf (loader.content.width && loader.content.height) is the complete swf including the masked area. Therefore, the loaded swf does not display properly in the itemrenderer Is there a way to to grab the size of the just the masked area as opposed to getting the size of the entire swf's contents (area not masked)?
One item to note that is complicating the issue, is that these are swf files that have already been created and there are many of them. In some instances, the size of the stage matches up with the size of the masked area. In other instances, the stage is larger (or possibly smaller) than the masked area movieclip as well as possibly the actual size of the movieclip (w/o the mask).
I am currently loading the external swf in using a Loader. Once loaded, I make a copy (screen shot) of the swf by creating a bmp of the loader.content.This is done as I don't want to have any animations being shown on screen at this moment. I am setting the size of the bmp using using loader.content.width & loader.content.height. I then set the SWFLoader.source to the bitmap.Here's the code I am using to load the swf:
<fx:Script>
<![CDATA[
protected function application1_applicationCompleteHandler(event:FlexEvent):void {
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSWFLoaded);
loader.load(new URLRequest("c:\\Flex Testing\\FA warns Mr. Jones.swf"), context);
private function onSWFLoaded(event:Event):void {
bmData=new BitmapData(loader.content.width, loader.content.height, true, 0x990000);
bmData.draw(loader.content, new Matrix());
bmp=new Bitmap(bmData);
swfLoader.source=bmp;
addElement(swfLoader);
with (swfLoader)
setStyle('verticalAlign', "middle");
setStyle('horizontalAlign', 'center');
verticalCenter=0;
horizontalCenter=0
scaleContent=true;
maintainAspectRatio=true;
addEventListener(MouseEvent.CLICK,onClick,false,0,true)
useHandCursor = true;
buttonMode = true;
width=200;
height=200;
loader.unload()
loader=null;
]]>
</fx:Script> -
Problem with Error 5005 and with external SWF loading
I am creating a relatively simple 10-12 minute animation. I've broken the animation into 34 different movie clips that I control on the timeline by using a timer delay.
When I try to export them all together I get the error:
",Line 1: Error 5005: Unknown Error optimizing byte code."
However, when I split the presentation into two halves with the same exact frames and code I don't have the problem.
I thought loading an external SWF at the end of the first movie would be a good way to connect everything. However, the SWF continuously loads and won't play through the way it looks when you open the actual SWF file.
This is my code for the external loading:
var xpos:Number = 0;
var ypos:Number = 0;
var swf:MovieClip;
var myLoader:Loader = new Loader();// create a new instance of the Loader class
var url:URLRequest = new URLRequest("aamc-2e-slide1.swf");// in this case both SWFs are in the same folder
myLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);
myLoader.load(url);
function doneLoading(evt:Event):void
trace("doneloading");
swf = MovieClip(myLoader.content);
stage.addChild(swf);
swf.stop();I have the same/similar issue whether the stop is there or not.
Yes, it is all on one frame.
Without the stop, the SWF just continously loops on top of itself.
Maybe you are looking for
-
My new ipod shuffle (4th gen) is not recognized by my PC or itunes :(
just bought a new 4th generation ipod shuffle....downloaded itunes...but its not recognizing the ipod shuffle ("devices" not appearing on left column).....also, my computer (windows 7) is not recognizing it when connected... ive tried re-installing i
-
Can't boot anything after deleting C partition in order to install Windows 8.1
I have a ASUS X55VD notebook, wich had a Windows 7 64-bit (and a dual booted Ubuntu, but with Windows bootloader). Yesterday I tried to install a Windows 8.1, so I inserted a disc and restarted. The window to manually select the partition, on wich it
-
Cant get adobe air update off my computer, i stopped the download and now it won't go away
Help me get adobe air download off my computer. I stopped it and don't want it to download...prompt on my screen will not go away
-
SQL syntax error when creating record insertion form
Good day, I was hoping someone could help me. I am trying to create a record insertion form on a website to insert data into a database table. When attempting to create the form, I am getting the following error: You have an error in your SQL synt
-
Hi, I am using Oracle R12 Accounts Payable Manager. Currently when a payment is made to our suppliers a remittance file is produced in PDF format. I would still like to have this but at the same time I would really like to be able to set up e-mail