2012-02-27 93 views
-1

我已复制的对象在另一帧使用它的属性或方法(该对象使用Greensock滚动X轴和我使用的功能(onMove (EVT:MouseEvent)方法),但是当我移动鼠标这个错误在输出选项卡TypeError: Error #1009: Cannot access a property or method of a null object reference. at Main_fla::mainContianer_1/onMove()来了,当我按下一个按钮,进入新的对象这个错误出现TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.greensock::TweenLite/init() at com.greensock::TweenLite/renderTime() at com.greensock.core::SimpleTimeline/renderTime() at com.greensock::TweenLite$/updateAll()和旧的对象出现AS3 - 类型错误:错误#1009:无法访问空对象引用

这里是我的旧行为

import com.greensock.TweenLite; 
import com.greensock.easing.Back; 
import com.greensock.easing.Elastic; 
import com.greensock.plugins.TweenPlugin; 
import com.greensock.plugins.BlurFilterPlugin; 

var panelContainer:Sprite = new Sprite; 
addChild(panelContainer); 

for(var i:Number=0;i<3; i++) { 

    var projectPanel:ProjectPanel = new ProjectPanel; 
    projectPanel.x = i*(projectPanel.width+10); 
    panelContainer.addChild(projectPanel); 

    projectPanel.addEventListener(MouseEvent.CLICK, onClick); 

} 

function onClick(evt:MouseEvent):void { 

    TweenLite.to(panelContainer, 0.5, {y:stage.stageHeight, ease:Back.easeIn}); 
    MovieClip(this.parent).addFullPanel(Number(evt.currentTarget.name)); 

} 

function slideUp():void { 

    TweenLite.to(panelContainer, 0.5, {y:0, ease:Back.easeOut}); 

} 

stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove); 

function onMove(evt:MouseEvent):void { 

    if(MovieClip(this.parent).fullProjectPanelUp==false){ 
    TweenLite.to(panelContainer,0.3, {x:-  (stage.mouseX/1225)*panelContainer.width+stage.stageWidth/2.65}); 
    } 

} 

stop(); 

和新的动作:

import com.greensock.TweenLite; 
import com.greensock.easing.Back; 
import com.greensock.easing.Elastic; 
import com.greensock.plugins.TweenPlugin; 
import com.greensock.plugins.BlurFilterPlugin; 

var lessonContainer:Sprite = new Sprite; 
addChild(lessonContainer); 

for(var p:Number=0;p<8; p++) { 

    var lessonPanel:LessonPanel = new LessonPanel; 
    lessonPanel.x = p*(lessonPanel.width+10); 
    lessonContainer.addChild(lessonPanel); 

    lessonPanel.addEventListener(MouseEvent.CLICK, onClick); 

} 

function onClickLesson(evt:MouseEvent):void { 

    TweenLite.to(lessonContainer, 0.5, {y:stage.stageHeight, ease:Back.easeIn}); 
    MovieClip(this.parent).addfullLessonPanel(Number(evt.currentTarget.name)); 

} 

function slideLessonUp():void { 

    TweenLite.to(lessonContainer, 0.5, {y:0, ease:Back.easeOut}); 

} 

stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove); 

function onLessonMove(evt:MouseEvent):void { 

    if(MovieClip(this.parent).fullLessonPanelUp==false){ 
    TweenLite.to(lessonContainer,0.3, {x:-(stage.mouseX/1225)*lessonContainer.width+stage.stageWidth/2.65}); 
    } 

} 

stop(); 

这里是Project Files如果u需要他们

+0

您使用的MovieClip(this.parent)所有的地方还没有这样做没有类中的代码。那么让我问你,“this.parent”是指什么? – 2012-02-27 23:33:56

+0

fullProjectPanel – aymanzzz 2012-02-27 23:36:30

+0

我怎样才能使参考fullLessonPanel?! – aymanzzz 2012-02-27 23:37:20

回答

0

如果FrameLabelPlugin没有激活,TweenLite的将充当虽然你试图从字面上补间mc.frameLabel属性(有没有这样的事情)。

激活插件需要一个单一的代码行,你只需要一次做你的应用程序,所以它很容易。只需通过一个包含所有插件的名称的数组,你想激活该TweenPlugin.activate()方法,像这样:

import com.greensock.plugins.*; 
TweenPlugin.activate([FrameLabelPlugin, ColorTransformPlugin]); 
相关问题