View Full Version : targeting an MC inside a scroll pane

01-01-2003, 11:07 PM
hey there guys....i am having a some targeting issues inside of a scroll pane. heres what i have.

I have a movieclip that gets loaded into another movie clip on stage. that movieclip has a scrollpane with a movieclip inside of it, and in that clip...there are a few others clips that I am trying to target it.

So my question is ... when you use scroll panes...do you have to give that pane an instance name, and then target the scrollpane, then the clip inside and so on....? sort of like

_root.emptyclip.scrollpane.clipinsidescrollpane.se condaryclip....

or is there a simpler way for me to target it....i know it sounds a little confusing.....

since i am trying to target a clip that is inside the secondary clip inside the scroll pane, is there a shorter way for me to get at the appropriate clip rather than have to start at the bottom and work my way through them all.

thanks to anyone who can give me a hand...
cheers....and happy new year!

01-02-2003, 07:21 AM
Depends where the actions are being invoked from. See the Advanced Pathing tutorial and the section on Relative Paths. If the actions are being invoked from the internal clips then you don't have to provide the path into the scrollpane but otherwise you will have to. Keep in mind you can use tricks like this to shorten your code:
myLongPath = someMC.internal1.internal2.phewThisIsLong;
myLongPath.child._x = 100;

01-02-2003, 03:44 PM
thats great...thanks....i was able to get my targeting right by just going back one (../target) and that works properly. Oddly enough i could not get to my MC doing the full path.

When going through components...do you target the component instance name for the scroll pane, then the identifier name of the MC that is being scrolled in the pane?

Thanks for the help

01-03-2003, 12:53 AM
When you attach a component you must give it an instance name, that's what you'd use but you may find your elements are attached as immediate children of the component. It may have a more complicated structure

Clint Critchlow
01-03-2003, 10:02 PM
The path depends on how the items are placed into the ScrollPane. If it is a movie clip added by the PI or setScrollContent then use,
myPane_sp.tmp_mc._alpha=50 //tmp_mc is the target clip

If it is an SWF from loadScrollContent then use,

You can set paths from tmp_mc or loadTemp as well,

Note:Both tmp_mc and loadTemp are names that Flash creates for the path. They are not user set instance names.

01-30-2003, 03:53 PM
Hi, I've been having trouble properly targeting text fields within dup'd mc's, within the 'tmp_mc' in the scroll pane. When I trace my scrollContent var (rosterRootPath), I get the correct target, and when I trace the loop concat'd rowItem var (rowItemName), I get the correct mc instance name. But when I put it all together to access the text fields inside & trace, I get an 'undefined'.
I am new to MX (but not to Flash), and I think I just may be missing something syntax-wise about dynamic paths or targeting components.
Thanks for any help you can share.

ps. I know its redundant to get/set the scroll content var in the loop, I just did it this way to bundle the problem for debugging.

function doAddStudents() {
// Add the new Student, and store the returned Student
// object in newStudent.
for(var i=1;i<=Number(maxStudents);i++){
var rowItemName = "rowItem_"+i;
var rosterRootPath = roster_sp.getScrollContent();
newStudent = studentMgr.addStudent(rosterRootPath.rowItemName.f irstName.text,

11-09-2004, 08:16 PM

So my scrollpane is on the root timeline. It loads an empty movie clip into itself that dynamically creates a list of buttons. Here is the code on the timeline of the empty movie clip:

var posLoad:LoadVars = new LoadVars();
posLoad.onLoad = function() {
total_positions = this.total;
for (i=0; i< total_positions; i++) {
posDate = this["date" + i];
posTitle = this["title" + i];
posDesc = this["desc" + i];
clipName = "button" + i;
attachMovie("pos_btn", clipName, i);
setProperty("button" + i, _x, 0);
setProperty("button" + i, _y, 30 * i);
_root.scrollPane.tmp_mc["button" + i].title_txt.text = posDate + " / " + posTitle;
[CODE["button" + i].posDesc = posDesc;
_root.scrollPane.tmp_mc["button" + i].onRelease = function() {
_root.desc_txt.text = this.posDesc;
_root.desc_scroll._visible = (_root.desc_txt.maxscroll > 1);
// set the first one up there
if (i == 0) {
_root.desc_txt.text = posDesc;

Everything works fine except that the text that is supposed to be placed in the button:

_root.scrollPane.tmp_mc["button" + i].title_txt.text = posDate + " / " + posTitle;

Is not put in. The buttons work, the description on the root timeline updates just fine, and so forth. When I have it trace the path for the scroll pane content, it comes out as:


yet this does not seem to target the correct mc in the code that I have. I could really use anyones help on this... Deadlines, brain freeze, I got it all!


12-07-2004, 08:40 AM
i have tried all that has been told in this thread but am still unable to target the movie clip inside the scrollpane....can some one post an example fla file to show me how it should be done.......

05-29-2007, 05:16 PM
just signed up to ask a question. Seeing if I can post a message here.

05-29-2007, 05:18 PM
Flash newbie here.

I've got a Scrollpane (instance name: portfolio_sp) on the main stage in a frame (#65) labeled "packaging"

In Parameters part of Properties panel, I've set scrollpane portfolio_sp's contentPath to thumbPane_mc

About thumbPane_mc:
thumbPane_mc exists in library, its properties are set for linkage: export for actionscript, with the name thumbPane_mc

thumbPane_mc contains a number of instances of a movieclip thumb_mc.
All 10 instances have been instantiated with unique names: thumb1_mc, thumb2_mc ... thumb10_mc

I'm trying to load JPG images into those thumb mcs.

In Frame 1, I've set the following code (copied and pasted from a fla where JPGs successfully loaded into MCs located on main stage):

//loading assets or preloader
my_mcl = new MovieClipLoader();
//create instance of movieclip
my_listener = new Object();
//create instance of listener
my_listener.onLoadComplete = function(movieClip) {
//a listener to see how much has loaded
trace("Loading is done for "+movieClip);
my_listener.onLoadError = function(movieClip) {
trace("Error: "+movieClip+" did not load anything.");
trace("Your load failed for "+movieClip);

Then, in AS in frame 65 labeled "packaging" I've got this code:
my_mcl.loadClip("packaging/thumb1.jpg" , "_parent.portfolio_sp.thumbpane_mc.thumb1_mc");
my_mcl.loadClip("packaging/thumb2.jpg" , "portfolio_sp.thumbpane_mc.thumb2_mc");
my_mcl.loadClip("packaging/thumb3.jpg" , "this.portfolio_sp.thumbpane_mc.thumb3_mc");
my_mcl.loadClip("packaging/thumb4.jpg" , "thumbPane_mc.thumb4_mc");
my_mcl.loadClip("packaging/thumb5.jpg" , "thumbPane_mc.thumb5_mc");
my_mcl.loadClip("packaging/thumb5.jpg" , "thumbPane_mc.thumb6_mc");

The code above attempts different methods of addressing, none of which load the jpg image into the container MC.

What do I need to do?

Also, I'm semi clueless about trace; I don't know how to do a trace on what the scrollpane thinks it is accessing to see where I've gone wrong.