Reputation: 3338
I was programming something and when I thought everything was nice and good, Flash throws an error to me!?
At first I was dumbstruck. Then after checking my code, I couldn't see the culprit. So what I did was 'simple it down', and changed it to just a trace statement.
I was still however getting the error. I don't know what is wrong.
package {
import flash.display.MovieClip;
import src.data.DActors;
public class DocumentClass extends MovieClip {
public var dActors:DActors = new DActors;
public function DocumentClass() {
trace (dActors);
trace ("Main");
}
}
}
This is the DActors Class:
package src.data
{
public class DActors
{
public var me:int = 1;
public function DActors();
{
trace(me);
}
}
}
Some scope I'm not aware of or something?
Oh, and by the way, it throws that ''me' is not defined'!?
EDIT: Actually, I failed to realize the real problem, why the hell is my constructor not accepting variables!
package src.data
{
public class DActors
{
public var actors:Array = new Array();
public var dActor:DActor = new DActor();
public function DActors();
{
actors.push(dActor);
}
}
}
outputs:
1120: Access of undefined property actors.
1120: Access of undefined property dActor.
???? This worries me greatly. Either my eyes are fooling me or I'm missing something very basic.
Upvotes: 0
Views: 9353
Reputation: 2228
public function DActors();
Constructor function will not end with ;
(semicolon).
Upvotes: 1
Reputation: 2065
The semicolon after your DActors
constructor breaks your code.
public function DActors();
if you change the DActors
class to this it will work:
package src.data
{
public class DActors
{
public var me:int = 1;
public function DActors()
{
trace(me);
}
}
}
Upvotes: 0
Reputation: 6230
Call the constructor properly
public var dActors:DActors = new DActors();
Upvotes: 0
Reputation: 1624
public var dActors:DActors = new DActors;
Should be:
public var dActors:DActors = new DActors();
Upvotes: 0