我复制了一个对象以在另一个框架中使用它(该对象使用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()
并且旧对象出现
这是我原来的行为
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
答案 0 :(得分:0)
如果没有激活FrameLabelPlugin,TweenLite就会像你试图填补mc.frameLabel属性一样(并且没有这样的东西)。
激活插件需要一行代码,您只需在应用程序中执行ONCE,因此非常简单。只需将包含您要激活的所有插件名称的数组传递给TweenPlugin.activate()方法,如下所示:
import com.greensock.plugins.*;
TweenPlugin.activate([FrameLabelPlugin, ColorTransformPlugin]);