ActionScript 3.0 Classes
MediaPackage
This is an AS3 SWC Library package for handling Video playback and audio controls. The main idea behind creating this library was to have a full fledged video player much like the Flash FLV Player where you can have a many or as little controls for the end user and all the playback functionality is already coded for you. The problem with the Flash FLV Player is that it can’t be skinned easily with your own assets, you have to remember to include the extra swf file it needs for the controls, and it can’t play other formats that the Flash Player supports like mp4, mov, etc. With this set of tools, you can easily do just that. All the functionality is taken care of and all you have to do is provide the assets, the video, and do a little bit of code to get it started. The Flash Player can play files that are mp4, m4v, mov but only if the video codec is H.264. In this zip download, I have provided a CS4 FLA example file showing some of the uses this library has, a video tutorial I did a long time ago for CS3/4 users, and ASDoc documentation for reference. This media library should be able to work on any version of the Flash Player that uses ActionScript 3, which 9 and up. This is an in-progress library, so if there are any errors or issues you come across, please let me know.
This is a Flash specific class for those who don’t really know ActionScript. This class is one that you attach to a MovieClip that you are using as a button. The idea with this class is you rollover a MovieClip object and it plays an animation, and when you roll off of it, it plays the animation in reverse. To attach this class to your MovieClip, open the Library and right-click on the desired MovieClip and choose “Properties…”, then check the “Export for ActionScript” box. Lastly in the “Class” input field, type in AnimatedRollOver and click OK. The one thing you need to make sure you do is have this class file in the same location as your FLA.
This class is a very basic one. It’s a TextField class that has a TextFormat built into it. The idea is to be able to create TextFields the same way you normally do, but don’t have to create a TextFormat object just to change the size, color, font, etc and be able to do those properties without having to use the htmlText property as well.
This class is a replacement for the Flash ScrollBar Component. If you have ever used the ScrollBar component in Flash, you know that its just for TextFields and it sucks. The TextField has to already have content flowing beyond the width/height of the TextField for it to work and if the TextField starts with no text and eventually builds up enough text to go beyond the widht/height of the TextField, the ScrollBar still won’t work. So it’s most likely intended for use of designers, but we developers want some love too. So here is a replacement class for that where you can use your own visual thumb and track to scroll a TextField. Right now its meant just for vertical scrolling text.
Just like my TextScrollBar, this is a basic scroll bar for content in Flash except this is for any content that needs to be scrolled and not just text. So if you are making something that contains text, images, and video that is all together in the same scrollable container, then this is for you. Currently, I have it set up to only do vertical scrolling because I haven’t made any projects that needed a horizontal scroll bar. But just like the TextScrollBar, if you wanted to modify it to work for or include a horizontal scroll functionality, you can easily do so. This ScrollBar class utilizes: Jack Doyle’s Tweening Platform v11 for the tweening animations(when present), Ali Rantakari’s ExternalMouseWheelSupport for mouse wheel scrolling in the web browser, and Liam O’Donnell’s MouseWheelTrap so that the mouse wheel scrolling functionality can remain even when the browser window has its own active scroll bar.
The main idea behind the ContextMenuSetup class was to have an easy way of adding in web/email links in the right click menu or just adding a blank entry to the context menu, such as a copyright notice or something like that. I’m sure that if one wanted, it could easily be modified to do so much more like having a play/pause toggle for video playback or something more complex than a web link.
This is class with static methods used for doing calculations so you don’t have to write all the code out for it just to get a quick value. The methods include: randomByRange(returns a random number between two number values you provide), getDistanceByPoints(takes on two numbers and gets the distance between to the two numbers), getDistanceByObjects(takes two objects that have an assumed X and Y property and returns the distance between the two X’s and two Y’s), calculateVector(takes on two X and two Y values and returns an object with the X Vector, Y Vector, angle, radian, and magnitude), and lastly traceFonts(traces to the Output Window the currently embedded Fonts in the SWF)
A Better Batch Publisher is an Adobe extension developed for Flash CS3(also works with CS4/CS5) by Greg Ferrell. This extension allows you to select a folder of FLA’s to publish, lets you pick if you want to publish the SWF only, use the individual FLA’s publish settings, or pick a new directory to publish the SWF to. This is an amazing time saver if you are working in large scale projects that have to have multiple FLA’s. I can no longer find the creators website or original source location, so I am providing it here because I believe it to be an awesome resource to have for Flash.