PDA

View Full Version : why can't I call my class methods?


mrand01
03-05-2004, 12:55 PM
class SlideShow extends MovieClip
{
var curScreen:Number = 1;

function SlideShow()
{
this.curScreen = curScreen;
this.loadMovie("slides/slide" + curScreen + ".jpg");
}

public function nextScreen():Void {
curScreen++;
this.loadMovie("slides/slide" + curScreen + ".jpg");
}
}


I have a movieclip called mcSlides on my stage. The linkage properties are as follows:

identifier: mcSlides
AS 2.0 class: SlideShow
Export for Actionscript checked
Export in first frame checked

mcSlides is declared like this in the root timeline:


var mcSlides:MovieClip;


when I try to call mcSlides.nextSlide();, nothing happens. It doesn't work. What am I doing wrong?

timhon
03-05-2004, 01:32 PM
did you ever get that to work, im curious to how?
can you post your new code.

PROBLEM!!:
the "this" command never works in class defs..
WHY is that...

even tho you extended MovieClip,
why does the compiler bark if i add:

"this._x = 0 " to its constructor...

if have to go "_x = 0"

mrand01
03-05-2004, 01:33 PM
nope, not working, still need help

EDIT: I can't even call a trace statement from a method...so the method is never even getting called. Whats up with that?

ericlin
03-05-2004, 01:48 PM
In the constructor, you load a movie to this clip. That destroyed everything. All custom properties and methods are gone.

mrand01
03-05-2004, 01:49 PM
lol that makes sense...haha

timhon
03-05-2004, 01:54 PM
ALSO i found out that
in order to refer to "this" in a class def, you have to make that
class dynamic ie:


dynamic class myClass {
}


if i didnt do 'dynamic' the compiler would error out if i used
a this. reference in it.