How to detect if your SWF is executing within the MDM Zinc runtime

Been poking around with writing a runtime abstraction layer for Flex/AS3 apps. This would provide support for writing Flex/AS3 desktop app code once and deploy it as an AIR app or any other swf2exe like product such as Zinc. (or FP on the web, -minus the IO features) So how do you detect which runtime you are executing in? If you are checking against Zinc you can do the following:

function isInZinc():Boolean {
	try{
		try {
			// "this" being your main mxml app
			mdm.Application.init(this as Sprite);

		} catch(e:Error) {}    



		// only this prop is available in all OS's

		if (mdm.System.localTime != null &&
 mdm.System.localTime.length > 0) {
    
			return true
		}
	} catch(e:Error) {
		return false;
	}
	return false;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s