顯示具有 Tweener 標籤的文章。 顯示所有文章
顯示具有 Tweener 標籤的文章。 顯示所有文章

2011年1月7日 星期五

[AS3][PV3D][Tweener] pv3dWorld_2 - 使用MovieMaterial材質、內嵌資源類別,Loader + ProgressEvent 逐檔百分比載入外部點陣圖


1000103_pv3dWorld_2.swf

2011年1月5日 星期三

[AS3][Tweener] _bezier - 延著貝茲曲線路徑移動(三) - 亂數產生複數個曲線點,循環播放


1000105_Tweener_CurveModifiers_bezier_3.swf




import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;
import flash.geom.Point;

CurveModifiers.init();

//
var pointNum:int = 6;
var ranX:int;
var ranY:int;
var obj:Object = new Object();
var myPath:Array = new Array();
var _mc:MovieClip = new MovieClip();
var endX:int;
var endY:int;

//
function run():void{
 makeCircle();
 addPoint();
 
}
run();

//
function makeCircle():void{
 //
 with (_mc.graphics)
 {
  beginFill(0xffff00, 1);
  var startX:int = Math.floor(Math.random()*stage.stageWidth/4);
  var startY:int = Math.floor(Math.random()*stage.stageHeight/4);
  var radius:int = Math.floor(Math.random()*30)+10;
  drawCircle(startX ,startY ,radius);
  endFill();
 }
 //
 addChild(_mc);
 _mc.scaleX = 1;
 _mc.scaleY = 1;
}

//
function addPoint():void{
 //
 for(var i:int=0; i < pointNum; i++){
  ranX = Math.floor(Math.random()*stage.stageWidth/1.4);
  ranY = Math.floor(Math.random()*stage.stageHeight/1.4);
  obj = {x:ranX, y:ranY};
  trace("obj.x=" + obj.x + " ; " + "obj.y=" + obj.y);
  myPath.push(obj);
 }
 trace("----------------------------------------");
 //
 endX = Math.floor(Math.random()*stage.stageWidth/4);
 endY = Math.floor(Math.random()*stage.stageHeight/4);
 tween_1();
}

//
function tween_1():void
{
 var scaleXY:Number = Math.floor(Math.random()*3) + 0.3;
 Tweener.addTween(_mc,
 {
 x:endX,
 y:endY, 
 //******將myPath陣列指定給_bezier
 _bezier:myPath,
 delay:0.5,
 time:8,
 scaleX:scaleXY,
 scaleY:scaleXY,
 transition:"easeInOutQuint",
 onComplete:popArr
 }
 );
}

//
function popArr():void{
 for(var i:int=0; i < myPath.length; i++){
  myPath.pop();
 }
 addPoint();
}

//
addChild(click_mc);
click_mc.buttonMode = true;
click_mc.flag = true;
click_mc.addEventListener(MouseEvent.CLICK, removeBall);
function removeBall(e:MouseEvent):void{
 popArr();
}

[AS3][Tweener] _bezier - 延著貝茲曲線路徑移動(二) - 複數個曲線點

1000105_Tweener_CurveModifiers_bezier_1.swf




import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;
CurveModifiers.init();

//
var _mc:MovieClip = new MovieClip();
with (_mc.graphics)
{
 beginFill(0xffff00, 1);
 drawCircle(20,20,18);
 endFill();
}
addChild(_mc);

//
tween_1();
//
function tween_1():void
{
 Tweener.addTween(_mc,
 {
 x:480,
 y:100, 
 _bezier:[{x:150, y:350}, {x:350, y:100}, {x:280, y:330}, {x:100, y:200}],
 delay:0.5,
 time:2,
 scaleX:2,
 scaleY:2,
 transition:"easeInOutQuint",
 onComplete:tween_2
 }
 );
}

//
function tween_2():void
{
 Tweener.addTween(_mc,
 {
 x:30,
 y:30, 
 _bezier:[{x:150, y:350}, {x:350, y:100}, {x:280, y:330}],
 delay:0.5,
 time:3,
 scaleX:1,
 scaleY:1,
 transition:"easeInOutQuint",
 onComplete:tween_1
 }
 );
}

addChild(click_mc);
click_mc.buttonMode = true;
click_mc.flag = true;
click_mc.addEventListener(MouseEvent.CLICK, removeBall);
function removeBall(e:MouseEvent):void{
 if(click_mc.flag){
  removeChild(_mc);
  click_mc.flag = false;
 }else{
  addChild(_mc);
  click_mc.flag = true;
 }
 
}






//******將複數個曲線點存入myPath陣列,做為貝茲的路徑
1000105_Tweener_CurveModifiers_bezier_2.swf




import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;
CurveModifiers.init();

//
var _mc:MovieClip = new MovieClip();
with (_mc.graphics)
{
 beginFill(0xffff00, 1);
 drawCircle(20,20,18);
 endFill();
}
addChild(_mc);

//******將複數個曲線點存入myPath陣列,做為貝茲的路徑
var myPath:Array = new Array();
myPath.push({x:150, y:350});
myPath.push({x:100, y:200});
myPath.push({x:280, y:330});
myPath.push({x:300, y:20});
myPath.push({x:350, y:50});

//
tween_1();
//
function tween_1():void
{
 Tweener.addTween(_mc,
 {
 x:480,
 y:100, 
 //******將myPath陣列指定給_bezier
 _bezier:myPath,
 delay:0.5,
 time:3,
 scaleX:2,
 scaleY:2,
 transition:"easeInOutQuint",
 onComplete:tween_2
 }
 );
}

//
function tween_2():void
{
 Tweener.addTween(_mc,
 {
 x:30,
 y:30, 
 _bezier:[{x:150, y:350}, {x:350, y:100}, {x:280, y:330}],
 delay:0.5,
 time:3,
 scaleX:1,
 scaleY:1,
 transition:"easeInOutQuint",
 onComplete:tween_1
 }
 );
}

