Right-Click object in Library,
Click Linkage
Select Export for Actionscript
Set the ToggleButton as Base class file

Groeten,
Cor van Dooren
www.codobyte.com
------------------------------------------------------------------
 "There are only 10 types of people in the world:
   Those who understand binary and those who don't."


-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John
McCormack
Sent: zondag 19 december 2010 12:51
To: Flash Coders List
Subject: Re: [Flashcoders] My first code.

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


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1170 / Virus Database: 426/3320 - Release Date: 12/16/10

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

Reply via email to