Jump to content
Search Community

[SOLVED] Error #1009: Cannot access...

UbiAssassin test
Moderator Tag

Recommended Posts

Hello and I am sorry for posting an error that has been answered many times over. None of the answers really helped me solve what I am doing wrong. So here is what I am trying to do. I am brand new to AS3 as well, which does not help >.<

 

I have a main movie, and I have added another movie at a certain point in my main timeline.

 

1. When I created the small movie within the main one, I chose to Export to Actionscript and set the class to an AS file that I created earlier. The new movie is called "TitleClip" and it is assigned to the AS file "TitleClip." I just added TitleClip to the Class field before saving the new movie.

2. My TitleClip AS packet has this code inside of it:

package {
import flash.display.*;
import com.greensock.*;
import com.greensock.easing.*;

public class TitleClip extends MovieClip {
	public function TitleClip() {
		trace(TitleClip);
		TweenMax.to(TitleClip, 1, {delay:2, bevelFilter:{blurX:10, blurY:10, strength:5, angle:45, distance:10}, ease:Quad.easeIn});
	}
}

}

 

I get this error no matter what I try:

 

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at com.greensock.plugins::FilterPlugin/initFilter()

at com.greensock.plugins::BevelFilterPlugin/onInitTween()

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

 

I am new to all of this and probably making a very stupid error, so I am sorry for that and any help will be greatly appreciated :) Basically I just want to know how to packet my AS into movies that I create on the stage so that they can run their code when loaded. I want to keep my main movie's Actions panel as simple as possible. I have done most of my tweens and visuals with timeline work up until now, so the new code-driven workflows are going to take some getting used to for me.

 

Thanks :)

Link to comment
Share on other sites

It looks like you're trying to tween the TitleClip class itself rather than an instance of the class - BIG difference :)

 

You can reference the instance inside your class using the "this" keyword. Check out some object-oriented tutorials on AS3 for more info (like http://active.tutsplus.com/tutorials/ac ... ion-basix/). I think you meant to do something like this:

 

package {
  import flash.display.*;
  import com.greensock.*;
  import com.greensock.easing.*;

  public class TitleClip extends MovieClip {
     public function TitleClip() {
        trace(this);
        TweenMax.to(this, 1, {delay:2, bevelFilter:{blurX:10, blurY:10, strength:5, angle:45, distance:10}, ease:Quad.easeIn});
     }
  }
}

Link to comment
Share on other sites

Wow, I knew it had to be something simple. I missed the purpose of the move code all together. That was exactly my problem >.< Thank you very much for the fix and the link! It will take me some time to get used to it, but the efficiency and power of doing most of my animations through script seems immense!

 

Happy Holdays everyone :)

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