-
27 Mar 2012 12:06 AM #1
I resolved non-onload problem when back via safari in iPhone
I resolved non-onload problem when back via safari in iPhone
iPhone can't DO onload when back page via safari.
So, I can't click.
But, I found how to add listener again though back prev page.
but... I'm afraid adding a lot listeners.Code:function addListenerTo(element, event, aFunction) { /* element.addEventListener(event, function(event){ aFunction(me,event); }, false); */ // adding listener by 1s setInterval(function() { element.addEventListener(event, function(event){ aFunction(me,event); }, false) }, 1000); }
-
27 Mar 2012 4:16 PM #2
I am not fully sure what you are trying to accomplish.
Can you describe the issue more and show the relevant code?
-
27 Mar 2012 6:37 PM #3
Hi arnebech
It is the problem of iPhone safari.
In the situation from A page to B page.
back.png
A is the page developed by Sencha Animator.
I attached click event to AN-sObj-42 button.
when I go to B page from A page.Code:window.addEventListener('load', function(){ var configData = { parentId: 'AN-sObj-parentOl', ormma: false, scenes: [{id: 0,animationCount: 14,duration: 3800,dimensions: {height: 320,width: 320,expanded: false,fit: false}}], clickEvents: [{id: "AN-sObj-42",handler: function(controller) { linkConvert(); }}] }; AN.Controller.setConfig(configData); }, false);
And I touch prev button of safari.
load event can't run!!
so, it doesn't run!Code:window.addEventListener('load', function(){
I fix below and I resolved.Code:setupListeners: function() { var me = this; var eventName = "webkitAnimationEnd"; if (document.body.style.MozAnimationName !== undefined) { eventName = "animationend"; this.browser = "moz"; } this.olElement.addEventListener(eventName, function() { me.onAnimationEnd(); },false); function addMousemoveListenerTo(scene) { scene.element.addEventListener('mousemove', function(event){ scene.mousemoveAction(me, event); }, false); } var scene; for (var i=0; i < this.scenesArray.length; i++) { scene = this.scenesArray[i]; if (scene.mousemoveAction) { addMousemoveListenerTo(scene); } } /* it didn't run! */ function addListenerTo(element, event, aFunction) { element.addEventListener(event, function(event){ aFunction(me,event); }, false); } //add click events var element, clickEvent; for (var i=0; i < this.clickEvents.length; i++) { clickEvent = this.clickEvents[i]; element = document.getElementById(clickEvent.id); addListenerTo(element, 'click', clickEvent.handler); } },
but, I'm afraid if the addEventListener increacing.Code:function addListenerTo(element, event, aFunction) { /* element.addEventListener(event, function(event){ aFunction(me,event); }, false); */ // adding listener by 1s setInterval(function() { element.addEventListener(event, function(event){ aFunction(me,event); }, false) }, 1000); }
-
28 Mar 2012 10:35 AM #4
So if I understand you correctly, when you got back in Safari the animation won't load, because the 'load' event is never fired?
Could you check what the document state is when the load event is attached? And when/if the load event is fired?
e.g.
Code:alert(document.readyState); window.addEventListener('load', function(){ alert('load run state: ' + document.readyState); ..... }
-
28 Mar 2012 4:34 PM #5
Hi arnebech
>So if I understand you correctly, when you got back in Safari the animation won't load, because the 'load' event is never fired?
Yes.
Safari never fire load event when I back to prev page.
>Could you check what the document state is when the load event is attached? And when/if the load event is fired?
I tried your code.
Before backing, it is appeared.
--
loading
load run state:complete
---
But, when touch button later buck to prev page, it is never appeared.
-
29 Mar 2012 8:59 AM #6
Could you PM me a link or the exported project, so I could try it out?
-
29 Mar 2012 6:58 PM #7
I will send you later
I will send you later
Hi arnebech
I found how to attach only one Listener.
I delete classified information and will send you PM later.
-
29 Mar 2012 8:50 PM #8
Hi arnebech
I'm sorry.
I put the animation on the social game platform.
The social game platform avoid the animation.
It is not Sencha Animator problem.
-
30 Mar 2012 6:51 AM #9
As long as you only are attaching one handler you should be good. I tried to reproduce your issue, but was not able to, but sounds like you have it working now as well.


Reply With Quote