Minko - getElementById causes runtime exception to be thrown: TypeError: Minko.tmpElement is null

56 views Asked by At

I am using minko and html-overlay feature. In my overlay onload()->connect() method I have the following statements:

...

gameInterfaceDom = dom;
but1 = gameInterfaceDom->getElementById("id_but1");    //trouble here !
but2 = gameInterfaceDom->getElementById("id_but2");


LOG_INFO("Going to bind onclick events...");
if( but1 != nullptr )
{
    onBut1 = but1->onclick()->connect(
    [](dom::AbstractDOMMouseEvent::Ptr event)
    {
      // do something...
        LOG_INFO("clicked button 1");
    });
}

if( but2 != nullptr )
{
    onBut2 = but2->onclick()->connect(
    [](dom::AbstractDOMMouseEvent::Ptr event)
    {
      // do something...
        LOG_INFO("clicked button 2");
    });
}

...

Compiling and running under linux64 works perfectly even if the loaded html does not contain the but1 and but2 IDs, however, the same code crashes for Android and web / HTML5 (if expected IDs are not found) with the following error :

exception thrown: TypeError: Minko.tmpElement is null

Is there a workaround for such case, or is it mandatory to have the expected IDs in c++ also defined in html ?

Thx.

0

There are 0 answers