A JavaScript that clicks automatically over a flash object on document ready? - java

I got a flash document I CAN'T modify, that starts its animations only when pressing a button it has on it. I tried EVERY script I found on the internet but nothing worked. I need to simulate the click on that button so the flash animation can start! Is this possible?

If there are no APIs (which give you access to the elements),
you cannot interact with the Flash UI, because the Flash content has its own context, where JavaScript has no access to it.

You can try to decompile your flash file and get FLA-project of it. There it is possible to make required changes and create new swf.
There are many swf decompilers, but there is no 100% guarantee for successful decompilation (especially for big and complicated flash applications)

Related

How can I listen for clipboard pastes not targeted at my application?

I'm developing an application which calculates and displays information which then needs to be copy and pasted into a proprietary program. To make this easier for the user, I'd like to enable them to ctl+v, move cursor, ctl+v, etc., and have my program pick up on the pastes and update the Clipboard automatically after every paste.
Is there any straightforward way of doing this? The only things I've found involve accessing DLLs and the like, and this isn't a project I can spend too much time on at the moment.
It's possible, check this project out: https://code.google.com/p/jnativehook/
That will allow you to listen to key events even when your app doesn't have focus. It won't work if they don't paste with a keyboard shortcut, though.

Is htmlview too elementar?

This is certainly a very basic question, please excuse me if this is well known.
I made a Java app that generates a HTML file 'fileout' to be viewed locally (essentially a page with thumbnails that open bigger images with some javascript (not really needed); both thumbnails and images are in my sdcard). Then my app calls an intent to open the page, in the usual way:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(fileout), "text/html");
startActivity(intent);
The problem is that the app calls HtmlView, that behaves too restrictive: no back action to open another image, horrible title bar (I want full screen), not really good rendering of thumbnails, etc. So my question is:
Is there a way to configure Htmlview? How configurable is it? Does it understand javascript?
Moreover, if you think I would be better served with the default browser, how do I tell the app to open the browser instead of htmlview?
Sorry for the several-in-one questions, but they are all linked.
Thanks!
L.
Do you mean WebView rather than HtmlView? While WebView is fairly configurable and you could make it into a reasonable browser experience, it's a bit of work to do so. WebView does support JavaScript, but you have to enable it. As for "not really good rendering of thumbnails", that's rather vague. All in all, unless you have some specific need to run it in your own view, I would tend to prefer to just open the file in a browser if that experience is acceptable. Your current code should actually already do so... Perhaps the app selector popped up and you set it to use your app by default?
You can use WebView that will load html file you want and js hand by hand. This will allow you not to leave your activity or application at all.
WebView can be configured as you want it.
Idea:
Start new activity that will run with no title bar/windows fullscreen.
Read:
http://developer.android.com/reference/android/view/Window.html
for setting different window flags.
In your activity set content view to some WebView
Read:
http://developer.android.com/reference/android/webkit/WebView.html
Pay attention on .setJavaScriptEnabled(true);

Javascript PopUp Functionality

I spent hundreds of hours writing an HTML5 application.This application deals with multiple popups and I suddenly ran into a problem when managing them.
My main goal would be bring a blurred popup window to front by focusing it.I am wondering if this is possible in JavaScript.
If not, could I use java applet in order to gain more functionality on my popup windows. Could I perhaps embed Google V8’s engine in order to render my existing HTML5 code in this application?
when you open a window you create a reference to it. You can then use that reference to call focus() on.
var foo = window.open( /*params*/ );
foo.focus();

Detect if .swf has transparent background

Is there a way to do this programmatically in PHP, Python or Java?
Use case:
User uploads .swf through an upload form.
Detect if it has a transparent background.
If it does, change it to something else, e.g. white.
This is very difficult to determine, because all SWFs are actually transparent (or they all can be) - it's just that they can contain shapes which cover the entire stage, which make them appear non-transparent.
To determine this programmatically, you'd need to loop over every shape in the SWF and look at it's bounds. However, that wont be enough since any shapes can be changed by ActionScript blocks and new shapes can be created at run time.
But really, making them transparent is the hard task. Since you want to make sure they're are non-transparent, you can just deal with this at display time - put a colored div behind the object or embed tag.
Probably impossible. I suggest a checkbox on the upload form "This flash app looks best with a transparent background".
Here is a flash app that has
- a transparent background to start
- a slider that lets you adjust the opacity
As you can see it would be impossible to say "transparent" or "opaque"
As far as I know you can't get the background alpha (transparency) of a swf file. what I would do if I were you would put the uploaded swf into a container swf (load the uploaded swf inside it) which only has a background color of your choice.
There used to be a php swf reader in this link. But I didn't see any alpha information in it aswell.
Flash is a bunch of compiled binary data. You Might be able to hunt down a third party library which can un-compile the flash file and get some of the data from the root movie scene, but it's a large stretch. As others have recommended, a checkbox during upload would be the best route to take.
I think you can read the .html where the .swf is placed and see if there is a parameter called "wmode" and is set to "transparent"
If that's the case you can get the html file and read it with Python, Java or PHP.
It's an ugly solution, but it's a solution.
PS: Sorry for my poor English.
The swf files are handled by plugins running inside or outside the browser. There is no way to tell if a certain flash has or hasn't transparent background... i guess you can assume that all of them are transparent..

Java multiple Images Uploader

I have this new requirement to develop a software which is a large scale image up loader in a web application. I was able to do the same using swing contains several feature like drag and drop, progress bar, remove file / files , modify, limit file size, verify file information, timer, verify at run time ..and its a very powerful tool which uploads images.
I would like to do the same in web based app, like user selects 200 images process it and click upload and it should start uploading, like to know any feasible frameworks or any API's which help me do this faster and achieve the same kind of functionality. Please point me in correct direction.
-PD
You can do upload apps, but not fancy stuff like drag and drop with run of the mill HTML. HTML5 on google chrome maybe, but I doubt you want code that only works on chrome.
Have you looked into turning your image uploader app into a java applet? Applets generally have a bad rep, but this is one of the very (in my opinion) valid uses of one...
Either turn your uploader into an applet or use a 3rd party image upload applet, such as JumpLoader. You then just embed this applet in your webpage. Turning your uploader into an applet should actually be a piece of cake since you've the UI apparently already ready. You can make use of deployJava.js script to reliably deploy an applet.

Categories