PDA

View Full Version : Path Problem



nigeledge
April 7th, 2003, 02:24 PM
I've created a simple class... in the class I have a function which creates a button clip...

_global.TestClass= function()
{
this.createButton = function()
{

_root.createEmptyMovieClip("button",300);
_root.button.lineStyle(0,0x000000,100);
_root.button.beginFill(0xE6E6DC,100);
_root.button.moveTo(20,35);
_root.button.lineTo(20,55);
_root.button.lineTo(100,55);
_root.button.lineTo(100,35);
_root.button.lineTo(20,35);
_root.button.endFill();

_root.button.onRelease = function()
{
// here's the problem.
PATH-TO-METHOD?.buttonClicked();
}

};


this.buttonClicked = function()
{
trace("Button Clicked");
};

}
In the onRelease handler I call the buttonClicked function within the class... however... I can't get it to work. Basically, I don't know how to path reference it. If I say this.buttonClicked() then it is referring to the clip itself instead of the class. Any suggestions? Thanks in advance.

eyezberg
April 7th, 2003, 06:04 PM
1/ i would take
_root.button.onRelease = function()
{
// here's the problem.
PATH-TO-METHOD?.buttonClicked();
}
out of the "createBtn"..and even out of "TestClass"...
2/then try

_root.button.onRelease = function()
{
// here's the problem.
TestClass.buttonClicked();
}

nigeledge
April 7th, 2003, 06:34 PM
Judging by your workaround... I'm guessing that it is not possible to call other class methods from another method within the same class. Is this true? Makes flash a bit limited doesn't it?