[html5/canvas] a way to disable effect on mobile


#1

Hello,

I use a glow effect on movieclip and textfield on Animate. And it seems to affect performance on some mobiles. Is there any way to disable the effect easily by code when I’m using a movieclip from a swf? Or do I need to make a alternative movieclip without the effect in Animate?
How can I know that the app is currently running in mobile?


#2

For HTML5, it’s user-agent sniffing (or perhaps some other detection mechanism? touch screen event support?) that would tell you what device type. You should be able to remove your filter using myObject.getChildByName ("myOtherObject").filters = [] or something similar, but if it’s a frame in a larger animation, the object may get recreated. For a static object, removing the filters once should do it


#3

This is the function I use to detect the type of device:

public static function getBrowserType(): String {
	var browserType: String = "Undefined";
	
	var browserAgent : String = Browser.navigator.userAgent;
	
	if (browserAgent != null) {
		
		if	(	browserAgent.indexOf("Mobile") >= 0
			||	browserAgent.indexOf("Android") >= 0
			||	browserAgent.indexOf("BlackBerry") >= 0
			||	browserAgent.indexOf("iPhone") >= 0
			||	browserAgent.indexOf("iPad") >= 0
			||	browserAgent.indexOf("iPod") >= 0
			||	browserAgent.indexOf("Opera Mini") >= 0
			||	browserAgent.indexOf("IEMobile") >= 0
			) {
			browserType = "MOBILE";
		}
		else {
			browserType = "DESKTOP";
		}
	}
	
	return browserType;
}

I hope it can help.


#def Compile ( html5 target )
#4

Thanks for sample!

Yes, so for now I’ve made a different movieclip in my swf without the effect. A way to disable all filters could be helpful for old/not good devices.