Jump to content
Search Community

typeError #1010 at MethodInfo-258()

nursyamsi test
Moderator Tag

Recommended Posts

hi everyone :)

 

I use TweenLite and TweenMax in my animation code, but there's error, I don't know where the error located, can you help me to find that :).

 

here is my error info

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()
TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-258()

and for other clue here is my full code 

 

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
}
}
}
}

thanks everyone, I really appreciate. thanks befor :)

Link to comment
Share on other sites

It sounds like you're trying to tween a null object somewhere. For example, this would cause an error: 

var someObject; //it never gets defined
TweenLite.to(someObject, 1, {x:100});

//or referencing a non-existent index in an array:
var myArray = [obj1, obj2];
TweenLite.to(myArray[5], 1, {x:100});

It is difficult to troubleshoot without having your FLA to publish, but I would recommend using trace() just before your tweens to see what you're passing in and find where the null reference is. 

Link to comment
Share on other sites

Hi, what we are advising is that you ensure that the target of your tween exists.

 

so for the following tween:

TweenLite.from(bar_mc, 0.5, {x:5000});

We're saying add

trace("bar_mc = " + bar_mc)
TweenLite.from(bar_mc, 0.5, {x:5000});

If you run the file and you get 

bar_mc = undefined in the output then you know you either spelled the name wrong or you are targetting something that doesn't exist.

 

You should see something like

 

bar_mc = [object MovieClip]

 

It may be a little time consuming, but this is exactly what we would do to find the problem, so its best you take this step first. 

 

Also you can comment out each tween until the error goes away

//TweenLite.from(bar_mc, 0.5, {x:5000});
Link to comment
Share on other sites

hi, again :D

 

I have try it, and the object of bar_mc is existed and I try to debug the fla file

 

I have an Eror

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()

whe i try to access the button action that have to display another object according to the Array

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});

then the error

TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-258()

came up when I access the object with Array too,

by the way, here is my fla

theFla

 

thanks in advance :)

Link to comment
Share on other sites

Change this:

 

for (var i:int = 0; i<= tombolMenu.length-1; i++){
 
 
frame 5 line 28 i think there are to many elements in the loop.
 
Same goes for the navi buttons change:
 
for(var i:int = 0; i<= isiMateri.length-1; i++){
for(var i:int = 0; i<= isiMateri.length-1; i++){
 
 
cheers
p
  • Like 1
Link to comment
Share on other sites

Wow, the error is gone, :) thank you, it's work, but there's one more, hehe. In frame 5 line 53, I try to adding nextFrame() for each subject of movieclip in Array isiMateri, and jumlahFrame is number of each movieclip, and when I run, the object just move 3 steps of nextFrame, even I change the jumlahFrame with totalFrames, thanks in advance :)

Link to comment
Share on other sites

the fla file same as I post before, but without change the looping script from you :), sorry I'm not in internet cafe anymore and just replied it from my phone and I can't upload again right now, hehe. Thanks in advance really appreciate :)

Link to comment
Share on other sites

First, Pav963, thanks so much for jumping in and offering to help. That's great!

 

nursyamsi,

 

if you add the following trace in your loop you will see that the last iteration of the loop outputs undefined

 

trace(tombolMenu[i])
TweenMax.to(tombolMenu[i], 1,{delay:gaps,scaleX:0, scaleY:0, ease:Circ.easeIn});

That's why you were getting an error, you were trying to tween something that didn't exist because, as pav pointed out, you were running your loop more times than you had items in your Array.

 

--

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...