addChild(click_mc);
click_mc.buttonMode = true;
click_mc.flag = true;
click_mc.addEventListener(MouseEvent.CLICK, removeBall);
function removeBall(e:MouseEvent):void{
 if(click_mc.flag){
  removeChild(_mc);
  click_mc.flag = false;
 }else{
  addChild(_mc);
  click_mc.flag = true;
 }
 
}


[AS3][Tweener] Special property class_FilterShortcuts_GrowFilter

1000104_Tweener_FilterShortcuts_GlowFilter_1.swf




import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();

//
click_mc.addEventListener(MouseEvent.ROLL_OVER, onEventRollOver);
click_mc.addEventListener(MouseEvent.ROLL_OUT, onEventRollOut);
//
function onEventRollOver(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:2.5,
  scaleY:2.5,
  //
  _Glow_alpha:0.5,
  _Glow_blurX:120,
  _Glow_blurY:120,
  _Glow_color:0xffff88,
  //_Glow_color_r:255,
  //_Glow_color_g:255,
  //_Glow_color_b:255,
  //_Glow_inner:true,
  //_Glow_knockout:true,
  _Glow_quality:6,
  _Glow_strength:4,
  //
  time   :2,
  transition :"easeOutExpo"
 });
}
//
function onEventRollOut(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:1.7,
  scaleY:1.7,
  //
  _Glow_alpha:0.5,
  _Glow_blurX:90,
  _Glow_blurY:90,
  _Glow_color:0xffff99,
  //_Glow_color_r:255,
  //_Glow_color_g:255,
  //_Glow_color_b:255,
  //_Glow_inner:true,
  //_Glow_knockout:true,
  _Glow_quality:6,
  _Glow_strength:4,
  //
  time   :2,
  transition :"easeOutExpo",
  onComplete:nextTween
 });
}
//
function nextTween():void{
 Tweener.addTween(click_mc,
 {
  scaleX:1.2,
  scaleY:1.2,
  //
  _Glow_alpha:0.6,
  _Glow_blurX:120,
  _Glow_blurY:120,
  _Glow_color:0xffff88,
  //_Glow_color_r:255,
  //_Glow_color_g:255,
  //_Glow_color_b:255,
  //_Glow_inner:true,
  //_Glow_knockout:true,
  _Glow_quality:8,
  _Glow_strength:5,
  //
  delay:0.5,
  time   :1,
  transition :"easeOutExpo"
 });
}








1000104_Tweener_FilterShortcuts_GlowFilter_2.swf




import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();

//
click_mc.addEventListener(MouseEvent.ROLL_OVER, onEventRollOver);
click_mc.addEventListener(MouseEvent.ROLL_OUT, onEventRollOut);
//
function onEventRollOver(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:2.5,
  scaleY:2.5,
  rotationX:180,
  rotationY:180,
  rotationZ:180,
  //
  _Glow_alpha:0.5,
  _Glow_blurX:120,
  _Glow_blurY:120,
  _Glow_color:0xffff88,
  //_Glow_color_r:255,
  //_Glow_color_g:255,
  //_Glow_color_b:255,
  //_Glow_inner:true,
  //_Glow_knockout:true,
  _Glow_quality:6,
  _Glow_strength:4,
  //
  time   :2,
  transition :"easeOutExpo"
 });
}
//
function onEventRollOut(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:1.7,
  scaleY:1.7,
  //
  _Glow_alpha:0.5,
  _Glow_blurX:90,
  _Glow_blurY:90,
  _Glow_color:0xffff99,
  //_Glow_color_r:255,
  //_Glow_color_g:255,
  //_Glow_color_b:255,
  //_Glow_inner:true,
  //_Glow_knockout:true,
  _Glow_quality:6,
  _Glow_strength:4,
  //
  time   :2,
  transition :"easeOutExpo",
  onComplete:nextTween
 });
}
//
function nextTween():void{
 Tweener.addTween(click_mc,
 {
  scaleX:1.2,
  scaleY:1.2,
  rotationX:360,
  rotationY:360,
  rotationZ:360,
  //
  _Glow_alpha:0.6,
  _Glow_blurX:120,
  _Glow_blurY:120,
  _Glow_color:0xffff88,
  //_Glow_color_r:255,
  //_Glow_color_g:255,
  //_Glow_color_b:255,
  //_Glow_inner:true,
  //_Glow_knockout:true,
  _Glow_quality:8,
  _Glow_strength:5,
  //
  delay:0.5,
  time   :2,
  transition :"easeOutExpo"
 });
}


2011年1月4日 星期二

[AS3][Tweener] Special property class_FilterShortcuts_GradientBevelFilter

Tweener Documentation_Special property class__●FilterShortcuts
GradientBevelFilter 有三個屬性目前不能使用,但也許後續能再度支援。

1000104_Tweener_FilterShortcuts_GradientBevelFilter_1.swf




import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();

