ActionScript 3.0 :: Error - Null Object Reference When Creating A Static Variable
Feb 5, 2010
Basically I have 2 classes, A and B. B derives from A. Inside A, I declare a static variable/constant to the class of B. When I run the program, I get a null object reference error, with the line pointing to the class declaration of B, i.e.
Code:
public class B extends A
For reference, these are the 2 classes:
Code:
package
{
public class A
{
[code]...
Also, this error only occurs when the variable is static. If it's just a normal variable it works fine, i.e.
Code:
private var OTHER:Class = B;
If I change the static variable to point to a different class, it's also fine, i.e.
Code:
private static var OTHER:Class = Main;
I can probably work around this, but it's a bit of a pain in the ass. Anybody know what's causing it, or is this a Flash bug?
View 5 Replies
Similar Posts:
Feb 8, 2009
I had created a loader which can load an array of images. However, when there are more images, the images actually got hidden as the size of the application is too small to accommodate all the images. I would need to create a scroll bar. I tried creating a
scroll bar but there were errors faced saying that "TypeError: Error #1009: Cannot access a property or method of a null object reference.". I am not really sure on how to do it,
View 3 Replies
Aug 22, 2011
I have one MXML File as
<objecthandles:ObjectHandles xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" backgroundAlpha="1" xmlns:mx="library://ns.adobe.com/flex/mx"
[code].....
View 1 Replies
Mar 10, 2009
This is my code,
stop();
button3.addEventListener(MouseEvent.CLICK, playClick3);
function playClick3(Event:MouseEvent):void {
gotoAndStop(422);
}
On frame 422 there is no code at the moment. I keep getting the error TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 2 Replies
Aug 20, 2011
I'm creating a movie clip button and for the out state I have this:
web_btn.addEventListener(MouseEvent.MOUSE_OUT, at_out);
function at_out(event:MouseEvent):void {
web_btn.gotoAndPlay(30-(web_btn.currentFrame-11));
}
It gives me this error when I click the button: TypeError: Error #1009: Cannot access a property or method of a null object reference. at index_fla::web_mc_37/at_out() I know the error is in this statement: web_btn.gotoAndPlay(30-(web_btn.currentFrame-11));
View 4 Replies
Oct 1, 2007
I am trying to use the scroll pane component and I am having a few teething troubles. I have a scroll pane as a child object of a movie clip which is essentially a 'page', if I display this page it works fine and the scroll pane does too. If I then remove this page from the display list, go to another page and come back by readding it to the display list, I get the following error, even though nothing else has changed:
TypeError: Error #1009: Cannot access a property or method of a null object reference.at fl.containers::ScrollPane/fl.containers:ScrollPane::endDrag()
The scroll pane is still visible and works correctly, but ideally I'd like to stop this error.
View 3 Replies
Oct 28, 2009
I'm animating some mc's at the beginning of the timeline with AS3 (mostly alpha fades), but then I have some tweened animations further down the timeline and a "naviagation bar" that's on all frames, so a user can click a button and jump to a part of the timeline to see some other animations.My problem is that if I don't wait to see the programmed animations at the beginning and just clicka button to see the other tweened animations, I get an error:
"Error #1009: Cannot access a property or method of a null object reference. at flash_fla::MainTimeline/tube_glow2_animate()"
(tube_glow2_animate() being the name of a function)
[code].....
View 2 Replies
Mar 27, 2009
I am trying to figure out the logic to remove a nullreference error that is popping up when an item is not dragged. Inthe code, I have a stopDrag setup for the stage. It works asexpected unless the user clicks the item but doesn't drag it. Itcauses the variable I have set to bring the name of the dropTargetto be a null which crashes the system. I have tried to declare thevariable with a default value but it still doesn't work.It is the targetStop code that it is crashing on. Is thereanyway to default a value so I can do an if / then statement todetermine if there is a value? I've tried: if (targetStop == null)but that doesn't seem to work.
View 8 Replies
Jun 21, 2011
I have function init, which runs on the creationComplete of the application. The init calls get_login_share_object funtion, in which objects are created, which are null.
Now my problem is that, I get a null object reference error on the Alert in "init()". How can I avoid that. Is it possible that I can have a check to see, if the objects are null the program should just skip reading the objects.
private function init():void
{
var stored_credentials:Object = get_login_share_object();
[Code]....
View 3 Replies
Jun 25, 2011
Here are my classes
Main - creates preloader
Preloader - createas Website
Website - creates MainMenu
When a button in the main menu is clicked, it creates an object. And when another one is clicked, that object needs to be removed. The removing part got a little bit messy.
package src {
import com.greensock.TweenLite;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Point;
[Code] .....
View 1 Replies
Feb 8, 2010
i used some variable, which was not initialized properly. I got a runtime error related to Null Object Reference.It was a hell, to find out, which variable was it pointing to. Cannot it be more informative, if it says, on which particular variable ( or bunch of variables), did the compiler found the null object reference. Or atleast provide me the lineNumber/linenumbers where it find the null object.The informationlessness becomes more hell, when there is more than one line, in which such null objects are used. It's hard to determine, if the line removed currently was a correct attempt or wrong attempt towords debugging the code.
View 3 Replies
Jun 17, 2009
Im trying to finish a small project im working on and this is the only bit that i have difficulty with. I have an image which tracks the mouse and reveals a masked image below. When the user clicks on the screen it plays the rest of the movie.The error message is: TypeError: Error #1009: Cannot access a property or method of a null object reference. at newmovie_fla::MainTimeline/moveMask()
The code i have used is:
stop()
curtains.mask = light;light.cacheAsBitmap = true;curtains.cacheAsBitmap = true;
[code]....
View 3 Replies
Nov 10, 2009
gallery1.swf is the default swf, when I click the btn for gallery 2 I get TypeError: Error #1009:Cannot access a property or method of a null object reference at allery1_fla::MainTimeline/startToMoveThumbs()
stop();
var Xpos:Number = 0;var Ypos:Number = 80;var swf:MovieClip;var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swfs/gallery1.swf");
[code].....
View 1 Replies
May 3, 2010
I create a button .when i want controle it via actionScript encounted with this error :
TypeError: Error #1009: Cannot access a property or method of a null object reference. at Document()
View 3 Replies
Feb 18, 2011
I am trying to use this script to jump to a certain point on my timeline:
feature1_btn.addEventListener(MouseEvent.CLICK, feature1);
function feature1(event:MouseEvent):void {
gotoAndPlay(620);
}
I have the instance of my button labeled as "feature1_btn". Why am I getting this error?
View 1 Replies
Mar 14, 2012
When I try to run this code with the main file being documentclass and the highest in the code heirarchy, it comes up with error 1009, but I cant see the problem. The playscreen class with the constructer function is there, in the same folder as the document class but document class is saying it is a null object reference. When I try to run the code with the main file being playscreen, there is no problem, it runs perfectly.
[Code]...
The playscreen class is too big to fit here and I dont want to trouble you with the details. But I can assure you it DOES exist and it is NOT null.
View 1 Replies
Oct 20, 2009
I have an error that is not negatively effecting anything, but I'd rather fix it if I can. I have to do with "MouseEvents" when I change from one scene to the next. As in the objects do not exist in the "new" scene so there is a "null object referenced" error. The objects are not referenced in the new scene. Its a "mouseOver" and so when the scene changes and the "MouseOut" happens it tries to exicute a funciton on an object that is no longer available. I was thinking of changing the functions to "if/Else" statements, as in:
"if currentScene=X Mouse out, Else "NOTHING"
View 2 Replies
Mar 11, 2009
This might be alittle complicated to explain but I'll try to do my best.I have a basic setup of 3x4 isometric boxes that you can drag and sort around on a grid. This works just fine. Each box is a instance of a custom class of mine called Kiste (which consists of several sub-objects).hile sorting I have to use a procedure like this to get the parent Kiste-object of the dropTarget as droptarget will always get me the "lowest" object possible instead of the topmost:
Code:
function whileDrag(e:Event):void{
var dt:DisplayObject = dropper.dropTarget; // Dropper is a empty Sprite that is constantly
[code].....
View 3 Replies
Feb 13, 2010
I have this preloader code on frame 1 in my MAIN swf file with the content on frame 2
Actionscript Code:
stop(); //Import the required assetsimport flash.display.*;//Stop the playhead while loading occursthis.stop();//Create a listener to call the loading function as the movie loadsthis.loaderInfo.addEventListener (ProgressEvent.PROGRESS, PL_LOADING);/*This is the main function,
[code]....
Also an external swf file is loaded using the same code on frame 1 in its main timeline this works when I test local but it outputs an error....
at welcome_fla::MainTimeline/PL_LOADING()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at welcome_fla::MainTimeline/PL_LOADING()
On line this prevents it from working at all.Basically I need each external content to have its own preloader for its content.If you go to my site you will see it works on the intital load but when you hit the home button it fails [URL]
View 2 Replies
Jan 19, 2009
I'm having a hard time because of an "Error #1009:Cannot access a property or method of a null object reference" Iget everytime I try to run my Flash-movie. I've attached the codethat is contained in frame 1.The function bringUpEasyQuestion is defined on frame 2, alongwith other functions that are defined there. Now when I test themovie, I get this message:TypeError: Error #1009: Cannot access a property or method ofa null object reference.at MES_fla::MainTimeline/bringUpEasyQuestion()atMES_fla::MainTimeline/frame1()I've read that the Error1009-message means that you aretrying to access something that isn't there yet. And indeed, thebringUpEasyQuestion-function accesses objects that exist only onframe 2. But the first line of the function bringUpEasyQuestion isgotoAndStop(2);. The curious thing is that it works when i put thelast line of the code in frame one (the function callbringUpEasyQuestion(0);) on the first line
with the command gotoAndStop(2);?
View 3 Replies
Nov 1, 2010
i made an external .swf with the "Displaycontent = image slideshow" in it voor the main site called Teaser, so when i press a button on the main site, it loads the Teaser.swf.when i press that button again, it loads again the Teaser.swf on top of the first Teaser.swf. so i decided to remove the first swf, but then the problem started."TypeError: Error #1009: Cannot access a property or method of a null object reference at easer_fla::MainTimeline/onResizeStage() line 128at Teaser_fla::MainTimeline/onTeasLoaded() line 70
code:
External swf (Teaser):
"...
[code]......
View 2 Replies
Apr 4, 2011
Im using CS5 i am a novice and i am doing this for my A level project and i cannot seem to get my button code to work properly. I've set it pinpoint debugging stuff that people have been going on about.
TypeError: Error #1009: Cannot access a property or method of a null object reference. at productsave7_fla::MainTimeline/frame575()[productsave7_fla.MainTimeli ne::frame575:4]
[Code]....
View 21 Replies
Aug 8, 2010
I am building a AS3 only project and got runtime error that said "Cannot access a property or method of a null object reference."
Here is my code:
main.as
public class videoMain extends Sprite{
private var videoPlayer:Player;
public function videoMain (){
[code]....
View 1 Replies
Feb 16, 2012
I'm having an issue with my flash code. I'm making a simple ball drop game and I keep getting this error
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at balldrop_fla::MainTimeline/gameLoop()[balldrop_fla.MainTimeline::frame1:46]
It seems to be talking about line 46 which is " ball.y += 5;"
Here is my code:
import flash.display.DisplayObject;
import flash.geom.Rectangle;
import flash.events.Event;
import flash.display.MovieClip;
[code]....
View 2 Replies
Jan 13, 2010
In Actionscript 3, I'm trying to build a button to go back from a content frame to a main menu. When the button is clicked, IF the content frame has a movie in it, that movie should stop playing. Flash keeps throwing a "null object reference" error on all pages that don't include a movie. I even tried putting in a check to see if the movie exists, but that doesn't work, either.
ActionScript Code:
function return_to_menu( me:MouseEvent ):void {
if ( flashmo_contents.flv_movie ) { //this line produces errors in frames where the movie
[code]....
View 2 Replies
Jul 10, 2010
I have been getting this Type Error 1009 at the following Loop:
ActionScript Code:
private function Loop(e:Event):void {
for(var i:int=0; i<walls.length; i++) {
if(hitTestObject(walls[i]) && hits > 0) {
explodeX = this.x;
explodeY = this.y;
[Code] .....
ActionScript Code:
parent.removeChild(this);
But that doesn't work. Still get the error
View 3 Replies
Jan 14, 2010
I have a my project that has three frames on the main timeline.
Frame Label MovieClip Instance Name Class file
Intro_Frame -> Intro_symbol -> Intro_Page
Content_Page -> Content_symbol -> Content
[code].....
View 1 Replies
May 2, 2010
I have a flash project that I'm working on, and I keep getting this error in the output window, yet everything seems to be fine:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Main/onOpen()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.containers::UILoader/passEvent()
View 13 Replies
Apr 22, 2009
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at QuizApp/createStatusBox()
at QuizApp()
Thats the error messege i get when it tries to play. What I have is an swf that loads another when its done, the new swf is blank but has a document class to an AS file.It seems the problem lies when a function is not properly being added to the stage.The function is added like this..
Code:
package{
public class QuizApp extends Sprite{
public function QuizApp(){
createButtons();
[code]....
View 10 Replies
Jun 24, 2009
I have a movie clip that starts lets say @ frame10 and ends @ frame20 I have a button to toggle the visibility of that movie clip on/off even if the movie clip is not currently displayed on the stage. The reason I am getting Error #1009: Cannot access a property or method of a null object reference is because my movie clip (as I read from previous posts) has not been instantiated yet.
I have over 50 movie clips like this one (to act as labels, as i scroll through the timeline the labels appear and disappear to follow an anatomical structure on series of images). Is there an easy way to instantiate all of those movie clips although they start and end at different points on the timeline? I got a headache from finding a solution for this.
View 6 Replies