Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ChangeState issue on Android and IOS (it works now and then)

Contributor ,
Apr 11, 2021 Apr 11, 2021

I got an issue with state views on Android and IOS. It works ok on a IOS and Windows computer.

I made my own "question slides" where I got four check boxes withad smart shapes (id=button+something).

Each check box got two states "button" and "pressed". When you click on a check box it should change state and show a checkmark.png inside the object using the JS below (it should also show another object using cp.show('Object name');

But the buttons simply not changing states.

Here is what I got from the remote debugger in Android.

///// This JS code is inserted on every slide (on enter)


switch (true) {
case (Device == "Touch"):
window.addEventListener("click", function(e) {

if(e.target.id.startsWith("button"))
{
cp.changeState(last, "Normal")
last = e.target.id
cp.changeState(last,"pressed")

}
}); 

break;
case (Device !== "Touch"):

window.addEventListener("mousedown", function(e) {

if(e.target.id.startsWith("button"))
{
cp.changeState(last, "Normal")
last = e.target.id
cp.changeState(last,"pressed")

}
});
 
break;
}

//// Error messages below [Full code attached in stateissues.txt]

Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
cp.AutoShape @ VM12:1467
a.parseChildren @ VM12:628
a.parseFrameset @ VM12:629
a.Timeline.addFramesetsForSlideAtIndex @ VM12:1208
a.Timeline.loadSlideAtIndex @ VM12:1216
a.Timeline.updateFrame @ VM12:1226
_onEnterFrame @ VM12:1357
step @ VM12:1336

 


Uncaught TypeError: Cannot read property 'length' of undefined
at Function.a.changeState (eval at e (CPXHRLoader.js:37), <anonymous>:1037:19)
f.stl;d=-1;if(0<c.length)for(e=0;e<c.length;e++)if(c[e].stn==b){d=e;break}-1!=d&&(f.currentState=d);a.canStateBeRetained_Name(b)&&(f.temporaryInitialState=d)}}};a._changeState=function(c,b,d,e,f){var h=a.D[c];if(h){void 0===e&&(e=!0);var j=a.getDisplayObjByKeyOnAllLayers(h.mdi);if(j){var g=a.getInfoForStateChange(c,b,!0);if(g.bFound){var l=j.currentState;if(d||l!==g.stateIndex){var d=!1,n=a.movie.stage.getCurrentSlideInteractionManager();null!=n&&(d=n.DoNecessaryStuffBeforeChangeState(c));j.currentState=


at eval (eval at a.runJavascript (eval at e (CPXHRLoader.js:37)), <anonymous>:7:4)
a.changeState @ VM12:1037
eval @ VM296:7
"utf-8"),i.b||i.c?i.c?(h.a[b]=g.href,t()):(g.innerHTML='@import "'+r+'";',s(g)):g.onload=g.onerror=a,c.push(g);
b=0;for(f=c.length;b<f;++b)j.appendChild(c[b])}},js:function(){function e(){for(var d=0;d<a.length-1;++d)try{eval.call(window,g[a[d]])}catch(b){console&&(b.stack?console.log(b.stack):console.log(b.message))}a[a.length-1].call()}function d(b){var c=new XMLHttpRequest;c.open("GET",b,!0);c.onreadystatechange=function(){4==c.readyState&&(++h,g[b]=c.responseText,h>=a.length||(h==a.length-1?e():

355
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 12, 2021 Apr 12, 2021
LATEST

Well..

I tried this instead, but I think I got some errors in the code:

 

window.addEventListener("mousedown", function(e) {

if(e.target.id.startsWith("aButton"))
{
cp.show($('[id^="Acheckmark"]' ));
cp.hide($('[id^="Bcheckmark"]' ));
cp.hide($('[id^="Ccheckmark"]' ));
cp.hide($('[id^="Dcheckmark"]' ));
}

else if(e.target.id.startsWith("bButton"))
{
cp.hide($('[id^="Acheckmark"]' ));
cp.show($('[id^="Bcheckmark"]' ));
cp.hide($('[id^="Ccheckmark"]' ));
cp.hide($('[id^="Dcheckmark"]' ));
}

else if(e.target.id.startsWith("cButton"))
{
cp.hide($('[id^="Acheckmark"]' ));
cp.hide($('[id^="Bcheckmark"]' ));
cp.show($('[id^="Ccheckmark"]' ));
cp.hide($('[id^="Dcheckmark"]' ));
}

else if(e.target.id.startsWith("dButton"))
{
cp.hide($('[id^="Acheckmark"]' ));
cp.hide($('[id^="Bcheckmark"]' ));
cp.hide($('[id^="Ccheckmark"]' ));
cp.show($('[id^="Dcheckmark"]' ));
}};

 

/Jacob

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources