请帮帮我,我是AS3的新手 编译项目时出错,这是我的错误摘要
TypeError:错误#1009:无法访问空对象引用的属性或方法。 在com.greensock :: TweenLite / init() 在com.greensock :: TweenMax / init() 在com.greensock :: TweenMax / renderTime() 在com.greensock.core :: SimpleTimeline / renderTime() 在com.greensock :: TweenLite $ / updateAll()
TypeError:错误#1010:术语未定义且没有属性。 在MethodInfo-258()
这是我使用的完整代码
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.MovieClip;
import flash.events.MouseEvent;
var tombolMenu:Array = [menu1, menu2, menu3, menu4, menu5, menu6, menu7, menu8, menu9];
var judulMateri:Array = [title_1,title_2, title_3, title_4, title_5, title_6, title_7, title_8, title_9]
var isiMateri:Array = [materi_1, materi_2, materi_3, materi_4, materi_5, materi_6,
materi_7, materi_8, materi_9]
var jumlahFrame:Array = [10, 5, 6, 8, 4, 9,5, 5, 5];
TweenLite.from(bar_mc, 0.5, {x:5000});
TweenLite.from(subject_mc, 0.5, {delay:1, x:1000});
navi_mc.visible=false;
for (var i:int = 0; i< tombolMenu.length; i++){
var gap:Number = i/4;
var tombolMenunya = tombolMenu[i];
tombolMenunya.buttonMode = true;
//muncul menu
TweenLite.from(tombolMenu[i], 0.5, {delay:gap, scaleX:0, scaleY:0, ease:Circ.easeOut});
tombolMenunya.addEventListener(MouseEvent.CLICK, fl_menu_0);
function fl_menu_0(e:MouseEvent):void{
TweenLite.to(bar_mc, 0.5, {delay:1,x:5000});
TweenLite.to(subject_mc, 0.5, { x:1000});
for (var i:int = 0; i<= tombolMenu.length; i++){
var gaps:Number = i/4;
//menu hilang
TweenMax.to(tombolMenu[i], 1,{delay:gaps,scaleX:0, scaleY:0, ease:Circ.easeIn});
//munculkan materi
if (e.currentTarget == tombolMenu[i]){
trace(jumlahFrame[i]);
navi_mc.visible=true;
TweenLite.from(navi_mc, 1, {delay:4, y:700});
TweenLite.to(judulMateri[i], 1, {delay:3, x:89.45, y:36.45, ease:Back.easeOut});
TweenLite.to(isiMateri[i], 1, {delay:3.4, x:392.45, y:246.95, ease:Back.easeOut});
navi_mc.next_mc.addEventListener(MouseEvent.CLICK, fl_next);
navi_mc.prev_mc.addEventListener(MouseEvent.CLICK, fl_prev);
//navi_mc.home_mc.addEventListener(MouseEvent.CLICK, fl_home);
navi_mc.prev_mc.alpha = 0.4;
navi_mc.home_mc.alpha = 0.4;
navi_mc.prev_mc.mouseEnabled = false;
navi_mc.home_mc.mouseEnabled = false;
//tombol next
function fl_next(e:MouseEvent):void{
for(var i:int = 0; i<= isiMateri.length; i++){
isiMateri[i].nextFrame();
if(isiMateri[i].currentFrame == 2 ){
navi_mc.prev_mc.alpha = 1;
navi_mc.prev_mc.mouseEnabled = true;
}
if(isiMateri[i].currentFrame == jumlahFrame[i]){
trace(isiMateri[i].currentFrame);
navi_mc.next_mc.alpha = 0.4;
navi_mc.next_mc.mouseEnabled = false;
navi_mc.home_mc.alpha = 1;
navi_mc.home_mc.mouseEnabled = true;
}
}
}
//tombol prev
function fl_prev(e:MouseEvent):void{
for(var i:int = 0; i<= isiMateri.length; i++){
isiMateri[i].prevFrame();
if(isiMateri[i].currentFrame == 1){
navi_mc.prev_mc.alpha = 0.4;
navi_mc.prev_mc.mouseEnabled = false;
navi_mc.next_mc.alpha = 1;
navi_mc.next_mc.mouseEnabled = true;
}
if(isiMateri[i].currentFrame==(jumlahFrame[i] - 1)){
navi_mc.next_mc.alpha = 1;
navi_mc.next_mc.mouseEnabled = true;
navi_mc.home_mc.alpha = 0.4;
navi_mc.home_mc.mouseEnabled = false;
}
}
}
//tombol home
}
}
}
}
如果有人帮忙,我将非常感激:) 谢谢大家
答案 0 :(得分:0)
抱歉答案缓慢:D
最后我发现了有问题的代码
在这里,我收到此错误
TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.greensock::TweenLite/init() at com.greensock::TweenMax/init() at com.greensock::TweenMax/renderTime() at com.greensock.core::SimpleTimeline/renderTime() at com.greensock::TweenLite$/updateAll()
当我运行此脚本时
for (var i:int = 0; i<= tombolMenu.length; i++){
var gaps:Number = i/4;
//menu hilang
TweenMax.to(tombolMenu[i], 1,{delay:gaps,scaleX:0, scaleY:0, ease:Circ.easeIn});
//munculkan materi
if (e.currentTarget == tombolMenu[i]){
trace(jumlahFrame[i]);
navi_mc.visible=true;
TweenLite.from(navi_mc, 1, {delay:4, y:700});
TweenLite.to(judulMateri[i], 1, {delay:3, x:89.45, y:36.45, ease:Back.easeOut});
TweenLite.to(isiMateri[i], 1, {delay:3.4, x:392.45, y:246.95, ease:Back.easeOut});
navi_mc.next_mc.addEventListener(MouseEvent.CLICK, fl_next);
navi_mc.prev_mc.addEventListener(MouseEvent.CLICK, fl_prev);
//navi_mc.home_mc.addEventListener(MouseEvent.CLICK, fl_home);
navi_mc.prev_mc.alpha = 0.4;
navi_mc.home_mc.alpha = 0.4;
navi_mc.prev_mc.mouseEnabled = false;
navi_mc.home_mc.mouseEnabled = false;
并收到此错误
TypeError: Error #1010: A term is undefined and has no properties. at MethodInfo-258()
运行时
function fl_next(e:MouseEvent):void{
for(var i:int = 0; i<= isiMateri.length; i++){
isiMateri[i].nextFrame();
if(isiMateri[i].currentFrame == 2 ){
navi_mc.prev_mc.alpha = 1;
navi_mc.prev_mc.mouseEnabled = true;
}
if(isiMateri[i].currentFrame == jumlahFrame[i]){
trace(isiMateri[i].currentFrame);
navi_mc.next_mc.alpha = 0.4;
navi_mc.next_mc.mouseEnabled = false;
navi_mc.home_mc.alpha = 1;
navi_mc.home_mc.mouseEnabled = true;
}
完整的代码在第一篇文章中。 我的数组函数对TweenLite操作有什么问题?