//
click_mc.addEventListener(MouseEvent.ROLL_OVER, onEventRollOver);
click_mc.addEventListener(MouseEvent.ROLL_OUT, onEventRollOut);
//
function onEventRollOver(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:2.5,
  scaleY:2.5,
  _GradientBevel_angle:300,
  _GradientBevel_blurX:15,
  _GradientBevel_blurY:15,
  _GradientBevel_distance:20,
  _GradientBevel_quality:1,
  _GradientBevel_strength:4,
  //_GradientBevel_type:"inner",
  //
  _DropShadow_alpha:0.25,
  _DropShadow_angle:120,
  _DropShadow_blurX:80,
  _DropShadow_blurY:80,
  _DropShadow_color:0x222222,
  _DropShadow_distance:20,
  _DropShadow_quality:1,
  _DropShadow_strength:2,
  //_DropShadow_hideObject:true,
  _DropShadow_inner:false,
  //_DropShadow_knockout:true,
  //
  time   :2,
  transition :"easeOutExpo"
 });
}
//
function onEventRollOut(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:1.7,
  scaleY:1.7,
  //
  _GradientBevel_angle:120,
  _GradientBevel_blurX:40,
  _GradientBevel_blurY:40,
  _GradientBevel_distance:40,
  _GradientBevel_quality:1,
  _GradientBevel_strength:3,
  //_GradientBevel_type:"inner",
  //
  _DropShadow_alpha:0.25,
  _DropShadow_angle:120,
  _DropShadow_blurX:40,
  _DropShadow_blurY:40,
  _DropShadow_color:0x222222,
  _DropShadow_distance:20,
  _DropShadow_quality:1,
  _DropShadow_strength:2,
  //_DropShadow_hideObject:true,
  _DropShadow_inner:false,
  //_DropShadow_knockout:true,
  //
  time   :2,
  transition :"easeOutExpo",
  onComplete:nextTween
 });
}
//
function nextTween():void{
 Tweener.addTween(click_mc,
 {
  scaleX:1.2,
  scaleY:1.2,
  //
  _GradientBevel_angle:240,
  _GradientBevel_blurX:10,
  _GradientBevel_blurY:10,
  _GradientBevel_distance:10,
  _GradientBevel_quality:1,
  _GradientBevel_strength:4,
  //_GradientBevel_type:"inner",
  //
  _DropShadow_alpha:0.3,
  _DropShadow_angle:120,
  _DropShadow_blurX:40,
  _DropShadow_blurY:40,
  _DropShadow_color:0x222222,
  _DropShadow_distance:8,
  _DropShadow_quality:1,
  _DropShadow_strength:3,
  //_DropShadow_hideObject:true,
  _DropShadow_inner:false,
  //_DropShadow_knockout:true,
  //
  delay:0.5,
  time   :1,
  transition :"easeOutExpo"
 });
}

[AS3][Tweener] Special property class_FilterShortcuts_DrapShadowFilter

Tweener Documentation_Special property class__●FilterShortcuts


1000104_Tweener_FilterShortcuts_DropShadowFilter_1.swf




import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();

//
click_mc.addEventListener(MouseEvent.ROLL_OVER, onEventRollOver);
click_mc.addEventListener(MouseEvent.ROLL_OUT, onEventRollOut);
//
function onEventRollOver(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:2.5,
  scaleY:2.5,
  _DropShadow_alpha:0.3,
  _DropShadow_angle:60,
  _DropShadow_blurX:10,
  _DropShadow_blurY:10,
  _DropShadow_color:0x222222,
  _DropShadow_distance:15,
  _DropShadow_quality:1,
  _DropShadow_strength:3,
  //_DropShadow_hideObject:true,
  _DropShadow_inner:true,
  //_DropShadow_knockout:true,
  //
  time   :2,
  transition :"easeOutExpo"
 });
}
//
function onEventRollOut(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:1.5,
  scaleY:1.5,
  _Bevel_angle:320, 
  _Bevel_blurX:15, 
  _Bevel_blurY:15, 
  _Bevel_distance:8, 
  //
  _Bevel_highlightColor:0xffffff, 
  _Bevel_highlightAlpha:1, 
  
  _Bevel_knockout:false, 
  _Bevel_quality:2, 
  //
  _Bevel_shadowColor:0x000000, 
  _Bevel_shadowAlpha:1, 
  
  _Bevel_strength:1, 
  _Bevel_type:"inner", 
  //
  time   :2,
  transition :"easeOutExpo",
  onComplete:nextTween
 });
}
//
function nextTween():void{
 Tweener.addTween(click_mc,
 {
  scaleX:1,
  scaleY:1,
  _Bevel_angle:0, 
  _Bevel_blurX:0, 
  _Bevel_blurY:0, 
  _Bevel_distance:0, 
  //
  _Bevel_highlightColor:0xffffff, 
  _Bevel_highlightAlpha:0.6, 
  
  _Bevel_knockout:false, 
  _Bevel_quality:2, 
  //
  _Bevel_shadowColor:0x000000, 
  _Bevel_shadowAlpha:0.6, 
  
  _Bevel_strength:0, 
  _Bevel_type:"inner", 
  //
  delay:0.5,
  time   :1,
  transition :"easeOutExpo"
 });
}





1000104_Tweener_FilterShortcuts_DropShadowFilter_2.swf




import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();

//
click_mc.addEventListener(MouseEvent.ROLL_OVER, onEventRollOver);
click_mc.addEventListener(MouseEvent.ROLL_OUT, onEventRollOut);
//
function onEventRollOver(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:2.5,
  scaleY:2.5,
  _DropShadow_alpha:0.3,
  _DropShadow_angle:120,
  _DropShadow_blurX:20,
  _DropShadow_blurY:20,
  _DropShadow_color:0x222222,
  _DropShadow_distance:30,
  _DropShadow_quality:1,
  _DropShadow_strength:4,
  //_DropShadow_hideObject:true,
  _DropShadow_inner:true,
  //_DropShadow_knockout:true,
  //
  time   :2,
  transition :"easeOutExpo"
 });
}
//
function onEventRollOut(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:1.7,
  scaleY:1.7,
  _DropShadow_alpha:0.3,
  _DropShadow_angle:20,
  _DropShadow_blurX:10,
  _DropShadow_blurY:10,
  _DropShadow_color:0x222222,
  _DropShadow_distance:15,
  _DropShadow_quality:1,
  _DropShadow_strength:3,
  //_DropShadow_hideObject:true,
  //_DropShadow_inner:true,
  //_DropShadow_knockout:true,
  //
  time   :2,
  transition :"easeOutExpo",
  onComplete:nextTween
 });
}
//
function nextTween():void{
 Tweener.addTween(click_mc,
 {
  scaleX:1.2,
  scaleY:1.2,
  _DropShadow_alpha:0.3,
  _DropShadow_angle:320,
  _DropShadow_blurX:10,
  _DropShadow_blurY:10,
  _DropShadow_color:0x222222,
  _DropShadow_distance:10,
  _DropShadow_quality:1,
  _DropShadow_strength:3,
  //_DropShadow_hideObject:true,
  //_DropShadow_inner:true,
  //_DropShadow_knockout:true,
  //
  delay:0.5,
  time   :1,
  transition :"easeOutExpo"
 });
}





