AS3 embedded fonts inside swfs loaded into application sandbox - odd behaviour - actionscript-3

I'm seeing some very mysterious font behaviour in AS3, Air App, using Flash version 11.5, compiling my fla files in Flash Pro CC 2014.
Context: Air application, shell loads swfs at runtime as 'modules', into the application domain (so they are run as if they were part of the main app, not as children inside a sandbox).
Problem: Some dynamic textfields containing embedded fonts in some of the loaded swfs are not appearing, while others are fine.
Details:
This is a new problem - fonts that were fine a few weeks ago are now misbehaving. (Same computer, same OS and Flash version)
The same font that is missing in some 'modules' (swfs) is present in others.
Some fonts from the same family work everywhere (Myriad Pro Semibold), others are missing in some places, but present in others (Myriad Pro Regular)
All the TextFields are inside movieclips that are then pulled in to the swfs at compile time using
[Embed(source="someFla.swf", symbol="libraryExportName")]
The Air 'shell' contains and successfully uses Myriad Pro Semi, Myriad Pro Regular and Arial. (Only)
Some fonts appear fine locally during test, but then disappear once the Air app is installed (Myriad Pro Regular)
Other fonts are consistently rubbish - Helvetica Neue for example, disappeared in multiple places in test as well as once installed
All the fonts are embedded as required in the individual swfs (Basic Latin set) but not exported for actionscript as the fonts are set at compile time rather than at run time.
If anyone has any insights or suggestions that would be great. My hunch is that the fonts that are embedded into multiple swfs are somehow 'clashing', but I can't unravel why I get some clashes while others are fine. I've wrangled font embedding in flash for many years and I've tried everything I can think of to overcome the usual gotchas.

Embedding fonts always leads to some problems if you compile to multiple platforms (iOS, Android, Air, EXE, Flash), and there's only 1 solution that works (at least, we haven't had any problems since we moved to this solution):
include a TextField in your project, 1 per specific non-system font that you're using (fontAwesome, WebDings, etc.; we tend to call them _webdings, _awesome, etc)
Copy all specific characters that you're using to that textfield during designtime
Hide the textfields upon boot (_webdings.visible = _awesome.visible = false)
Ignore ALL "you must include"-messages as the chars you're using will be automatically included in your swf when compiling...

Related

Is swfobject.js still needed in html5 for swf files?

