Have a look and download the ZIP/RAR files you want (containing the FLA, AS and miscellaneous files used to create the corresponding Flash movieclip).
[Off Topic] Apache 1.3.2x stuff for Win2K/Windows NT4
Including tweaked versions of ACK, FLEM, pQueue, swfQueue, XML:ACK, etc. You might want to have a look at http://chattyfig.figleaf.com/ for the original artwork by Branden Hall.
Keywords: Branden Hall, OO, Event Engine, Queue, XML
Download: Have a look-see.
Changes color and shows a growing segment of the circle based on the 'percentage loaded' which you can set from another movieclip which loadMovie()'s this preloader.
Uses ActionScript to rotate and switch shapes (movieclips) to make it look like circle segment grows as the LoadPercentage variable increases from 0 to 100.
Keywords: _visible, _rotation, Color object, setTranform(), ActionScript-driven color tweening, HSV to RGB color conversion and vice versa.
Download Flash 8 FLA project (will still output Flash 5 player compatible output!): CircleLoaderV2.1.zip
View the example usage demo here.
(Old Flash 5 proejct download without the color tween bugfix and example FLA: CircleLoaderV2.zip)
This SWF shows a panorama 360 degrees around view (rather faked as I don't have 360 degrees images lying around so I faked one, the principle stays the same though) which you can rotate around using the mouse. To give a good sense of speeeeeeeeeed the image is stretched depending on the rotation speed.
Uses ActionScript to shift and zoom (stretch) a masked image object (movieclip). To make it look like the image 'wraps around the complete 360 degrees' it is duplicated so that two identical images are placed next to each other and masked.
Also shows a very crude preloader with some very basic ActionScript in the root movieclip frames. (This code is 'not aesthetic' from my coders' point of view. Yet it works.) Note that the text in the preloader is 'Broken apart' as it takes less KBytes to load as shapes than as a character sequence with implied embedded font.
Keywords: _visible, _rotation, _xscale (zoom / stretch), mask, duplicateMovieClip(), _xmouse, _ymouse
Download FLA: panorama-test.zip
Duplicates a movieclip many times. Used to show that duplicateMovie() does keep the ActionScript code with the clip.
Uses ActionScript to duplicate a simple shape (rectangle, movieclip) 160 times. A the movieclip which is duplicated, contains #include'd Actionscript, this code is copied to the dupe'd objects too: each object uses the same ActionScript to create this effect when you move the mouse over the 16 by 10 array.
Keywords: _visible, _alpha, Color object, setTranform(), HSV to RGB color conversion and vice versa, duplicateMovieClip(), Array, Math object
Download FLA: include-and-dupe.zip
As the above, but now with a nice animated 'wave' around the cursor.
Keywords: _visible, _alpha, Color object, setTranform(), HSV to RGB color conversion and vice versa, duplicateMovieClip(), Array, Math object
Download FLA: duped-wave.zip
The FLA was downloaded from moock and edited to show circular movement over a circle *segment* at a given offset along the circle path.
Later I added code and an extra parameter to allow the ball to move back and forth. Try mode '1' at 360 degrees and be surprised. Oh, please note that the Flash movie on this site has the flaw mentioned in my email in the Flashcoders mailing list, yet the FLA has both the 'guestimated hack' shown here *and* the 'clean, proper' version which you simply cannot break. (Try mode 1 with segment '60' and an rpm of '-100' and see what I mean when you compare that with any rpm larger than, say, -50...
Keywords: % operator, degrees to radians
Download FLA: motion-circular.zip
(This text is copied almost straight from my email to Flashcoders, humbly asking for a review/opinion.)
So I finished my first Flash 'tour' on my way to a flexible menu system that in constructed at run-time by ActionScript.
This code is designed around the 'Visitor Pattern'[*]
I've got a question, right? Right. The question: anyone who feels like reviewing the ActionScript code in my FLA? I'm wondering if I 'did well' or not.
Apprentice is humbly asking AS/Flash masters for a grade. ;-)) (And please don't grade the 'look and feel'. That'll be an F- for sure. ;-( )
You register your MC's with so-called 'invisible buttons' and receive the button events (press, release, dragover, rollover, etc.) in your movieclips(!). Just define a couple of onBtnXXX() function methods for your MC (where 'XXX' is the button event; see the FLA mentioned below) and 'RegisterMyMC(myMC)' with the desired 'invisible buttons'. This way, you can handle selected button events generated by one or multiple buttons in your own cosy MC without having to change any code in the 'invisible button' when you add other MC's that handle button events. Multiple MC's can act on the same button event of a single button by each registering with that button.
Suppose you want to build a complex menu system (or other
complex system using 'button' functionality) at run-time. The menu
is built, consisting of several movieclips, each with it's own
'invisible button' on top to catch the instructions of the
Now think about this: wouldn't it be nice when 'interested parties' (i.e. other MC's in your Scene) could register themselves with *any* set of buttons they might be interested in? I know I like the idea.
This is where the Visitor Pattern comes in: you implement a few predefined function methods in your MC(s), then register it/them with all the buttons you want to get event notifications (press, release, dragover, etc.) from and off you go. Your MC knows what to do when button X is pressed (button X shouldn't know about what *you* want done!), so YOU handle the 'pressed' event of button X.
And you can now! Because you registered with button X, that button will play nice and send you each and every 'press' event it receives. (And any other events it receives too!)
And when another MC in your scene might want to 'do stuff' when button X is pressed, that MC too can register with button X. Now BOTH MC's will get those 'press' event notifications, and each 'do their stuff' *independently* of each other.
In short: buttons are not in the driver seat anymore. MC's are. And now those MC's don't only have onClipEvent() anymore! They've onBtnPress(), onBtnRelease(), etc. too!
Any feedback is much appreciated.
'Design Patterns' (Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, ISBN 0-201-63361-2) - OO designers/C++ coders will know what I'm talking about. Oh, it's chock-full with C++ code examples, btw.
SIDE NOTE: For those of you that like Marquis de Sade ghosting through your code: some of the lovelier C/C++ tricks work equally well in AS: check out the 'Object Actions' for the 'ExtraNotes' MC: the plain code translation is included in the comment. (A geek friend was visiting, wondering aloud why I would ever be touching Flash/AS, so I convinced him in 5 sec: "I can do this". "Oh, I suppose it's alright then". It sure is, pal...)
Keywords: function methods, onBtnPress, onBtnRelease, onBtnReleaseOutside, ...
Download FLA: ButtonVisitorPattern.zip
(Nov/2008) The MD5 Flash code has been upgraded to a class & package, suitable for use with Adobe Flash 9 / ActionScript 3.0. It is available as a separate download below (the old Flash 5 archive is still on-line as well for those who want/need that).
There has been a lot of trouble with MD5 in ActionScript on the Macintosh. To be more precise: any code using 32-bit unsigned integer arithmetic will very probably probably suffer from bugs in the Mac Flash player available today (10/Oct/2001).
Many thanks to Carlos Saenz and Branden Hall of Flashcoders to help track down all Mac trouble and help test all the test versions. Thanks to Carlos I can you present a MD5 cipher ActionScript implementation which works on both Macs and PCs.
If you want to check the result for your platform/system, click on the little image below to run the SWF.
LATEST UPDATE: Branden Hall tracked down part of the problem:
'&' does not work as expected on Macintosh if the integers
involved have bit 31 set (i.e. are negative). Search the
Flashcoders list for his solution.
I found the Mac Flash player also chokes on '|', '^' and '+' (OR, XOR and ADD) operations if bit31 is set. Apparently the criteria to make Mac Flash fail are even a bit more subtle: failures have been seen only if both input operands of said arithmetic operations have '1' bits in common, i.e. if both input operands have any bit N both set to '1', next to the requirement that at least one input operand has bit 31 set to '1', i.e. is negative.
This FLA+AS fixes all these issues: special code is included to prevent the Mac player from triggering the failing code.
NOTE: if you publish the SWF with trace enabled and remove the '//' comment marks before the trace() calls in MD5.AS, the calculation will be very slow due to the many diagnostic 'trace()' calls in the AS script.
Keywords: MD5, Macintosh bugs, '&' bitwise AND operator, '|' bitwise OR operator, '^' bitwise OR operator, '+' ADD operator
Download package source code + FLA for Flash 9 / ActionScript 3.0: md5.FL9-AS3.7z (.7z means this is a 7-zip archive)
Download FLA: md5.zip
After answering a question how Branden Hall's old puzzle worked, I got asked how I'd do this in Flash5. The basic setup of the game is here: the matrix is built, words are 'hidden' in the matrix (clearly marked though for this demo) and the code to mark letters to highlight the hidden words is included here too, including all necessary matching code to match marked 'words' with the ones in the 'good' list. No highscores, no 'You Won!', no Timeout period, nothing of the simple stuff ;-) is here. Just the puzzle core redone in Flash5 based on my own ideas how I'd go about doing such a game. The marking of the words and hiding the words without 'collisions' between them are the most complex parts of the game-code anyway.
Note: the method of marking words differs from Branden's game.
Keywords: attachMovie(), Array, hitTest(), mouse events
Download FLA: puzzle.zip
While talking to a graphics designer about the joys of math and computer/Flash Math in particular, the question "What the Hell is this sinus and cosinus stuff anyway?!" was raised. A few leafs of paper were spent on the following sermon, after which I refrained from continuing to wear out my pencil. What's Flash for anyway, I asked? So 6 hours were spent on creating this sinus/cosinus demo in Flash. It's got the works: Unity Circle, sinus and cosinus curve built on the fly, animated rotation of the radius and real-time display of sin/cos projections, etc. Comes with configurable rotation speed and curve 'trail' as added bonus.
Enjoy! (Hope you like it as much looking at it as I enjoyed creating it.)
Keywords: Math, sin, cos, increasing angles (à la Circle PreLoader)
Download FLA: SinCosProjection.zip
This was done as a basic element for a site proposal. The SWF shows a dynamic pie chart which 'tweens' according to periodically set percentages.
This Pie Chart MC accepts any number of segments (i.e. number of elements to show in the chart) and can either show a partial or a full pie chart ('partial' as in 'the total amount is less than 100%', 'full' as in a complete 100% pie).
Keywords: mask, _rotation, attachMovie(), pie chart
Download FLA: AnimatedPieChart.zip
LATE BREAKING NEWS:
This was done as the core menu system for a site design. The SWF shows a 3D menu-to-be which can be rotated using the mouse. This version cannot yet be used as a true menu system, but is used as a proof-of-concept to show people it can be done (though rather slowly).
Keywords: 3D graphics, Bermuda Triangle, attachMovie()
Download FLA: Pyramid Menu.rar
This was done as an attempt to answer a question in Flashcoders. The 'menu' consists of 6 buttons with a one-letter label each. When you click on a button, the 'menu' rotates so that the selected button is end up on the far left of the navigation bar.
The 'fun part' of the code is the section which takes care of the wrap-around. And the part which reports when the selected button has arrived at the far left position.
Hint: convert the mask layer inside the menuItemBase MC into a Guide layer (or delete the layer) to see the moves of the navigation bar: each menuitem (button) is replicated to make the 'smooth scrolling effect' work, just like the 'Panorama View' above.
Keywords: duplicateMovieClip(), smooth scrolling
Download FLA: navbar1.rar
A very preliminairy version of a (intended) generic XML/Flash-based presentation template. Don't bother with this if you find PowerPoint nicely suits your needs. If you want more, this might just be the idea ;-)
Anyway, have a peek and enjoy.
Keywords: presentation template
Download FLA: sample_presentation.rar (6 MByte!)
Go view the presentation here.
Download FLA: sample_presentation.rar (190 KByte, now with a few crappy shape tweens instead of a nice movie scene)
Go view the presentation (without the robot movie inside) here.
This is a port of the MT PRNG code to ActionScript.
Added bonus: the AS file also contains functions for regular high-speed LCG PRNG and a function to scale random values to a customer-specified range (instead of their default range). See the AS source code in the archive for more details.
Download FLA: Mersenne-Twister.rar
This is some basic encryption/decryption code using a secret key and a very basic (Caesarian Cipher-based) encryption method.
Note that both encrypted outputs are designed to be 'string-friendly' (i.e. do NOT contain " nor ' characters anywhere in the encrypted data stream) and XML-friendly (i.e. do NOT contain any of the < > [ ] characters either). The encrypted output will also only contain ASCII-printable characters in the standard ASCII 33 - ASCII 126 range for maximum cross-platform portability, independent of the character-range of the unencrypted input stream (for mode 1, mode 0 simply ONLY ENCRYPTS characters that are part of it's defined alphabet ('encrypt_these_chars' variable).
This one cannot compete with RC5 et al where encryption strengh is considered, but:
Note: Other (stronger) encryption methods may be added in the future, so you might want to check this space once in a while. ;-)
Also note that the AS code has not been optimized for speed. I intended to achieve maximum readability with this one.
Keywords: Encryption, Decryption
Download FLA + AS-code: EncryptionDecryption.rar
Sample usage: You may see many of these in use in the Flash presentation template above: XML:FLEM, swfQueue, String, HSV color
Keywords: XML:ACK XML:FLEM ACK pQueue swfQueue String HSV RGB
Download AS code: [ACK] ACK_enventEngine_ia1.zip
Download AS code: [XML:ACK] XML_ack_ia1.zip
Download AS code: [XML:FLEM] XML_flem_ia1.zip
Download AS code: [pQueue] pQueue_ia1.zip
Download AS code: [swfQueue] SWFqueue_ia1.zip
Download AS code: [String] string_ia1.zip
Download AS code: [HSV - RGB] HSVcolor_ia1.zip
Download AS code: [Array.sort] various_sort_implementations_ia1.zip
Download the compressed text file to add syntax highlighting for Flash (version 5) AS ActionScript files to the UltraEdit32 editor.
(Note: it's a work in progress: currently functions and events are located under the same header. Improvements are welcome here)
14/Oct/2001 13:44: Whoopsky! There is another Flash (version 4) syntax highlighting addition at: http://www.ultraedit.com/downloads/additional.html. Completely overlooked that one before. :-(
|Syntax Colouring 'Colour Group'||Colour|
Alternate block comments
Reddish black (or just black if you like that better)
Use the above colouring to (almost; numbers are different) resemble MM syntax colouring.
Keywords: UltraEdit32, Syntax Colouring
Download WORDFILE.TXT addition: wordfile.as.zip
Std. Disclaimer: I did it. Yep. Me, the fool said. (c) Copyright Gerrit E.G. 'Insh_Allah' Hobbelt and all that. Brand names used are copyright their respective owners etc. [ad nauseam] And if you feel like using the material presented here: be my guest. The only condition is you put my name somewhere in the 'credits'. Oh, and I almost forgot: zero guarantee, zero warranty. Unless you want to pet my head for doing a good job, of course. ;-)
Contact Info: firstname.lastname@example.org
Gerrit E.G. 'Insh_Allah' Hobbelt ('Ger' for friends) is a hacker (nope, not a cracker) turned Flash. He's also some sort of a local C guru (for want of a higher wizard in the neighbourhood), C++ dude and general bits-and-bytes addict. He has been messing around with almost any other available programming language and graphics software on the globe. No wonder the first thing he does when meeting Flash (version 5) is dig into Actionscript. This material is the result of a couple of weeks of long nights with MM manuals, Flash websites, Glen Deveron and various Van Wees products in absurd quantities. Let's see where this is heading, shall we...?
Ger is aged 39 and a Dutchman. As such he has been blessed with the mandatory knowledge regarding weed. Testing this theory is still on the ToDo list, alas. (I have to pick up the habit of smoking first, I guess.) His time is divided between work (designing and writing software), friends, computers and other fun. He lives in The Hague, the largest town in the Netherlands, Europe.