1000104_Tweener_FilterShortcuts_DropShadowFilter_3.swf




import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();

//
click_mc.addEventListener(MouseEvent.ROLL_OVER, onEventRollOver);
click_mc.addEventListener(MouseEvent.ROLL_OUT, onEventRollOut);
//
function onEventRollOver(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:2.5,
  scaleY:2.5,
  _DropShadow_alpha:0.2,
  _DropShadow_angle:120,
  _DropShadow_blurX:40,
  _DropShadow_blurY:40,
  _DropShadow_color:0x222222,
  _DropShadow_distance:40,
  _DropShadow_quality:1,
  _DropShadow_strength:1.5,
  //_DropShadow_hideObject:true,
  _DropShadow_inner:false,
  //_DropShadow_knockout:true,
  //
  time   :2,
  transition :"easeOutExpo"
 });
}
//
function onEventRollOut(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:1.7,
  scaleY:1.7,
  _DropShadow_alpha:0.25,
  _DropShadow_angle:120,
  _DropShadow_blurX:40,
  _DropShadow_blurY:40,
  _DropShadow_color:0x222222,
  _DropShadow_distance:20,
  _DropShadow_quality:1,
  _DropShadow_strength:2,
  //_DropShadow_hideObject:true,
  _DropShadow_inner:false,
  //_DropShadow_knockout:true,
  //
  time   :2,
  transition :"easeOutExpo",
  onComplete:nextTween
 });
}
//
function nextTween():void{
 Tweener.addTween(click_mc,
 {
  scaleX:1.2,
  scaleY:1.2,
  _DropShadow_alpha:0.3,
  _DropShadow_angle:120,
  _DropShadow_blurX:40,
  _DropShadow_blurY:40,
  _DropShadow_color:0x222222,
  _DropShadow_distance:8,
  _DropShadow_quality:1,
  _DropShadow_strength:3,
  //_DropShadow_hideObject:true,
  _DropShadow_inner:false,
  //_DropShadow_knockout:true,
  //
  delay:0.5,
  time   :1,
  transition :"easeOutExpo"
 });
}


[AS3][Tweener] Special property class_FilterShortcuts_BevelFilter

Tweener Documentation_Special property class__●FilterShortcuts


1000104_Tweener_FilterShortcuts_BevelFilter_1.swf




import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();

//
click_mc.addEventListener(MouseEvent.ROLL_OVER, onEventRollOver);
click_mc.addEventListener(MouseEvent.ROLL_OUT, onEventRollOut);
//
function onEventRollOver(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:1.8,
  scaleY:1.8,
  _Bevel_angle:60, 
  _Bevel_blurX:15, 
  _Bevel_blurY:15, 
  _Bevel_distance:10, 
  //
  _Bevel_highlightColor:0xffffff, 
  _Bevel_highlightAlpha:1, 
  
  _Bevel_knockout:false, 
  _Bevel_quality:2, 
  //
  _Bevel_shadowColor:0x000000, 
  _Bevel_shadowAlpha:0.8, 
  
  _Bevel_strength:1.5, 
  _Bevel_type:"inner", 
  //
  time   :2,
  transition :"easeOutExpo"
 });
}
//
function onEventRollOut(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  scaleX:1.5,
  scaleY:1.5,
  _Bevel_angle:320, 
  _Bevel_blurX:15, 
  _Bevel_blurY:15, 
  _Bevel_distance:8, 
  //
  _Bevel_highlightColor:0xffffff, 
  _Bevel_highlightAlpha:1, 
  
  _Bevel_knockout:false, 
  _Bevel_quality:2, 
  //
  _Bevel_shadowColor:0x000000, 
  _Bevel_shadowAlpha:1, 
  
  _Bevel_strength:1, 
  _Bevel_type:"inner", 
  //
  time   :2,
  transition :"easeOutExpo",
  onComplete:nextTween
 });
}
//
function nextTween():void{
 Tweener.addTween(click_mc,
 {
  scaleX:1,
  scaleY:1,
  _Bevel_angle:0, 
  _Bevel_blurX:0, 
  _Bevel_blurY:0, 
  _Bevel_distance:0, 
  //
  _Bevel_highlightColor:0xffffff, 
  _Bevel_highlightAlpha:0.6, 
  
  _Bevel_knockout:false, 
  _Bevel_quality:2, 
  //
  _Bevel_shadowColor:0x000000, 
  _Bevel_shadowAlpha:0.6, 
  
  _Bevel_strength:0, 
  _Bevel_type:"inner", 
  //
  delay:0.5,
  time   :1,
  transition :"easeOutExpo"
 });
}



