E: me@sabisin.com | T: +4915168651209

InfoAdditions AIR for iOS

Compiling an iOS app using Flash requires an application descriptor file. Within this XML file, you can tell the app to compile for High-Res iPhones, iPad 2 as well as remove the default gloss on an icon and even change the look-and-feel of a status bar.

Settings that apply only to iOS devices are placed within the element in the application descriptor. The iPhone element can have an InfoAdditions element and a requested element as child. The InfoAdditions element allows you to specify key-value pairs that are added to the Info.plist settings file for the application.

<iPhone>
	<InfoAdditions>
		<![CDATA[
			<key>UIDeviceFamily</key>
			<array>
				<!-- iPhone -->
				<string>1</string>
				<!-- iPad -->
				<string>2</string>
			</array>
			<!-- Remove Gloss on Icon -->
			<key>UIPrerenderedIcon</key>
			<string>YES</string>
			<!-- Make Bar on Iphone Black -->
			<key>UIStatusBarStyle</key>
			<string>UIStatusBarStyleBlackOpaque</string>
			<!-- Persistent Wifi for iPad Apps -->
			<key>UIRequiresPersistentWiFi</key>
			<string>NO</string>
			<!-- Exit the App Completely, not just suspend -->
			<key>UIApplicationExitsOnSuspend</key><true />
		]]>
	</InfoAdditions>
	<!-- Make this available for Retina Display-->
	<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>

Jane McGonigal: Gaming can make a better world

Awesome to see we are not the only ones who believe that games and the power of play can change the world.
Check out this amazing Ted talk by Jane McGonigal located at http://goo.gl/505QS


Update: Reality is broken!
Find out why games make us better and how they can change the world.

as3: removing duplicates from an array

Removing duplicate items from an array in one line of ActionScript 3

var tMpaRr:Array = ["a","b","b","c","b","d","c"];

var aRr:Array = tMpaRr.filter(function (a:*,b:int,c:Array):Boolean { return ((aRr ? aRr : aRr = new Array()).indexOf(a) >= 0 ? false : (aRr.push(a) >= 0)); }, this);

trace(aRr); //a,b,c,d

Minimum or Maximum value from an array of numbers

First, note that Math.min() and Math.max() can take any number of arguments. Also, it’s important to understand the apply() method available to Function objects. It allows you to pass arguments to the function using an Array. Let’s take advantage of both:

var aRr:Array = [2,3,3,4,2,2,5,6,7,2];
var mAxvAlue:Number = Math.max.apply(null, aRr);
var mInvAlue:Number = Math.min.apply(null, aRr);

Here’s the best part: the “loop” is actually run using native code (inside Flash Player), so it’s faster than searching for the minimum or maximum value using a pure ActionScript loop.