I was not satisfied with the previous release of the scrollbar. It was too difficult to adapt and use, and it left very little space for upgrading.

So i made a new scrollbar class, with advanced features, with the precious help of Jack Kalish. Please stop by his site at www.kalicious.com, he was very helpful for this new version of the Scrollbar Class. Thanks Kali!

By the way. These are some of the new features.

  • It is now possible to use every movieclip on the stage as the components of the scrollbar. You are not forced anymore to give your object defined instance names. They can be whatever you want.
  • The class is now instantiated using the New Scrollbar constructor, that takes several parameters, leaves you more freedom and gives you the possibility to choose if you want the dragged movieclip to be blurred on dragging and the velocity of the movement.
  • The class now releases errors on init() if you did not declare the right components and tells you what components are missing.
  • The ruler (handler) length is now proportional to the length of the object dragged, as well as mousewheel velocity.

You do not need to instantiate the class by rightclick -> linkage, anymore.

The right way to use the class is now:

import Scrollbar;
var sc:Scrollbar = new Scrollbar(text, maskmc, scrollbar.ruler, scrollbar.background, area, true, 6);
sc.addEventListener(Event.ADDED, scInit);
addChild(sc);
function scInit(e:Event):void {
sc.init();
}

This is the example i made. As suggested by Kalish, i used a Input text to change runtime the length of the text box (to check for the change in the length of the scrollbar ruler)

And here you can download the class zip package, with an example inside.

Enjoy! And as usual, any comment is welcome!

I was in need of a subclass of MovieClip that could rewind and forward with a simple method call. That is the result. You can specify a callback function to call after the timeline playhead cease moving. It is very raw at the moment, i am still learning. Any suggestion or modification to the code is greatly appreciated.

package
{
	import flash.display.MovieClip;
	import flash.events.Event; 

	public class AdvancedMovieClip extends MovieClip {

		var dir:String = null;
		var _targetframe:Number;
		var _callback:Function = new Function();
		var _params:Object = null;
		var _numberOfFrames:Number; 

		public function AdvancedMovieClip():void {
			super();
			_numberOfFrames = this.totalFrames;
		}

		public function block() {
			removeEventListener(Event.ENTER_FRAME, enterframeHandler);
		}

		public function forward(targetframe:Number = 25, callback:Function = null, params:Object = null):void {
			dir = "forward";
			_callback = callback;
			_params = params;
			_targetframe = (targetframe == 25) ? this.totalFrames : targetframe;
			addEventListener(Event.ENTER_FRAME, enterframeHandler);
		}

		public function backward(targetframe:Number = 1, callback:Function = null, params:Object = null):void {
			dir = "backward";
			_callback = callback;
			_params = params;
			_targetframe = (targetframe == 1) ? 1 : targetframe;
			addEventListener(Event.ENTER_FRAME, enterframeHandler);
		}

		private function enterframeHandler(e:Event):void {
			switch(dir) {
				case "forward":
				((this.currentFrame == this.totalFrames) || (this.currentFrame == _targetframe)) ? (stopMovement()) : this.nextFrame();
				break;
				case "backward":
				((this.currentFrame == 1) || (this.currentFrame == _targetframe)) ? (stopMovement()) : this.prevFrame();
				break;
			}
		}	

		private function stopMovement() {
			removeEventListener(Event.ENTER_FRAME, enterframeHandler);
			if (_callback != null) {
				_callback(_params);
			}
		}

	}

}

Tutorials

Hey all
this are the tutorials i wrote up to now. Please click on the link to read them. Some are just in italian. Some others are in english. I hope you can find them useful. And please, let comments to share every doubt or request!

See you!

  1. Flint Particle System AS3 : How to (in italian)
  2. Flint Particle System AS3 : Creating a simple Starfield
  3. AS2 Gamemaker - 01 - Introduction
  4. AS2 Gamemaker - 02 - Controlling : Mouse Events
  5. AS2 Gamemaker - 03 - Controlling : Keyboard Events
  6. AS2 Gamemaker - 04 - Game Cycle : The basics
  7. AS2 Gamemaker - 05 - Game Cycle : Game programming

Here’s an actionscript class that adds methods to the normal MovieClip Flash class.

It’s very useful and adds some features that really make your life easier.
At least they help mine!

New methods are:

function forward(callback, parameters);
execute timeline forward and then call the callback function passing the parameters.

function rewind(callback, parameters);
execute timeline backward and then call the callback function passing the parameters.

function forwardTo(frame,callback, parameters);
execute timeline forward to the specified frame and then call the callback function passing the parameters.

function rewindTo(frame, callback, parameters);
execute timeline backward to the specified frame and then call the callback function passing the parameters.

function forcedStop();
ends the execution of one of the above methods, without calling the callback function.

function goTo(frame, callback, parameters);
execute timeline in the right sense to reach the desired frame and then call the callback function passing the parameters.

function glow(color, alpha, blurX, blurY, forza, qualita, inner, knockout);
adds a glow effect to the object with the given parameters

function unglow();
remove the created glow.

function sendToBack():Void
function bringToFront():Void
function sendBackward():Void
function bringForward():Void

methods to manage the depths more easily in actionscript.

and others.

Every comment is well accepted!

» Download advMovieClip Class (advMC.zip)