看看以下屬性說明
/*
Tweener.addTween(e.currentTarget,
{
_Bevel_angle:60, //The angle of the effect, in degrees. A number from 0 to 360.
_Bevel_blurX:15, //The amount of horizontal blur, in pixels. A number from 0 to 255.
_Bevel_blurY:15, //The amount of vertical blur, in pixels. A number from 0 to 255.
_Bevel_distance:10, //The offset distance of the effect, in pixels. Any number.
//
_Bevel_highlightColor:0xffffff, //The highlight color of the bevel. Any color formatted as a number (for example, 0xffgg33).
_Bevel_highlightAlpha:1, //The alpha transparency value of the highlight color. A number from 0 to 1.

_Bevel_knockout:false, //If true, applies a knockout effect, which effectively makes the object's fill transparent and reveals the background color of the document. true or false.
_Bevel_quality:2, //The quality of the filter, which means the number of times to apply it to the object. A number from 0 (low quality) to 1 (medium quality) and above.
//
_Bevel_shadowColor:0x000000, //The shadow color of the bevel. Any color formatted as a number (for example, 0xffgg33).
_Bevel_shadowAlpha:0.8, //The alpha transparency value of the shadow color. A number from 0 to 1.

_Bevel_strength:2, //The strength of the imprint or spread. A number from 0 to 255.
_Bevel_type:"inner", //The placement of the filter effect on the object. "inner", "outer", "full"
//
time   :2,
transition :"easeOutExpo"
});

*/

[AS3][Tweener] Special property class_FilterShortcuts_BlurFilter

Tweener Documentation_Special property class__●FilterShortcuts

1000104_Tweener_FilterShortcuts_BlurFilter_1.swf




import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();

//
click_mc.addEventListener(MouseEvent.ROLL_OVER, onEventRollOver);
click_mc.addEventListener(MouseEvent.ROLL_OUT, onEventRollOut);
//
function onEventRollOver(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  _Blur_blurX :60,
  //_Blur_blurY :60,
  time   :1,
  transition :"easeOutExpo"
 });
}
//
function onEventRollOut(e:MouseEvent = null):void{
 Tweener.addTween(e.currentTarget,
 {
  _Blur_blurX :0,
  _Blur_blurY :60,
  time   :1,
  transition :"easeOutExpo",
  onComplete:nextTween
 });
}
//
function nextTween():void{
 Tweener.addTween(click_mc,
 {
  _Blur_blurX :0,
  _Blur_blurY :0,
  delay   :0.3,
  time   :1,
  transition :"easeOutExpo"
 });
}

2010年12月27日 星期一

Tweener●_bezier - 延著貝茲曲線路徑移動




import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;

CurveModifiers.init();

//
var _mc:MovieClip = new MovieClip();
with (_mc.graphics)
{
 beginFill(0xddaa00, 1);
 drawCircle(20,20,36);
 endFill();
}
addChild(_mc);

//
tween_1();
//
function tween_1():void
{
 Tweener.addTween(_mc,
 {
 x:480,
 y:100, 
 _bezier:{x:250, y:600},
 delay:0.5,
 time:1.5,
 scaleX:1.5,
 scaleY:1.5,
 transition:"easeInOutQuint",
 onComplete:tween_2
 }
 );
}

//
function tween_2():void
{
 Tweener.addTween(_mc,
 {
 x:30,
 y:30, 
 _bezier:{x:300, y:400},
 delay:0.5,
 time:3,
 scaleX:1,
 scaleY:1,
 transition:"easeInOutQuint",
 onComplete:tween_1
 }
 );
}

addChild(click_mc);
click_mc.buttonMode = true;
click_mc.flag = true;
click_mc.addEventListener(MouseEvent.CLICK, removeBall);
function removeBall(e:MouseEvent):void{
 if(click_mc.flag){
  removeChild(_mc);
  click_mc.flag = false;
 }else{
  addChild(_mc);
  click_mc.flag = true;
 }
 
}

2010年12月1日 星期三

[AS3] 指定類別檔路徑 - 以下載及設置Tweener類別庫為例

以下載及設置Tweener類別庫為例:

●Tweener Project 的 URL:
http://code.google.com/p/tweener/



●tweener_1_33_74_as3.zip 下載Link
http://code.google.com/p/tweener/downloads/detail?name=tweener_1_33_74_as3.zip



●下載 tweener_1_33_74_as3.zip 回來後解壓縮出來為一個 caurina目錄,Tweener的類別檔都在裡面。


●使用類別庫之前,打開Flash軟體,做一些設定

  1. 在電腦檔案系統任一處開一個目錄,命名為Classes (或其它名稱),將下載回來解壓縮得到的caurina資料夾整個擲入 Classes目錄。
  2. 以Flash CS3為例,叫出編輯功能表 / 偏好設定 (或CTRL+U),點選左側ActionScript選項,在右側[語言]選項,點選 [ActionScript 3.0設定]按鈕。


  3. 跳出[ActionScript 3.0設定]面板,點擊下圖標示的[瀏覽到路徑]按鈕,指向Classes目錄,陸續按下確定鈕,就設定好類別檔路徑。每當於ActionScript中import某些Classes目錄中的類別時,Flash將會前往此指定路徑搜尋類別檔。



2010年11月30日 星期二

[AS3] 亂數隨機載入外部圖檔(輪播)_每一輪不重覆

外部有6個圖檔,依亂數載入。同一輪已載入過的就不再載入。第1輪播完再播第2輪......



//991228從991130_randomPhoto_1.fla修改

import flash.display.MovieClip;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.text.TextField;
import flash.text.TextFormat;
//載入Tweener、ColorShortcuts類別
//請至以下URL下載tweener類別程式庫與說明文件
//http://code.google.com/p/tweener/
import caurina.transitions.Tweener;
import caurina.transitions.properties.ColorShortcuts;
//初始化ColorShortcuts
ColorShortcuts.init();

//****** photo陣列 - push() 加入外部圖檔檔名
var photo:Array = new Array();
photo.push("991130_p1.jpg");
photo.push("991130_p2.jpg");
photo.push("991130_p3.jpg");
photo.push("991130_p4.jpg");
photo.push("991130_p5.jpg");
photo.push("991130_p6.jpg");

//
var pNum:uint = photo.length;

//****** intervalDuration - 換圖秒數(毫秒)
//目前設為 5000豪秒,即 5 秒
var intervalDuration:Number = 5000;

