Forums

ForumsProgramming Forum

Another problem

Posted Dec 3, '13 at 12:29pm

alex57834

alex57834

89 posts

I get the error

CountdownDisplayMain.as, Line 16 1119: Access of possibly undefined property CountdownClockDisplay through a reference with static type Class.
and also the same on line 27

package {

import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.utils.Timer;

public class CountdownDisplayMain extends MovieClip {

var time:Number;
var timeTimer:Timer;

public function CountdownDisplayMain()
{
time + 60;

CountdownDisplayMain.CountdownClockDisplay.text = time.toString();

timeTimer = new Timer(1000);
timeTimer.addEventListener(TimerEvent.TIMER,countdown);
timeTimer.start();

}

function countdown(Event:TimerEvent)
{
time -= 1;
CountdownDisplayMain.CountdownClockDisplay.text = time.toString();
}

}

}




In my document class i have the following

var countdownDisplayMain:CountdownDisplayMain = new CountdownDisplayMain();
countdownDisplayMain.x = 50;
countdownDisplayMain.y = 350;
addChild(countdownDisplayMain);

 

Posted Dec 3, '13 at 1:01pm

weirdlike

weirdlike

714 posts

Moderator

classes cant look at themselves

take this

CountdownDisplayMain.CountdownClockDisplay.text = time.toString();

and change to this

CountdownClockDisplay.text = time.toString();

 

Posted Dec 3, '13 at 1:09pm

alex57834

alex57834

89 posts

It just stays blanks and i changed

time + 60;
to time = 60;

 

Posted Dec 3, '13 at 1:23pm

weirdlike

weirdlike

714 posts

Moderator

in the properties panel where you put the instance name look down to behavior and select single line and also take note of the width of your txt box, can it support 2 digits?

 

Posted Dec 3, '13 at 1:29pm

alex57834

alex57834

89 posts

Yes it is capable of storing 2 digits the text size is small enough to fit them in.

[URL=http://s927.photobucket.com/user/alex578344/media/cs6_zpsc42b4da4.png.html][IMG]http://i927.photobucket.com/albums/ad112/alex578344/cs6_zpsc42b4da4.png[/IMG][/URL]

 

Posted Dec 3, '13 at 1:35pm

weirdlike

weirdlike

714 posts

Moderator

the text and the box are both black change text to white

 

Posted Dec 3, '13 at 1:37pm

alex57834

alex57834

89 posts

How could i be so stupid

 

Posted Dec 3, '13 at 1:40pm

weirdlike

weirdlike

714 posts

Moderator

fine tuning... I do it all the time

 

Posted Dec 4, '13 at 2:38pm

alex57834

alex57834

89 posts

I have a Document class which now gives the error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at avatar()
at GameClass()
at Document()



package {

import flash.display.MovieClip;

public class Document extends MovieClip{

public var game:GameClass;

public function Document()
{
game = new GameClass();
addChild(game);
}

}

}

 

Posted Dec 4, '13 at 2:42pm

weirdlike

weirdlike

714 posts

Moderator

some of your classes extend the stage

game = new GameClass(stage);

then in you game class

public function GameClass(stage):void

 
Reply to Another problem

You must be logged in to post a reply!