adapting javascript to titanium - titanium

in my app I have to compare two images, so I found this code.
I tried on my localhost and work fine but I have to do the same on appcelerator and I have some errors, the first is on var img = document.createElement('img');, then on getContext.
is there a way to adapt the code to titanium?

First of all, Titanium is not HTML so you cannot use DOM things as that code does. Though you can use Javascript but Titanium has its own sets of API and it is really superb and broad. Look here to know what you have got under the hood in Titanium
You have to look into many APIs to make your task done, but first you need to understand what that code is trying to do and what you want to achieve because if you understand the logic, then you can do it in Titanium as well. But please do not adapt DOM or HTML to Titanium :)

Related

Why does JS code render faster on website than react-native?

This is a bit of a general question, but perhaps someone can guide me in the right direction.
I'm using a JS library called Vexflow to render music notes. I uploaded some script to my website AND used the same code to build a React Native app.
When comparing both on the same device (Xiaomi A3), the code renders much faster on my website.
Any ideas why?
Cheers,
Nitzan

How can we achieve coverflow view in android titanium?

I have seen that titanium support CoverFlowView in titanium but it works only on ios, Can anyone have idea to achieve CoverFlow in android with titanium
Thanks in advance
Looks like you are in luck! Someone already built a coverflow module for Android using the Android development environment.
https://github.com/moondroid/CoverFlow
You need to be willing to write the additional code for that to turn it into a module for Titanium.
http://docs.appcelerator.com/titanium/3.0/#!/guide/Android_Module_Development_Guide
It should be possible, but I must admit I've never tried to write one myself.
Basically you cannot get Coverflow on Android. Since it is a native iOs component which is not implemented in Android at all. Frameworks like Titanium always "link" your commands to internal system APIs. When there is no API there is no way to access it. Of course you could try to build it on your own but I think this would not work that well. And its a lot of work!
Additionally cover flow is not really useful (except for holding just a few items). Have a look at my question at ux.stackexchange.

Standalone video control example for Google TV jQuery Library?

The jQuery VideoControl is documented here:
https://developers.google.com/tv/web/lib/jquery/#gtv.jq.VideoControl
It takes a set of VideoParms. That are not specified.
It is used in the sample templates on this page:
https://developers.google.com/tv/web/docs/gtv-templates
I've taken apart the templates, but I'm having difficulty creating a simple example of a standalone video control. In the templates, the sidenav and carousel code are tied to how the videocontrol works. There is a relationship between the keyController and behavior (behaviorZones) that I can not find an explanation for.
Is there a standalone example somewhere? What needs to be setup with keycontroller, css, and behavior to get this going?
I'm not aware that there is a standalone videocontrol.js sample but it should be possible to set it up. Most of the necessary pieces are inside videocontrol.js, in particular in the videocontrol's constructor and this function: gtv.jq.VideoControl.prototype.makeControl.
keycontroller mapping is used to handling key inputs and some of the CSS are dynamically controlled within JS so there might be errors if you just rip them apart straight from the Template. You'd have to debug it using a solid tool like Chrome Developer Tools. You can watch tutorials of this tool here: http://www.youtube.com/results?search_query=chrome+developer+tools&oq=chrome+develop&aq=0&aqi=g3g-m2&aql=&gs_sm=3&gs_upl=1972l4015l0l6142l14l11l0l0l0l0l207l1476l3.5.3l11l0
Otherwise please send your error traces and/or code snippet for debugging help.
S

Using Titanium.Platform.takeScreenshot

I'm evaluating using Titanium for a project that makes videos from browser based animations. I was hoping for a way to take screenshots from within the app for each frame. The documentation of takeScreenshot seems a little slim so I was hoping to ask before I build a prototype.
Does take screenshot get the full document, or just the visible content?
Does the screenshot include window chrome?
Someone from titanium QA was able to answer the question. takeScreenshot actually takes a screenshot of the whole desktop.

Displaying image on Scroll View

I am developing an iPhone application where i want to display three image in each row on scroll view where i need to click action on each image like Photo album in iPhone. I am not getting any sample code.
Hoping for help
subodh
There's plenty of sample code out there, I found this after only basic googling. You want to search for "UIImageView Iphone". It's also worth mentioning that Apple's very own Developer Center is extremely well written, and will teach you everything you need to know about iPhone programming.
Generally it is frowned down upon to say to look more or read documentation, but you really haven't looked at all. Especially because of Apple's own resource that tells you how to do almost anything, especially something like this. It's not something you can pick up and bits and pieces of and expect to be successful with, it really should be learned starting from the beginning and moving forward. This is especially true if you've never programmed before or are unfamiliar with C/Objective-C.
Three20 has a photo browser that is open source and works similarly to the iPhone's photo browser with some nice code examples. The images come from an image source object that can relate them to images in your apps bundle or images on the web. Looks like its Google group is here. I think that to use images in your bundle you use a URL formed like: bundle://image-name.png and not the typical use of the main bundle to get a path to resource.