I'm making a game in Flash for Android with AS3. I want the user to know that he pressed a button by making the device vibrate for a brief second. Can someone explain to me how I can make this happen? Do I need to import a specific class and what should the code look like?
Thanks in advance!
To use the Vibration extension, an AIR application does the following:
Checks if the extension is supported by calling isSupported. Causes the device to vibrate by calling vibrate(), specifying the duration of the vibration in milliseconds as a parameter.
var vibe:Vibration;
if (Vibration.isSupported)
{
vibe = new Vibration();
vibe.vibrate(2000);
}
Android applications For an Android application, include the Vibration permission in your application descriptor file:
Android Permission : <uses-permission android:name="android.permission.VIBRATE"/>
Reference : http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/vibration.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With