I developed an online training course 5 years ago that had many swf files on many pages. This was XHTML. I needed the swfobjwct.js file, plus I needed MANY lines of code for the swf to play. I did not write this code, Dreamweaver did on insert.
So, now I'm being asked to update this training course. I have converted each html file to html5. I've noticed that I can use this one simple line of code:
embed src="swf/m02-02.swf" width="91px" height="20px"/
I don't seem to need anything else. All old code that used to be needed for this swf to play has been stripped out.
I've tested it a few places and the file works. I had a few people test it on their platform and it also works.
Is this all I need nowadays to play an swf file?
I don't want to change the remaining 200 files if for some reason this isn't correct.
Modern browsers understand <embed> -- most browsers have supported it for years, but HTML5 made it official -- and yes, you can use it to embed a SWF to your page directly without SWFObject. However, if the browser does not have Flash Player installed (and many don't nowadays), the learner will only see whatever "unable to load content" message that particular browser provides.
SWFObject provides extra features, namely detection of Flash support, enabling you to provide fallback content if Flash is not available.
Adobe Dreamweaver spit out some hairy code back in the day, so I'd recommend continuing to use SWFObject but replacing Adobe's bloated code with some cleaner code of your own. There are simple examples for SWFObject at http://learnswfobject.com/the-basics/dynamic-publishing/index.html
Regardless, if you change your code, be sure to test in all major browsers, including IE9-11.

Flash to HTML5 Loss of interactivity

I have Some sample fla Content which I am not able to convert into HTML5 with interactions
What I tried is
Google Swiffy --> Gives interactions [not full] but no sound. Issue is it works for content less than 1 MB
Toolkit for CreateJs --> Initially I got jsx errors but I cleared them by removing Special Characters in element names. But non of the case I got interactivity [Means I was not able to use my Mouse events or clicks
HTML5 Canvas in Flash Pro CC --> even here I got same above result.
Did I am missing something ??
You didn't really miss anything. Flash's HTML conversions do not convert AS3 to JS (that would be nice if it did). In this case you have to write the interaction using JS.
Sounds like you're using Google's online SWF-to-Swiffy converter, which has a 1MB limit. There's a better way, if you have Flash Pro CS5 or CS6 and the original FLA files. Try this:
download Google's swiffy generator and instal it in your Flash Pro (read instructions carefully)
open your FLAs and find the sounds that don't play in the swiffy file - most likely they are set as streaming sound (streaming audio is not supported by Swiffy), so change them to event sound
BUT, looped event sounds exported to Swiffy only play once (they don't loop), so if you need them, export the sound from the FLA (as .wav), and copy and paste it as many times as necessary in a new .wav file and re-import
All done? Now export from Flash Pro using Command -> Export as HTML5 (swiffy)
NB: Google's Swiffy extension for Flash Pro won't work with Creative Cloud, and on mobiles there'll be NO AUDIO whatever you do - sound only seems to work on desktop PCs, owing to mobile restrictions on unsolicited big-file preloads.

Flash game loads assets locally but not in browser

I'm creating a flash game that includes two characters. One that is dynamically loaded from a url and the other that's already present on stage. Both characters load up just fine when testing within flash professional but when testing on a browser or opening the swf file itself, neither character loads.
I've already set my playback security settings to "network access only" as suggested in this question: Flash not working in browser but works fine on computer and it still isn't working.
Both images are strips that show the complete character's animation in one picture itself and through the use of masks and code, I'm able to depict each frame of animation.
Here's the file itself if you need to check it out for yourself.
swf file here

Getting trouble with publishing in HTML5 through Flash & actionsript 3.0

Hi there...
I am having a query about how to publish in HTML5 format through flash.
I have a .fla file containg animation and Actionscript 3.0, when i publish it to HTML, it ask to download flash player in browser. But it is not necessary to have flash player in the browser while loading the .html file. So plaease guide me for the issue.
Thanks in Advance..
You're misunderstanding what the menu means by publish to HTML. This is simply publishing a SWF file and a corresponding HTML file that has HTML code to embed the SWF. This is not a cross compilation option. Those exist but that's not what you get in Flash CS5 by default.
If you're interested in Cross Compilation from AS3 to HTML/JS you can check out Randori and also projects like FalconJS:
http://blogs.adobe.com/bparadie/2011/11/19/what-is-falconjs/
I saw a talk about both of these recently in Chicago by some of the developers. They both seem like promising concepts (basically dodging the flash player).
The other option if you're trying to develop for mobile deployment is to package your code as an air installer. This will run your code on top of the AIR runtime (which has support on tons of devices, iOS, Android, Blackberry etc.), but this is not an in the browser experience, but rather a download the app type deal.
From what I got from the two developers (one from Apache Flex, one the creator of Randori) neither wanted to put too much trust into Adobe's platform given it's no longer supported on most mobile devices.
As an aside Adobe also has a product called Edge that allows you to do animation with a similar tool-set to what you get in Flash and exports HTML/JS/CSS. If you're not interested in AS3 or object oriented programming or type-safe languages cross compiling might not be the best option. I've personally been playing with AngularJS lately and been liking it due to the parallels with Flex, but there's a lot of great scripts/libraries/frameworks out there, if you explain a bit more of what you're trying to accomplish I can give more directed guidance.

jQuery Mobile video website, convert to PhoneGap app with videos on SD card instead of streamed

I have a jQuery Mobile website I created for a friend/client of mine. It only has 6 pages or so (2 of them are dialog windows). The site has HTML5 video with fallback for flash support via the videojs library. All videos are encoded properly in mp4, ogv (theora), and webm and so far play on every device I have used.
My problem lies bandwidth, the purpose of the program really needs to be an application because these are informational videos that may need to be viewed at any time, even with no web access (web access is required for first login to verify credentials).
I was left with 3 solutions, try writing native apps for all the platforms myself in their native languages, use Sencha Touch (which I am comfortable enough with extJS to do), or taking my existing jquery mobile app that is 100% functional including log-in and some backend package management to assign users a package of videos (there are multiple packages each with between 8-20 videos), and follow the jQuery Mobile tutorial for getting your app ready for PhoneGap, I believe its only enabling two settings, and both are to enable "cross-domain" requests, since my current web app would be running as localhost, it would see the scripts as external pages.
My main question/problem is for one, I have never used PhoneGap; aside from their Hello World android tutorial, and I know there are other all-in-one frameworks out there now: PhoneGap, Titanium, Corona, Adobe Flex (which I am installing while writing this tutorial, to see what it has to offer. If it has features like encoding videos automatically for the target device (video resolution changing), or even has local video playback features at all that may work.
Does anyone know which of the current frameworks have the ability to install a set of videos to the sdcard, (totaling around 6mb per install), and play them natively (by that i mean, in the devices native player, not inline inside of a webview). Which on android phones anyways, my current videojs based player plays the files natively in everything I have tried it on.
I just need a push in the right direction, if there is a PhoneGap plugin that I don't know about that allows videos to be played from the sd card, that would be terrific. Although I am not very happy with the speed of the android and blackberry webview controls. So something that uses 100% native controls would be great. I hope you guys can come up with some ideas, you can see the current app in action at m.yourvideobenefits.com email:abc#tool.com password: demo
You should view it from your phone if you want to see it properly, but if you do not have a smart phone; keep in mind that when viewing this page certain desktop browsers, the videos become their actual size after they are through loading. This is because i have autoload="true" in the video tag (which is ignored on most phones, but believe it or not, setting autoload="true" is what actually allowed the videos to not play inline on certain devices. A bug on the device, I am sure...but without this tag the videos played inline on iPhone 4 with the latest iOS version.
You could do it very easily with phonegap; you already have your web page, so it would be much less work, probably.
You could get the videos from inside your apps bundle in ios, and then it wouldn't be hard to select the one with the best resolution for the device being used. You could also download the videos at the perfect format and resolution the first time your app plays from your server using the file api. That convined with the storage api is nice for actualizations.
There's a plugin I use for android, because video tag is sometimes bugged or doesn't work at all in older versions, https://github.com/phonegap/phonegap-plugins/tree/master/Android/VideoPlayer.
It only plays from web or sdcard, but that's rarely too bad.
I can't help you with black berry, but I'm pretty sure there must be a way of doing it. And, anyway, appcelerator doesn't support it yet, so you would probably had to do it natively. Even if there isn't a plugin for black berry, you'd probably have to chose between native developement and html5 player inside phonegap. I won't give you my opinion about it here, for I'm not the one to give it and Stack Overflow says I shouln'd give it anyway.