class. So, for example, I want to do it like this:
on the stage at the supplied x and y positions. How should this be done
"Pierre Canthelou" <pierre.canthelou@cmatoile.com> wrote in message
news:413b5d91$0$18620$626a14ce@news.free.fr...
> First, when you wrote "MyMovie.onEnterFrame = function() { ... }, you are
> within the MyMovie object, no more a MyClass object.
>
> So, you have to insert a new variable in the MyMovie, says "i"
>
> function myFunction()
> {
> MyMovie.i = this.i;
> ...
> }
>
> But another way is to make your Movie inherit your MyClass class !
>
> class MyClass
> {
> var aNumber : Number = 10;
>
> function onEnterFrame()
> {
> trace( this.aNumber );
> }
> }
>
> Shorter, nicier !
>
> Pierre Canthelou
>
http://www.codesign.fr >
>
> "mtx" <anon@anon.com> wrote in message
> news:1%g_c.205$Db6.33@newsfe1-win.ntli.net...
> > I have defined a class containing global variables that I want to access
> > from within a MovieClip object's onEnterFrame function.
> >
> > The class looks something like this:
> >
> > class MyClass
> > {
> > var MyMovie:MovieClip;
> > var i:Number = 10;
> >
> > function MyClass(MyMovie:MovieClip)
> > {
> > this.MyMovie = MyMovie;
> > myFunction();
> > }
> >
> > function myFunction()
> > {
> > MyMovie.onEnterFrame = function() {
> > trace(i);
> > };
> > }
> >
> > }
> >
> > How do I access variable 'i' from within the 'MyMovie' movie clip's
> > onEnterFrame function? If I try this i is listed as 'undefined'.
> >
> > Thanks.
> >
> >
> >
>
>