Показать сообщение отдельно
Старый 25.08.2011, 16:58
in4core вне форума Посмотреть профиль Отправить личное сообщение для in4core Найти все сообщения от in4core
  № 2  
Ответить с цитированием
in4core
 
Аватар для in4core

Регистрация: Mar 2009
Сообщений: 4,219
Записей в блоге: 14
Да делают именно так. вот пример с копирайтом

Код AS3:
package com.in4core.system 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.errors.IllegalOperationError;
	import flash.events.KeyboardEvent;
	import flash.filters.BlurFilter;
	import flash.geom.Matrix;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.ui.Keyboard;
	/**
	 * ...
	 * @author in4core
	 */
	public class _write 
	{
		private static var _instance:int = 0;
		private static var _word:String = null;
		private static var _inited:Boolean = false;
		private static var _obj:Stage = null;
		static private var _captured:Boolean = false;
		static private var _position:uint = 0;
		static private var _bdata:BitmapData = null;
		static private var _bitmap:Bitmap = null;
		static private var _container:Sprite = null;
		static private var _mat:Matrix = new Matrix();
		static private var _tf:TextField = new TextField();
 
		static private var _copy:String = 
 
		'Project created by <b><font color="#FFFFFF">In4Core</font></b> Development LLC.' +
		'\n\nAll Right Reserved.\n\n'+
		'Copyright (c) 2011';
 
		public static function writeWord ( word:String ) : void {
 
			_word = word.toLowerCase();
		}
 
		public static function readWord () : String {
 
			if (_word) return _word;
 
			return null;
		}
 
		public static function writeCopy ( obj:Stage ) : void {
 
			if (obj && _word.length > 3 ) _obj = obj , _generateCopy();
 
			else throw new IllegalOperationError ('error' , 1);
 
		}
 
		static private function _generateCopy() : void 
		{
			_inited = true;
 
			_obj.addEventListener ( KeyboardEvent.KEY_DOWN , _addKey, false , 0 , true);
		}
 
		static private function _addKey(e:KeyboardEvent) : void 
		{
			if (e.keyCode == Keyboard.ENTER && _captured )  {
 
				_showHint() ;
 
				return;
			}
 
			else if (e.charCode == _word.charCodeAt(_position)) {
 
				_position ++;
 
				if (_position == _word.length) {
 
					_captured = true;
				}
			}
 
			else _position = 0 , _captured = false;
 
		}
 
		static private function _showHint() : void 
		{
			trace('show');
 
			_obj.mouseChildren = false;
 
			_obj.removeEventListener ( KeyboardEvent.KEY_DOWN , _addKey , false );
 
			_obj.addEventListener ( KeyboardEvent.KEY_DOWN , _hide , false , 0 , true );
 
			_bdata = new BitmapData ( _obj.stageWidth , _obj.stageHeight , false , 0 );
 
			_bdata.draw ( _obj ); 
 
			_bitmap = new Bitmap ( _bdata ) ;
 
			_bitmap.filters = [ new BlurFilter ( 20, 20 , 3) ];
 
			_bitmap.x -= 20;
 
			_bitmap.y -= 20;
 
			_bitmap.width += 40;
 
			_bitmap.height += 40;
 
			_obj.addChildAt( _bitmap , _obj.numChildren );
 
			drawRect() ;
 
			_obj.addChild ( _container );
		}
 
		static private function _hide (e:KeyboardEvent) : void 
		{
			if (e.keyCode == Keyboard.ESCAPE ) {
 
				trace('hide');
 
				_clear();
 
				_generateCopy();
			}
		}
 
		public static function readCopy () : Boolean {
 
			if (_inited ) return true;
 
			return false;
		}
 
		private static function _clear() : void {
 
			_inited = false;
 
			_captured = false;
 
			_position = 0;
 
			_bdata = null;
 
			_obj.mouseChildren = true;
 
			if (_bitmap.parent) _obj.removeChild(_bitmap) , _bitmap = null;
 
			if (_container.parent) _container.removeChild(_tf) , _obj.removeChild(_container) , _container = null;
 
			_obj.removeEventListener ( KeyboardEvent.KEY_DOWN , _addKey , false );
 
			_obj.removeEventListener ( KeyboardEvent.KEY_DOWN , _hide , false );
		}
 
		private static function drawRect() : void {
 
			_mat.createGradientBox ( 250 , 140 , Math.PI / 2);
 
			_container = new Sprite();
			_container.graphics.beginGradientFill ( 'linear' , [0x454140,0],[1,1],[0,255], _mat )
			_container.graphics.drawRoundRect ( 0 , 0 , 250 , 140 , 20);
			_container.graphics.endFill();
			_container.graphics.beginFill ( 0xFFFFFF , 0.03 );
			_container.graphics.moveTo (0, 10);
			_container.graphics.curveTo(0, 0, 10, 0);
			_container.graphics.lineTo ( 240 , 0);
			_container.graphics.curveTo( 250, 0 , 250 , 10);
			_container.graphics.lineTo ( 250 , 130);
			_container.graphics.curveTo( 250 , 140 , 240 , 140);
			_container.graphics.curveTo( 125, 40, 0 , 10)
 
			_tf.textColor = 0x999999;
			_tf.htmlText = _copy;	
			_tf.selectable = false;
			_tf.antiAliasType = 'advanced';
			_tf.autoSize = 'left';
			_tf.setTextFormat(new TextFormat('_sans', 11, null, null, null, null, null, null, 'center'));
			_tf.x = _container.width / 2 - _tf.width / 2;
			_tf.y = _container.height / 2 - _tf.height / 2;
			_container.addChild(_tf);
 
			_container.x = _obj.stageWidth / 2 - _container.width / 2;
			_container.y = _obj.stageHeight / 2 - _container.height / 2;
 
		}
	}
}
Тут вам и размытие и холст ...
__________________
Марк Tween