//TextFormat物件設定文字格式
var aTextFormat:TextFormat = new TextFormat();
aTextFormat.size = 18;
aTextFormat.color = 0xffffff;
aTextFormat.leftMargin = 5;
aTextFormat.rightMargin = 5;
//宣告TextField文字欄位類別實體infoTextField
var infoTextField:TextField = new TextField();
infoTextField.x = 15;
infoTextField.y = 15;
infoTextField.background = true;
infoTextField.backgroundColor = 0xff2200;
infoTextField.autoSize = TextFieldAutoSize.LEFT;
//將 infoTextField 加入顯示清單
addChild(infoTextField);
//建構Loader類別實體ldr
var ldr:Loader = new Loader();
//
ini();
//
function ini():void
{
 loadPhoto();
}
//
function loadPhoto()
{
 //如果photo陣列元素都被移除掉了
 //以for迴圈重新加入各元素,即外部檔名,同初始值
 if(photo.length == 0){
  for (var i:uint=0; i < pNum; i++) { // pNum
   photo[i] = "991130_p" + String(i+1) + ".jpg";
  }
  trace("------------------------------------------");
 }
 
 //Math.random() 亂數產生0(含)~1(不含)之浮點數, 
 //乘以圖檔張數(即photo陣列長度 photo.length),會得到 0(含)~6(不含) 之符點數
 //Math.floor - 去掉小數 - 會得到0~5之正整數
 var photoRandom:uint = Math.floor(Math.random() * photo.length);
 //photo[photoRandom] - 因應亂數,做為陣列索引,指向陣列元素
 var photoURL:String = photo[photoRandom];
 //splice(起始索引, 刪除數量) - 刪除被選定的陣列元素
 //如此在每一循環載入圖檔,才不會重覆
 photo.splice(photoRandom, 1);
 trace(photoURL);
 //將photoURL所存的圖檔檔名字串指定給 infoTextField 文字欄位顯示
 infoTextField.text = photoURL;
 //setTextFormat()方法,將aTextFormat格式化物件與infoTextField文字欄位關聯
 infoTextField.setTextFormat(aTextFormat);
 //
 //Loader類別實體ldr,以load()方法載入new URLRequest()的相對網址(即圖檔檔名)
 ldr.load(new URLRequest(photoURL));
 //將Event.COMPLETE事件的偵聽程式onLoaderComplete,附加到Loader類別實體ldr的contentLoaderInfo屬性 
 ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
}

//
function onLoaderComplete(e:Event):void
{
 addChild(ldr);
 //將ldr可視物件實體,以x,y座標控制在舞台中央
 ldr.x =  (stage.stageWidth - ldr.width) / 2;
 ldr.y =  (stage.stageHeight - ldr.height) / 2;
 //呼叫漸變屬性設定函式tweenPhoto1()
 tweenPhoto1();
 //setTimeout(closure:Function, delay:Number, ... arguments):uint
 //在指定的延遲時間 (以毫秒為單位) 之後執行指定的函數
 var intervalId:uint = setTimeout(ini, intervalDuration);
}
//
function tweenPhoto1():void{
 Tweener.addTween(ldr, {alpha:0, scaleX:0.9, scaleY:0.9, time:0, onComplete:tweenPhoto2});
} 
function tweenPhoto2():void{
 Tweener.addTween(ldr, {alpha:1, scaleX:1, scaleY:1, time:1.5});
} 

◎另需參閱
指定類別檔路徑 - 以下載及設置Tweener類別庫為例 http://flash.twgogo.org/2010/12/blog-post.html

2010年11月4日 星期四

[AS3] Transition Types 漸變型態展示

點選Transition Types項目,而後按Click鈕,觀賞漸變效果。

SWF瀏覽


//匯入Tweener類別;匯入MouseEvent類別
import caurina.transitions.Tweener;
import flash.events.MouseEvent;
//匯入ColorShortcuts類別
import caurina.transitions.properties.ColorShortcuts;
//初始化ColorShortcuts
ColorShortcuts.init();

