natalia Vikhtinskaya wrote:
> On main timeline I have
> var countN:int=0; // this numberl be changed later
> var clip_mc = new clip_mc(); // this clip is placed in library
> addChild(clip_mc);
>
> How can I read countN inside clip_mc?
I would pass in a reference to the timeline to the clip_mc.
You will need to have a class with a constructor for the clip_mc. For
example, set the linkage of clip_mc to ClipClass, and create this AS
file:
package
{
public class ClipClass extends MovieClip
{
private var myRoot:MovieClip;
private var parentCount:Number;
public function ClipClass (pMyRoot:MovieClip)
{
myRoot = pMyRoot;
}
private function getCount():Number
{
parentCount = myRoot.countN;
}
}
}
There are undoubtedly errors in this--it's just e-mail ActionScript,
but it should be enough to get you going.
I would recommend very strongly against timeline programming in
ActionScript 3, though. It's designed for OOP, and you'll find your
code much more manageable if you use OOP practices. Instead of putting
code on the timeline, put it in a class, and make that your document
class.
Cordially,
Kerry Thompson
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders