View Full Version : access display objects from within scrollpane instance?

09-25-2007, 06:24 PM
I seem to have a similar problem to this post here:


But the answer provided doesn't appear to work.

Very simply, I create an instance of a scrollpane on my stage and I load in a mc from my library that has another mc nested within. I want to access that nested mc and I don't seem to be able to:

import flash.display.MovieClip;
import fl.containers.ScrollPane;
//MyBox is the class name of the mc in my library
var myMovieClip:MyBox = new MyBox();
var myScrollPane:ScrollPane = new ScrollPane();
myScrollPane.name = "myScrollPane";
myScrollPane.source = myMovieClip;

When I run this I get the following error:

1119: Access of possibly undefined property nested_mc through a reference with static type flash.display:DisplayObject.

If I try to access the nested_mc as suggested in the link I posted up top b using a trace function like this:

trace(MovieClip(myScrollPane.content.nested_mc).al pha)

I get the same error...

What gives? What is the best way to access content within the scrollpane component?

Any advice is greatly appreciated!

04-07-2008, 01:21 PM
To access a movieClip within a scrollPane:

// create a scrollPane
var aSp:ScrollPane = new ScrollPane();

// add to the stage

// set the source (movieClip dragged on stage)
aSp.source = mc1;

// to access the movieclips alpha (for example)
aSp.source.alpha = 0.5;

// to access a textfield within the movieclip
aSp.source.txt_field.text = "some text here";

Hope this helps ;)