//
//將 List 組件加入應用程式時,您可以加入下列 ActionScript 程式碼,讓螢幕朗讀程式能夠存取此組件
import fl.accessibility.ListAccImpl;
ListAccImpl.enableAccessibility();
//匯入List類別
import fl.controls.List;
//宣告tranVar為tweenFun2()之漸變參數transition的參數值
var tranVar:String;
//主場景上實體名稱為aList之List組件,addItem()將項目逐一附加至項目清單的結尾
aList.addItem({label:"linearx", data:"linear"});
aList.addItem({label:"easeInSine", data:"easeInSine"});
aList.addItem({label:"easeOutSine", data:"easeOutSine"});
aList.addItem({label:"easeInOutSine", data:"easeInOutSine"});
aList.addItem({label:"easeInCubic", data:"easeInCubic"});
aList.addItem({label:"easeOutCubic", data:"easeOutCubic"});
aList.addItem({label:"easeInOutCubic", data:"easeInOutCubic"});
aList.addItem({label:"easeOutInCubic", data:"easeOutInCubic"});
aList.addItem({label:"easeInQuint", data:"easeInQuint"});
aList.addItem({label:"easeOutQuint", data:"easeOutQuint"});
aList.addItem({label:"easeInOutQuint", data:"easeInOutQuint"});
aList.addItem({label:"easeOutInQuint", data:"easeOutInQuint"});
aList.addItem({label:"easeInCirc", data:"easeInCirc"});
aList.addItem({label:"easeOutCirc", data:"easeOutCirc"});
aList.addItem({label:"easeInOutCirc", data:"easeInOutCirc"});
aList.addItem({label:"easeOutInCirc", data:"easeOutInCirc"});
aList.addItem({label:"easeInBack", data:"easeInBack"});
aList.addItem({label:"easeOutBack", data:"easeOutBack"});
aList.addItem({label:"easeInOutBack", data:"easeInOutBack"});
aList.addItem({label:"easeOutInBack", data:"easeOutInBack"});
aList.addItem({label:"easeInQuad", data:"easeInQuad"});
aList.addItem({label:"easeOutQuad", data:"easeOutQuad"});
aList.addItem({label:"easeInOutQuad", data:"easeInOutQuad"});
aList.addItem({label:"easeOutInQuad", data:"easeOutInQuad"});
aList.addItem({label:"easeInQuart", data:"easeInQuart"});
aList.addItem({label:"easeOutQuart", data:"easeOutQuart"});
aList.addItem({label:"easeInOutQuart", data:"easeInOutQuart"});
aList.addItem({label:"easeOutInQuart", data:"easeOutInQuart"});
aList.addItem({label:"easeInExpo", data:"easeInExpo"});
aList.addItem({label:"easeOutExpo", data:"easeOutExpo"});
aList.addItem({label:"easeInOutExpo", data:"easeInOutExpo"});
aList.addItem({label:"easeOutInExpo", data:"easeOutInExpo"});
aList.addItem({label:"easeInElastic", data:"easeInElastic"});
aList.addItem({label:"easeOutElastic", data:"easeOutElastic"});
aList.addItem({label:"easeInOutElastic", data:"easeInOutElastic"});
aList.addItem({label:"easeOutInElastic", data:"easeOutInElastic"});
aList.addItem({label:"easeInBounce", data:"easeInBounce"});
aList.addItem({label:"easeOutBounce", data:"easeOutBounce"});
aList.addItem({label:"easeInOutBounce", data:"easeInOutBounce"});
aList.addItem({label:"easeOutInBounce", data:"easeOutInBounce"});
//
//aList.selectedItem={label:"easeInOutElastic", data:"easeInOutElastic"};
//將aList組件被選取項目之索引編號設為34
aList.selectedIndex = 34;
//將aList組件捲軸捲動至項目索引編號39
aList.scrollToIndex(34+5);
trace(aList.selectedItem.data);
//將aList組件被選取項目物件的data屬性指定給tranVar
//tranVar為tweenFun2()之漸變參數transition的參數值
tranVar = aList.selectedItem.data;
//aList廣播Event.CHANGE事件給getData偵聽函式
aList.addEventListener(Event.CHANGE, getData);
//
function getData(event:Event) {
 //將event.target事件物件的selectedItem物件的data屬性值導入tranVar
 tranVar = event.target.selectedItem.data;
}


//宣告oriX和oriY,將a_mc在主場景上的初始位置x及y座標存入
var oriX:Number = a_mc.x;
var oriY:Number = a_mc.y;
//
click_mc.buttonMode = true;
click_mc.addEventListener(MouseEvent.MOUSE_DOWN, tweenFun1)

//定義tweenFun1的內容,a_mc的漸變參數為{x:470, y:80, time:1.5, onComplete:tweenFun2}
//onComplete:tweenFun2將驅使x:470, y:80, time:1.5的漸變完成後,
//呼叫tweenFun2開始執行
//Complete color transformation properties裡的_color參數,其值為16進位數值
//例如0xff0000為紅色
function tweenFun1(e:MouseEvent):void{
Tweener.addTween(a_mc, {x:280, y:50, time:1, _color:0xffff00, onComplete:tweenFun2});
} 

//其中transition:"easeOutElastic"定義漸變階段的動作型態,
//可參照Transition Types 之說明。
//_color:null可將_color參數值回歸初始無值狀態。
function tweenFun2(){
 Tweener.addTween(a_mc, {x:oriX, y:oriY, time:1.5, delay:0.5, _color:null,transition:tranVar});
}



Transition Types




2010年11月3日 星期三

[AS3] Tweener.addTween() ← tweeningParameters參數的三種寫法

Tweener.addTween(target:Object, tweeningParameters:Object):Void

//
Tweener.addTween(a_mc, {x:470, y:80, time:1.5, _color:0xff0000, delay:1.5, onComplete:tweenFun2});
//或
// Tweener.addTween(a_mc, {
    x:470, 
    y:80, 
    time:1.5, 
    _color:0xff0000, 
    delay:1.5,
    onComplete:tweenFun2
});


//
var tweeningObj:Object = new Object();
tweeningObj.x = 470;
tweeningObj.y = 80;
tweeningObj.time = 1.5;
tweeningObj._color = 0xff0000;
tweeningObj.delay = 1.5;
tweeningObj.onComplete = tweenFun2;
//
Tweener.addTween(a_mc, tweeningObj);


//
var tweeningObj:Object = {x : 470, y : 80, time : 1.5, _color : 0xff0000, delay : 1.5, onComplete : tweenFun2};
//
Tweener.addTween(a_mc, tweeningObj);





2010年11月2日 星期二

[AS3] Tweener類別_Tweening Parameters>>base

SWF瀏覽


// WITH base, using an array of base objects:
import caurina.transitions.Tweener;
import flash.display.MovieClip;
import flash.events.MouseEvent;

var aOri:Object = {x:a_mc.x, y:a_mc.y, transition:"easeInOutBounce", time:2};
var myFade:Object = {x:450, time:1};
Tweener.addTween(a_mc, {base:myFade, y:300});

a_mc.addEventListener(MouseEvent.CLICK, oriFun);
function oriFun(e:MouseEvent){
 Tweener.addTween(e.currentTarget, aOri);
}

[AS3] Tweener→→→游移在兩種狀態間?

Tweener的解釋→游移在兩種狀態間?蠻有一點意思.
所以,從某種狀態到另一種狀態間的漸變過程,該是Tweener類別的意圖。

