Start a new topic

Display local content with AR.context or fireEvent

Hi there,

from the sample imageRecognition_3_Interactivity, I can display remote contents  click on my buttons with the function :

createWwwButton: function createWwwButtonFn(button,url, size, options) {
        options.onClick = function() {

but without success concerning local contents stored in the sample assets folder.

    1. i tried a local path with :


    2. i tried to catch an event listener with

    Ti.App.addEventListener('myfunction', etc. in app.js

    options.onClick = function() {  Ti.App.fireEvent('myfunction', etc.

    3. i tried  to test  the same fireEvent onload in the index.html.

    4. i tried with EvalJS too.

    There is no result of the event in the consol logs.

    The same code works fine with webview or windows objects used in titanium. Pls, do you have an idea of the way to do.

    Thank you.

    ok, for all purposes, i found the answer :
    the path must be absolute.
    AR.context.openInBrowser("absolute path/file");

    and to get the absolute path  :
    var htmlDir  = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory,'htmldirectoryname');



    sorry, i forgot the last line :


    Hello Olivier,

    Thank you for posting your solution. You are correct as, for this specific event, in order to load a file locally, you need to specify the absolute path and not only the relative path. If I may ask, could you tell me your use case and why you are using this event but you wish to load the content locally?



    Login or Signup to post a comment