ExternalInterface escapes strings using JSON conventions - actionscript-3

I'm getting hundreds of lines in my trace log per second!
WARNING: For content targeting Flash Player version 14 or higher, ExternalInterface escapes strings using JSON conventions. To maintain compatibility, content published to earlier Flash Player versions continues to use the legacy escaping behavior.
I already found a question on how to prevent this warning. However, I'm using SWC libraries for my SWF. So I don't have their source code. I need a way to suppress this warning. I don't mind turning all warnings/errors off for this SWF. Is there a way to stop it?

Try add debug=false to compiler options.

Related

Have Adobe changed Flash's ExternalInterface marshalling?

I have an application written in ActionScript 3 which has to run on all versions of the Flash runtime, including the latest - Flash 18.
One section of my code passes a rather complex object (actually a tree of objects) from AS3 to JS via ExternalInterface.call(). The object has internal cyclic references, and it always used to work, up to and including Flash version 17.
In Flash 18 this object no longer gets passed, there is a very long pause, and a stack overflow is thrown. Upon further inspection (with the debugger and FlashBuilder) I find that the pause is in a toJSON method getting called recursively (obviously not correctly handling the cycles in my object).
The documentation for ExternalInterface states that marshalling is done using XML and in the past I've had problems when I've tried to marshal data that can't be represented easily in XML but would work in JSON, I now appear to be having the opposite issue, and this is quite a backward step if cyclic references in existing compiled applications will now break.
Has anyone else seen this issue?
Do we know if this is intentional, permanent, and/or documented? It doesn't appear in the release notes for Flash 18, so far as I can see.

WebRTC on cef3 with brackets-shell for windows application (HTML5)

I need to use the navigator.getUserMedia() function to use the webcam to take pictures on a windows application made with HTML5, and compiled on brackets-shell w/ cef3 (version 3.2171.1902).
Is this possible, or cef3 does not support webrtc at all?
I read online something about passing CEF command line arguments (--enable-media-stream) but I don't know where to put those commands...
Update:
I tried using nwjs instead of brackets-shell and it worked without any trouble.
http://nwjs.io/
There are two overrides available that allow you to manipulate the command lines of the child processes, they are CefBrowserProcessHandler::OnBeforeChildProcessLaunch and CefApp::OnBeforeCommandLineProcessing
There is a nice short discussion here: "How to pass additional command line arguments to subprocess".
We use OnBeforeCommandLineProcessing to set command line options that could have been set on the args in main(), but weren't. We use OnBeforeChildProcessLaunch to set arguments for child processes, such as command line arguments we did get in the arglist that we want propagated to our child processes. One of these should do what you want.

Unify the size of swf

