so I needed to record a double click in flash for a project and went looking for code.
wow. there's a lot of convoluted and LONG code out there for such a simple thing! recording a double click shouldn't require 30 lines of code. if it does, you're doing something seriously wrong.
here's MY actionscript 2 (AS2) code for detecting a double click in flash if you want to change the speed at which you want to detect make 'double_click_wait' higher or lower. 11 lines of code is all you should need.
//mouse double click
var double_click_wait = 300;
var lastClick = 0;
var mouseListener:Object = new Object();
mouseListener.onMouseUp = function() {
if ((getTimer()-previousClick) < double_click_wait) {
trace("mouse double click ");
previousClick = 0;
}
previousClick = getTimer();
};
Mouse.addListener(mouseListener);
This code is meant for pls files but could easily be adapted for m3u. no benefit I can see in doing that though compared to pls.
-----
So for a little personal project I'm doing in flash I'm building an mp3 player.
Playing mp3's with flash is pretty easy and and making some buttons with play pause etc is also not really an issue. But loading a playlist file... well now we have a problem.
Most people seem to want to just creat an xml file becuase flash does that easily. But that seems like a little lazyness at the start and alot of tedious work down the road creating xml files all the time. I'd rather not have all that extra work later on and I'd rather have native support of .pls files for playing music.
I googled and couldn't find anyone who got this running except some guy, ming chan with m3u years ago, but the source is since gone and disapeared. So for anyone who's also stuck, please feel free to use my actionscript code, but if you improve it (It's messy I know...) please post in the comments.
Anyways here's the source code for parsing a .pls file in actionscript2.
It's pretty raw and brute force, but it works just fine. You have 2 string arrays at the end, one with the file location and one with the id3 name. unfortunetly track time isn't in a .pls file (it's also not in an m3u either) so you have to read that on your own with another function. ...maybe I'll post that after I write it.
Like beer? who doesn't? I just finished working on the current Stella Artois.com website for xmas, it was designed here at my work (Lowe Roche) by us and Dan Purdy an uber talented flash guru. Beyond doing a bulk of the xml and php code that runs it I also designed the printable paper ornaments you see there (the bird and star).
Go try printing them out. they're free and fun!
it was also a great exercise in 3ds max to foldable form construction and just a fun break from my usual programming heavy job.
all emails originally sent to genpets.com also go to my database. (replies from me or them don't). November 2008 had 3017 emails alone. and I tried to reply to most of those!!
if you're stumbling accross this site and are curious, check out www.brandejs.ca/gp_emails.php
(126) Total entries in journal
// Finland 2003
"That was when I realized. I asked myself could some of what these people be talking about actually be dangerous? And the best thing I can do is stay close to them, track what they are interested in and either hack it or try to confuse the spaces in which they operate". - Rob Van Kranenburg