On 15/12/2010 23:53, spyder spyders wrote:
   I am trying to write a ToggleButton Class.    I can get it to work as a 
document class and as as3 on timeline.  But how to I use it as a symbol class?

Q. "I am guessing that the 'this' is pointing to the symbol or _mc I attach the class to?"

Not attach, but define. The class defines the object and 'this' refers to the one (instance) being accessed:

Let's say you use the ToggleButton class to create two instances:

public var toggleButton1:MovieClip; // **
public var toggleButton2:MovieClip;

and somewhere you call someMethod() on toggleButton1...

toggleButton1.someMethod(); // 1
or
toggleButton2.someMethod(); // 2

Then once inside someMethod(), the reserved variable 'this' would refer to operations on toggleButton1 on line 1 and toggleButton2 on line 2.


Q. "But how to I use it as a symbol class?"

Let's say it's not the document class. Save the file ToggleButton.as. In your new code create a new symbol called ToggleButton for the library and in its properties you name the file ToggleButton.as

Any code after that can just declare it as in ** and use it as in 1 and 2.

Those books will be a big help.

John


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to