When I compile the same project with ant many times it gives a different sizes for each compilation
I added the rsl and more option to mxml it works fine ,but the size is still changed
Please any idea to unify the size
This is not really possible, unless you do some, quite involved post-processing. Below is the list of things I know to change the size between compiles, but it may not be exhaustive:
When you compile pure AS3 project or a project that uses framework:
Resources you embed on variables have their class names generated using the current date in the name.
Flex compiler generates a tag of obscure purpose (can be removed manually, but persists in release builds), which seem to contain a GUID and a compilation time or something similar. It is usually found at the very beginning of the SWF file, somewhere after the rectangle of the SWF dimensions.
In a project that uses framework:
All code generation is suspect to generating inconsistent names, particularly, all bindings will certainly produce different assembly upon each compile. Styles and some other rarely used metadata will cause this too.
Specifically for spark skins, which come as sources rather then compiled libraries - some of them embed resources in a bad way, so you would probably need to compile them into a library and plug it into a project, removing the sources from the source path.
All in all, if you are using pure AS3 project, your task is difficult, but doable (will require following certain conventions and some post-build script that unzips the SWF, purges the compiler-added extra tag and zips the SWF back. But if it is a SWF based on the framework - I'd say the effort isn't worth it, just accept it cannot be done.

Actionscript 3: Solution for reading TAR archives?

Is there an as3 solution for extracting file content from uncompressed tar files around?
/ Jonas
Try hxformat, a Haxe-library supporting a multitude of formats, including tar ... you will need Haxe for that, either using swc output or ActionScript 3 generation ...
A little side note: personally, I'd recommend switching from AS3 to Haxe anyway ... Haxe can also be translated to PHP, which you are using as well, so you could conveniently use it on both client and server ...
Edit: yes, actually Haxe can be compiled to swfs directly, resulting in faster bytecode than as3, but you can always use as3gen, if you want to ... Haxe/PHP is also very cool, because it produces php code, but you can use Haxe, which implies, that it's strictly typed and that the whole API is exposed in a consistent and nice OO way ... Haxe does not even allow top level functions ... but if your really need it to do some dirty stuff, you can use inline php of course ...
the API also contains many helpful things, as the SPOD layer (package php.db) for clean and simple database access ... the tutorial is for neko, but that does not matter, because actually the Haxe/PHP and Haxe/Neko standard APIs are fully compatible ... this also implies, that porting from php to neko (which significantly faster and more effictient in some cases) usually is a matter of remaping package php to package neko using a compiler directive ... Haxe is THE solution for using the deploy-anywhere advantages of PHP, whilst using a really great language ...
Also Haxe is much more expressive than both AS3 and PHP ... it has enums with parameters, generics, structural subtyping, etc. ... there are some drawbacks, due to the fact that it is platform independant, but these will only occur if your code is not strictly typed ... sounds like a lot of typing, but the compiler infers many types, so by initializing a variable, it is already strictly typed ... :)
Oh, and if you really want to use Haxe, have a look at haxelib, which has many cool libraries ...
I haven't seen an as3 tar library. There are zip libraries out there though, like nochump's zip and fzip.
A workaround would be to tell the server to make the requested tar into a zip, load into flash, and once you have the content, tell the server to whipe that zip. It's a big long and has unnecesary steps if you had a tar library for as3.
The other option would be obviously to make your own tar library.
I have used nochump's zip and had no problems, but since you need no compression this would make the whole thing complex for no reason. How about not using any compression at all, and not package the whole thing into a tar. Try Bulk Loader:. Seems to fit your needs. If you don't feel like manually adding all the files manually you could probably generate an xml on the server, something generic like:
<files>
<file url="/images/icon.png" id="icon" />
...
</files>
Load that with an URLLoader, loop through the nodes, add the items to bulk loader and start the whole loading process.

Multithreaded Html to Pdf conversion via Single-Threaded Qt

I am using Qt webkit Jambi API's to convert HTML to PDF.
My target is to create a jar for above conversion so that it could be used in a multithreading environment, but since QWebPage and QWebframe (QT webkit) are GUI classes, therefore the jar classes cannot be initialized from child threads.
So i am stuck as i don't know how to work around this problem.
Also i am a novice in QT , can anyone provide good reference about QT application's lifecycle, event loops and related stuff.
thanks in advance.
Ashish
Well, actually, I just use Firefox to do "Print to File" and select PDF as the filetype. But that's for manual work - although I suppose you could script Firefox.
I think in a Linux environment - and I'm assuming Linux/Unix because you mentioned Qt - that you could probably string together a couple of nx command-line apps. Possibly enscript has something that would help. If not, I'm pretty sure I've seen other solutions, just can't recall them off the top of my head. If you can transform the HTML to Postscript, getting a PDF out of it is trivial.
If HTML4 and (parts of) CSS1 suffice for your needs, then you can use QTextDocument together with QPrinter in a separate thread.
"Programming with Qt, Second Edition", O'Reilly, is excellent but only covers Qt3. A lot of the basic still apply to Qt 4.5.
"C++ GUI Programming with Qt 4 (2nd Edition)", ISBN 0132354160, is not bad.
The Qt docs contain examples and tutorials too.
It's not clear to me why you can't initialize a jar with GUI classes from within child threads. Is this an artificial limitation set on Jambi by the trolls?
I took note of this example on Rendering a webpage with Qt and Webkit to a QPixmap, which theoretically doesn't need to show anything on the screen. QWebPage and QWebFrame both inherit QObject. Using the sample code from the above link, it should be possible to get a webpage's rendered contents without a GUI.
My primary task was to get html to pdf conversion for printing the pdf.
I tried to get QT jambi (QT webkit C++ api also) to work in multithreaded environment but could not.
My final solution was as follows:
I used ‘wkhtmltopdf’ native binary from here,
wrote a java wrapper capturing the standard input and output streams.
Initialized the ‘wkhtmltopdf’ binary for each java thread that required the html to pdf conversion.
Also i never worked on erjiang's advice because by then I had moved out of the task and never got time to work on his advice.