Need a little good news today? We've got plenty!

Use the Microphone object for a prank this Actionscript Afternoon

prankedFirst off I don’t condone this type of behavior but it is very entertaining.

I wanted to write about the Microphone object in ActionScript this afternoon, but I couldn’t think of a good topic until I remembered the Microphone.activityLevel property. This property will return an integer between –1 and 100. 0 to 100 indicated a level of volume entering the microphone attached to the computer and –1 indicates no microphone is attached or the user has not ranted Flash permission to access their microphone. This leads to an interesting prank.

Why not gain access to a friend’s desktop and add you simple Flash file to their active desktop. The file will begin to spawn ‘Ha, Ha’ browser windows as the friend yells at their computer. The code I am giving you will cause more windows to spawn as the yells increase. This doesn’t work with the web though because Flash requires a user to give permission to the Flash file to gain access to their microphone.

The code and how it works:

var theMicrophone:Microphone = Microphone.get();
//create an instance of the microphone object
// and attach the microphone sound feed
//you will be attaching nothing if there is no feed,
// plus when the project is opened
//the user will need to give permission to access
//the microphone
theMicrophone.onActivity = function(active:Boolean) {
//when the microphone detects sound start the following function
  if (active) {
  //as the microphone hears louder sounds new browsers are spawned
    if (theMicrophone.activityLevel>25) {
      getURL("pranked.html", "_blank");
    }
    if (theMicrophone.activityLevel>50) {
      getURL("pranked.html", "_blank");
    }
    if (theMicrophone.activityLevel>75) {
      getURL("pranked.html", "_blank");
    }
  }
};

This can also be interesting for creating a customer support tool that detects the loudness of either the representative's voice or the customers, but we wouldn't want to do that would we.

 

Reader Comments

(Page 1)
News
Macromedia (141)
Innovation (164)
Merger (41)
Releases (65)
WIN Business (24)
Events
MAX (26)
FlashForward (8)
MMUGs (16)
Webinars (4)
Learning
ActionScript (49)
Designer Certification (5)
Developer Certification (6)
Ideas (163)
Links (83)
Samples (57)
Tips and Tricks (98)
Tutorials (45)
Design & Development
Accessibility (14)
Ad Design (27)
Art (94)
Components (6)
Extensions (17)
Games (65)
Rich Internet Applications (99)
Sound (38)
Video (65)
Web Standards (33)
Software
Flash 8 (103)
Flash MX2004 (92)
Flash Paper 2 (3)
Flash Player 8 (55)
Flash MX2004 Professional (44)
Flash Lite (24)
Flash Platform (91)
Flash Remoting (3)
Flash Communications Server MX (8)
Flash Video (24)
Flash Paper (3)
Macromedia Contribute (2)
Macromedia Flex (8)
8Ball (15)
Maelstrom (19)
Software Updates (34)
Beta (22)
Bugs (14)
Studio 8 (25)

RESOURCES

RSS NEWSFEEDS

Powered by Blogsmith

Other Weblogs Inc. Network blogs you might be interested in: