How to access animated content locally from Swiffy converted flash? - android

I have a flash animation file converted into HTML5 file using SWIFFY. These files are being played in WebView, they play fine.
There are few animations in HTML5, I would like to control these little animations in Android locally on the touch event. I want to know as to how to expose these animations to the Android layer, is there anything else required like Javascript or JQuery?
I would like to add, that I am totally new to HTML5, CSS, JavaScript and JQuery.
Any help would be greatly appreciated.

If I understand the problem, you can't do it like that because the animations defined within the swiffyobject become parts of one larger svg, which the swiffy runtime then manages. The runtime itself exposes just a small API, which is a bit constraining. I've found no way to say "my swiffy.someAnimationWithin.doSomething()"
What you can do is use stage.setFlashVars to pass "messages" to your ActionScript, which of course was also translated and is being played by the runtime. In this ActionScript, use onEnterFrame to check for those variables/messages then change their states with ActionScript. The animation can also talk back to your JavaScript via ActionScript's getURL("javascript: mynamespaceObj.doSomethingScripty()") or, I believe, AS3's URLRequest(...)

Related

CSSBox for Android

While I was Looking for HTML render engine for Android, I found CSSBOX, but unfortunately it uses java awt which is not available in Android.
Anybody knows a fork of CSSBOX or something else than can render simple HTML to Android, preferably into Android views?
Android WebView is limited and I can't access "each" rendered word, I need this to set bookmarks using exact offset of word in original HTML file.

Download and injecting unity scene in runtime

It's possible that we start an android project in which it's necessary after recognising an image by camera to visualise a content generated in unity.
The easy part would be to use webGL to display it, but there is the problem of devices that do not support it directly. My question is if from android (and later iOs). It's possible to download a content of unity, load and visualise it in runtime?.
Is possible that I had to direct all the effort to generate that content in a .jar and then use something like dependency injection to load it?
I have already a unity scene in an activity but of course in project definition not in run time.
Any help or guidance would be welcome.
Unity builds levels into the final runtime executable, so adding a downloaded 'scene' directly is not possible. The best way around this is to create a 'generator' scene which can accept input from a downloaded text file, such as JSON, and use that to render the level.
However, this method does assume that all the possible objects that can be rendered are in your game as prefabs. If you're wanting to pull images from the net to be loaded into textures, the WWW class might get you started down the right path:
https://docs.unity3d.com/ScriptReference/WWW.LoadImageIntoTexture.html

Android UI : from html to XML

I've developped an application using XML Eclipse tool too build my UI.
Now, i'd like to use a tool like Axure to create a "nicer" interface.
My problem is : is there an easy way to switch from XML to HTML (because Axure is producting HTML file from Wireframe design) ?
And if not, how to "plug" HTML file to the existing application (which is using R.layout.xxx or R.id.xxx to access displayed elements).
I'm quite new in Android by the way...
thanks !
You can't really do what you describe. The way Android layout is specified in XML cannot be compared at all to HTML for websites. Besides, Axure is a mock-up tool. It creates interactive mockups and prototypes - not final solutions for anything.
If you really want to use Axure, perhaps you would want to go for web apps with something like PhoneGap - they are written in HTML and JavaScript, but have less possibilities.

Why is XML not HTML used for UI in Android progrmming?

Why can't HTML be used for building interface in Android Programing?
XML enables us to create custom tags.. Consider we created a custom view, we can reference them from xml itself. So the idea of UI separation from logics, stays intact.
HTML is a standard designed to display web pages. The android XML layout files are custom configuration files that are intended to be parsed by the dalvik VM. Two separate worlds. Here are some good reasons not to use HTML to define a configuration.
HTML is not well formed. Parsing is a pain. No schema checking.
How will you style elements ? CSS ?
Its hard enough getting CSS to work
across several browsers.
How will you introduce custom elements into
the HTML configuration ?
I could go on. It just does not make sense to configure a native UI using HTML.
I think the xml is chosen because the xml tags are defined in android according to the UI framework classes and the attributes are defined corresponding to the member variables of the class in the UI framework. This mapping was not possible for the html.
Extensible Markup Language, the extensible part makes it much more versatile. HTML is basically an implementation of the general concept of XML specifically for web browsers.
Also it is overly bloated for the simple task of creating layouts because it contains a lot of tags and attributes (i.e. method, onclick, etc.) that define the behavior of elements not just their layout.
I think they are few reasons for that:
When you have Layout and Source Code separately you can separate your application logic. Thus many XML files can be bound with one piece of source code and Platform (Android, Windows Phone, etc.) will choose automatically the proper XML layout depending for example on: screen denisity, screen orientation etc.
Next thing is answer to your question: Why not html. In my opinion there are few reasons. Most important is that XML has strict well formed structure and XML can be restricted with XML Schema. In fact having XML Schema is great because not also restrict your document but also give an sort of documentation of files inside XML. Someone reading this may think: HTML can have also strict structure as XHTML specification. Yes but XML is designed for that.
Next aspect is that XML is more popular as HTML in configuration/Layout (Java EE, XAML, Android XML's, etc.) stuff. It's like a good practise.
In fact you can build your application almost in HTML/JavaScript but you need to use some specific framework which wrappes your Platform application and transform it to Platfrom Independent Web Application(for example Sencha Framework)

Is it possible to use XHTML design for android application instead of XML design?

Is their any possibility to use XHTML design for android application instead of XML design
XHTML is a specific vocabulary for web pages; XML is a grammar for representing data. Both are standards from http://w3.org/
XHTML is a document markup language, like HTML. (Except, HTML is defined in the SGML grammar, and XHTML limits itself to the XML subset of that grammar.)
XML is a grammar (of sorts; this is a simplification) to define various data and document markup types.
Neither are, per se, used to develop applications; however, the Android SDK has several "small languages" that it uses that are defined in terms of XML for things like the manifest file and user interface layouts. These can not be substituted for another language, even one that looks similar on the surface, like XHTML.
It's roughly analogous to: Both English and French use fairly similar punctuation and the same alphabet, just as all XML dialects have similar notation, but even though they may look the same, it does not mean that one can substitute French for English at will.
You may see reference to "applications built using XHTML" or "...HTML;" typically, in fact, these are applications which produce HTML (or XHTML) output, or interact with/modify existing HTML/XHTML documents. The applications themselves are written in JavaScript if they run in the web browser; or some other language (Perl, PHP, Ruby, Python, Lisp, C++, even JavaScript again) if they run on the web server.
You could always use a WebView and render HTML inside of that, but you'd be much better off just learning Android's XML, or using the drag-and-drop Interface Builder in the Eclipse Plugin, which is actually pretty good since it was revamped earlier this year.
As far as I'm aware, you'd have to use the XML format to create an acutal layout within Android (and then use code within Android to control the interface). However, a good alternative would be to use the WebView class, which allows you to display a webpage within your application. This would likely writing a small amount of XML layout to display that view, but from there you can just make your "app" a webpage and control it however you best see fit (server-side processing if you have it on the actual "web" or perhaps JavaScript).
This may not be the only option, but it should work well.
Read more about WebViews here: http://developer.android.com/guide/webapps/index.html
I suppose you could, although you'd have to define an xslt transform that will translate the xhtml into android's xml language. You'd probably be confined to a small subset of xhtml, though.
XHTML is just one application of XML. XHTML is in fact XML. To answer your second question, yes you must use XML everywhere the documentation tells you you must. Sometimes you can do things programatically - but its probably easier to do it in XML, especially if you use the right tools.

Categories

Resources