2011-02-11 86 views
0

我在將函數放入補間動畫時遇到問題。我的代碼完全在CS4中工作(但不幸的是,閃光燈CS4一直掛在我的電腦上,無論誰在CS5中的動作都能很好地工作在外部功能,但是當我把它放在一個功能裏時,它表現得很奇怪嗎?我不得不提到,在閃光燈和我的英文不好對不起Motion Tween在ActionScript 3和Flash CS5中不起作用函數

我必須轉換爲符號,我把它命名爲S1 這裏是代碼,而功能的矩形形狀:

import fl.transitions.Tween; 
import fl.transitions.easing.*; 
import fl.motion.AnimatorFactory; 
import fl.motion.MotionBase; 
import flash.filters.*; 
import flash.geom.Point; 
import fl.motion.Motion; 
import flash.display.DisplayObject; 

var __motion_UIL1:MotionBase; 
if(__motion_UIL1 == null) 
{ 
    import fl.motion.Motion; 
    __motion_UIL1 = new Motion(); 
    __motion_UIL1.duration = 15; 
    //__motion_UIL1.overrideTargetTransform(); 

    __motion_UIL1.addPropertyArray("x", [-280,-260,-240,-220,-200,-180,-160,-140,-120,-100,-80,-60,-40,-20,0]); 
    __motion_UIL1.addPropertyArray("y", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]); 

    __motion_UIL1.addPropertyArray("scaleX", [1.000000]); 
    __motion_UIL1.addPropertyArray("scaleY", [1.000000]); 
    __motion_UIL1.addPropertyArray("skewX", [0]); 
    __motion_UIL1.addPropertyArray("skewY", [0]); 
    __motion_UIL1.addPropertyArray("rotationConcat", [0]); 
    __motion_UIL1.addPropertyArray("blendMode", ["normal"]); 
    __motion_UIL1.initFilters(["flash.filters.BlurFilter"], [0], -1, -1); 

    __motion_UIL1.addFilterPropertyArray(0, "blurX", [200,185.714,171.429,157.143,142.857,128.571,114.286,100,85.7143,71.4286,57.1429,42.8572,28.5715,14.2857,0], -1, -1); 
    __motion_UIL1.addFilterPropertyArray(0, "blurY", [0], -1, -1); 

    __motion_UIL1.addFilterPropertyArray(0, "quality", [BitmapFilterQuality.LOW], -1, -1); 

    var __animFactory_UIL1:AnimatorFactory = new AnimatorFactory(__motion_UIL1); 
    __animFactory_UIL1.transformationPoint = new Point(0.500000, 0.500000); 

    __animFactory_UIL1.addTarget(s1, 1); 
} 

和這裏的時候,我把補間動畫裏面的功能: (我有一個矩形轉換爲符號,我把它命名爲s1)

import fl.transitions.Tween; 
import fl.transitions.easing.*; 
import fl.motion.AnimatorFactory; 
import fl.motion.MotionBase; 
import flash.filters.*; 
import flash.geom.Point; 
import fl.motion.Motion; 
import flash.display.DisplayObject; 

function b1(UILx:DisplayObject) 
{ 
    var __motion_UIL1:MotionBase; 
    if(__motion_UIL1 == null) 
    { 
     import fl.motion.Motion; 
     __motion_UIL1 = new Motion(); 
     __motion_UIL1.duration = 15; 
     //__motion_UIL1.overrideTargetTransform(); 

     __motion_UIL1.addPropertyArray("x", [-280,-260,-240,-220,-200,-180,-160,-140,-120,-100,-80,-60,-40,-20,0]); 
     __motion_UIL1.addPropertyArray("y", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]); 

     __motion_UIL1.addPropertyArray("scaleX", [1.000000]); 
     __motion_UIL1.addPropertyArray("scaleY", [1.000000]); 
     __motion_UIL1.addPropertyArray("skewX", [0]); 
     __motion_UIL1.addPropertyArray("skewY", [0]); 
     __motion_UIL1.addPropertyArray("rotationConcat", [0]); 
     __motion_UIL1.addPropertyArray("blendMode", ["normal"]); 
     __motion_UIL1.initFilters(["flash.filters.BlurFilter"], [0], -1, -1); 

     __motion_UIL1.addFilterPropertyArray(0, "blurX", [200,185.714,171.429,157.143,142.857,128.571,114.286,100,85.7143,71.4286,57.1429,42.8572,28.5715,14.2857,0], -1, -1); 
     __motion_UIL1.addFilterPropertyArray(0, "blurY", [0], -1, -1); 

     __motion_UIL1.addFilterPropertyArray(0, "quality", [BitmapFilterQuality.LOW], -1, -1); 

     var __animFactory_UIL1:AnimatorFactory = new AnimatorFactory(__motion_UIL1); 
     __animFactory_UIL1.transformationPoint = new Point(0.500000, 0.500000); 

     __animFactory_UIL1.addTarget(UILx, 1); 
    } 
} 

b1(s1); 

現在這是與CS4一起工作,它不適用於CS5。 pleeeeeeease幫我

+4

除了看起來像一個小火車殘骸的代碼,這似乎編譯和工作很好,作爲時間線腳本。你能更具體地解決這個問題嗎?你有錯誤嗎? – grapefrukt 2011-02-11 12:38:00

+0

沒有。根本沒有錯誤。但第一個代碼模糊並移動我的s1符號在屏幕上的15幀和第二個代碼做模糊沒有移動在1幀(沒有模糊或移動動畫)。 – Saman 2011-02-11 12:52:59

回答

1

__motion_UIL1和__animFactory_UIL1都聲明爲局部變量,這essentally意味着他們將被擦除,執行該功能後忘記了(在函數內)。嘗試移動

var __motion_UIL1:MotionBase; 

var __animFactory_UIL1:AnimatorFactory; 

出來的函數體。

相關問題