Skip to content

destroytoday/destroy-common

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DestroyCommon

Overview

This is a common library for AS3 development.

Invalidation

Using flags

With the InvalidationFlagManager, you can map methods to property flags and let the manager auto-call the methods.

protected var flagManager:IInvalidationFlagManager;
protected var sizeFlag:InvalidationFlag = new InvalidationFlag('size');
protected var colorFlag:InvalidationFlag = new InvalidationFlag('color');

protected function setup():void
{
	flagManager = new InvalidationFlagManager(this);

	flagManager.mapMethod(drawBackground, sizeFlag, colorFlag);	
}

public function set width(value:Number):void
{
	if (value == _width)
		return;

	_width = value;

	flagManager.invalidate(sizeFlag);
}

public function set height(value:Number):void
{
	if (value == _height)
		return;

	_height = value;

	flagManager.invalidate(sizeFlag);
}

public function set color(value:uint):void
{
	if (value == _color)
		return;

	_color = value;

	flagManager.invalidate(colorFlag);
}

protected function drawBackground():void
{
	// draw background
}

About

Common library for AS3 development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages