I have been busy building the UI for a class file I wrote a while ago.
The problem I have is in referencing the symbols on the TimeLine. All the symbols have an instance name, and only exist in the first frame (main timeline has only one frame anyway).
At the moment I am instantiating my AS3 class file from a timeline layer using
import circles.Spirograph;
var circles:Spirograph = new Spirograph(stage);
so I have a reference to the stage in my class file.
If I have library ScrollBar on the stage called sb1 then how do I access it in the class file, and how can I get its value?
There are a few ways. If Spirograph is a DisplayObject it will have a “root” property. You can cast this property to a MovieClip and then access sb1:
Another option is to pass “this” into the Spirograph constructor, since you’re instantiating on the timeline, “this” is referring to the timeline:
Then you’re stage variable could be obtained like so:
There are a few more ways but those are the most common.