What is the best way to get the minimum or maximum value from an Array of numbers?

The theoretical answers from everyone else are all neat, but let’s be pragmatic. ActionScript provides the tools you need so that you don’t even have to write a loop in this case! 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 …

Read more

How to make use of play2() function in order to perform fast stream switching of videos?

As the Documentation says: “The default value of offset is -1, which defaults the switching behavior to standard. In this mode, the server determines a good transition point between the streams forward in time from the point it receives the switch call, and switches at that point.” So you have to change the ‘offset’ parameter …

Read more

How to detect when a youtube video finishes playing?

This can be done through the youtube player API: http://jsfiddle.net/7Gznb/ Working example: <div id=”player”></div> <script src=”http://www.youtube.com/player_api”></script> <script> // create youtube player var player; function onYouTubePlayerAPIReady() { player = new YT.Player(‘player’, { width: ‘640’, height: ‘390’, videoId: ‘0Bmhjf0rKe8’, events: { onReady: onPlayerReady, onStateChange: onPlayerStateChange } }); } // autoplay video function onPlayerReady(event) { event.target.playVideo(); } // …

Read more

What is the best way to stop people hacking the PHP-based highscore table of a Flash game

This is a classic problem with Internet games and contests. Your Flash code works with users to decide a score for a game. But users aren’t trusted, and the Flash code runs on the user’s computer. You’re SOL. There is nothing you can do to prevent an attacker from forging high scores: Flash is even …

Read more