How can I use methods of a MovieClip that is inside a ScrollPane?
I'm using a movieClip
inside a ScrollPane
to show a list of CheckBoxes
. The amount of CheckBoxes
shown is dynamic, it depends on a SQL query. After the query is done, I add as many CheckBoxes
as rows in the result set.
What I am trying to do is to access some methods I wrote in the MovieClip
inside the ScrollPane
to get the length of the CheckBoxes
, check which ones are selected and the label they have (their label is also defined by the SQL query).
I've tried this
valueINeedToGet = Object(root).scrollPaneInstance.source.functionINeedToRun();
but it returns error #开发者_运维知识库1006
Any idea how can I access the code inside the MovieClip
inside the ScrollPane
?
Thanks!
That error is because you aren't calling your method on a particular instance of your class that extends Movieclip. Also, making the root an object type will make it into a type that isn't going to implement the function you wrote (obviously) so that call to Object(root) will always fail.
Access the scrollpane by instance name--Then :
Access the children of the Scrollpane, cast them to the class you need them to be, then call the method you need on each one.
精彩评论