Tweener是開放源碼的程式庫。
Tweener網址:http://code.google.com/p/tweener/
Tweener類別下載:http://code.google.com/p/tweener/downloads/list
Tweener Documentation:http://hosted.zeh.com.br/tweener/docs/en-us/

基本的Tweener漸變,需要知道以下1和2:
  1. import caurina.transitions.Tweener; //Tweener不是內建類別,必須匯入caurina類別套件下的transitions類別套件下的Tweener類別

  2. Tweener.addTween(target:Object, tweeningParameters:Object):Void//以Tweener類別的addTween方法,將tweeningParameters定義的漸變參數附加到target物件上,據此產生漸變動畫。

    //target:Object — Any object that will suffer a tweening. These objects are usually MovieClip, TextField, or Soundinstances, or any other custom object with a numeric property that needs to be tweened.

    //
    tweeningParameters:Object — An object containing various properties of the original object that you want to tween on the original objects, with their final values assigned (some special properties are also allowed), as well as some built-in Tweener properties used when defining tweening parameters. This is like the recipe for the tweening, declaring both what will be tweened, and how.

//所以→
 Tweener.addTween(目標物件:Object, 漸變參數:Object)
→目標物件可以是影片實體、文字欄位、聲音實體、其它擁有數值屬性的自訂物件。
→漸變參數定義目標物件新的屬性值,漸變過程即原有屬性值到新的屬性值之間的動畫過程。

swf例一:Tweener.addTween()


//匯入Tweener類別;匯入MouseEvent類別
import caurina.transitions.Tweener;
import flash.events.MouseEvent;

//
click_mc.addEventListener(MouseEvent.MOUSE_DOWN, tweenFun)

function tweenFun(e:MouseEvent):void{

//針對a_mc附加漸變動畫,{x:450, y:100, time:1.5}為其漸變參數,物件類型
Tweener.addTween(a_mc, {x:450, y:100, time:1.5});

} 


swf例二:onComplete:value、transition:transitionType(String)




//匯入Tweener類別;匯入MouseEvent類別
import caurina.transitions.Tweener;
import flash.events.MouseEvent;

//宣告oriX和oriY,將a_mc在主場景上的初始位置x及y座標存入
var oriX:Number = a_mc.x;
var oriY:Number = a_mc.y;
//
click_mc.buttonMode = true;
click_mc.addEventListener(MouseEvent.MOUSE_DOWN, tweenFun1)

//定義tweenFun1的內容,a_mc的漸變參數為{x:470, y:80, time:1.5, onComplete:tweenFun2}
//onComplete:tweenFun2將驅使x:470, y:80, time:1.5的漸變完成後,
//呼叫tweenFun2開始執行
function tweenFun1(e:MouseEvent):void{
Tweener.addTween(a_mc, {x:470, y:80, time:1.5, onComplete:tweenFun2});
} 

//其中transition:"easeOutElastic"定義漸變階段的動作型態
//可參照Transition Types 之說明
function tweenFun2(){
 Tweener.addTween(a_mc, {x:oriX, y:oriY, time:1.5, transition:"easeOutElastic"});
}



swf例三:ColorShortcuts類別→Complete color transformation properties→_color:Number(16進位色彩碼)





ColorShortcuts類別 參考文件


//匯入Tweener類別;匯入MouseEvent類別
import caurina.transitions.Tweener;
import flash.events.MouseEvent;
//匯入ColorShortcuts類別
import caurina.transitions.properties.ColorShortcuts;
//初始化ColorShortcuts
ColorShortcuts.init();

//宣告oriX和oriY,將a_mc在主場景上的初始位置x及y座標存入
var oriX:Number = a_mc.x;
var oriY:Number = a_mc.y;
//
click_mc.buttonMode = true;
click_mc.addEventListener(MouseEvent.MOUSE_DOWN, tweenFun1)

//定義tweenFun1的內容,a_mc的漸變參數為{x:470, y:80, time:1.5, onComplete:tweenFun2}
//onComplete:tweenFun2將驅使x:470, y:80, time:1.5的漸變完成後,
//呼叫tweenFun2開始執行
//Complete color transformation properties裡的_color參數,其值為16進位數值
//例如0xff0000為紅色
function tweenFun1(e:MouseEvent):void{
Tweener.addTween(a_mc, {x:470, y:80, time:1.5, _color:0xff0000, onComplete:tweenFun2});
} 

//其中transition:"easeOutElastic"定義漸變階段的動作型態,
//可參照Transition Types 之說明。
//_color:null可將_color參數值回歸初始無值狀態。
function tweenFun2(){
 Tweener.addTween(a_mc, {x:oriX, y:oriY, time:5, _color:null,transition:"easeOutElastic"});
}

2010年11月1日 星期一

[AS3] Tweener類別_Tweener.addTween()

Tweener.addTween(target:Object, tweeningParameters:Object):Void

SWF瀏覽



//
import caurina.transitions.Tweener;
import flash.display.MovieClip;
import caurina.transitions.properties.FilterShortcuts;
//
FilterShortcuts.init();
//var bX:Number = _Blur_blurX;
//var bY:Number = _Blur_blurY;
//
var clip_mc:MovieClip = new ClipMC();
clip_mc.x = 0;
clip_mc.y = 200;
clip_mc.scaleX = 0.5;
clip_mc.scaleY = 0.5;
addChild(clip_mc);
//
var obj:Object = new Object();
obj.x = 400;
obj.y = 200;
obj.time = 2;
obj.transition = "easeOutBounce";
obj._Blur_blurX = 10;
obj._Blur_blurY = 10;
obj.alpha = 0.2;
obj.scaleX = 0.8;
obj.scaleY = 0.8;
//  
clip_mc.buttonMode = true;
clip_mc.addEventListener(MouseEvent.MOUSE_DOWN, function(){
 Tweener.addTween(clip_mc, obj);
})