Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-23-2006, 05:03 PM   #1
Registered User
Join Date: Feb 2006
Posts: 5
Exclamation attachMovie in Scrollpane

I need to attach an MC from the library to the content in a scrollpane, but can't seem to figure out the right line of code to do it.

This works perfectly for creating an empty movie clip at _root and attaching the movie clip from the library:
var myButton = _root.createEmptyMovieClip("btnName", _root.getNextHighestDepth());
var myButton_mc = myButton.attachMovie("btnAdd", "btnAdd_mc", 0);
Now I need to do the same in a scrollpane. For a separate purpose in this scrollpane, I have successfully created an empty movie clip and loaded an external JPG using:
_root.scrollpane.content.createEmptyMovieClip("image1", _root.scrollpane.content.getNextHighestDepth());
_root.scrollpane.content["image1"]._x = 5;
_root.pipeMenuPane.content["image1"]._y = 5;
var imageMCLoader:MovieClipLoader = new MovieClipLoader();
imageMCLoader.loadClip("image.jpg", _root.scrollpane.content["image1"]);
So I thought this would work to create an empty movie clip in the scrollpane and attach a movie clip to it:
var BtnHld = _root.scrollpane.content.createEmptyMovieClip("btnName", _root.scrollpane.content.getNextHighestDepth());
var Btn_mc = BtnHld.attachMovie("btnAdd", "btnAdd_mc", 0);
Sadly, that doesn't work.... The create empty movie clip works and traces correctly, but tracing the Btn_mc for the attachMovie returns undefined, and the movie clip remains empty.

Since this works to attach to _root, and even to _root.scrollpane (which creates movie clips that don't move when the scrollpane is scrolled and float over its content), I'm baffled why I can't get this to work.


asismyfriend is offline   Reply With Quote
Old 02-23-2006, 05:19 PM   #2
Registered User
Join Date: Feb 2006
Posts: 5

Decided to get up from my desk for a few minutes for a much-needed break, and it occurred to me that attachMovie doesn't in any way clarify what library to look in, so it must be context sensitive. Had the thought that maybe it got that context based on where it was attaching the movie clip rather than from where it was called, which would mean the SWF in the scrollpane would need the image in its library in order to have any idea what "btnAdd" was.

I moved the button image to the FLA used in the scrollpane, republished its SWF and it worked.

Good reminder to take a break every now and then when things get confusing....
asismyfriend is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
scrollpane content load whatknows Components 1 09-22-2005 02:53 AM
Scrollpane component inside a window component marcusg Components 2 04-07-2005 04:20 AM
attachMovie and scrollPane -- Depth Issue? aestheto Components 3 12-03-2004 01:15 AM
attachMovie and scrollPane ... pretty close? aestheto Components 1 12-01-2004 05:20 PM
scrollPane problem with AttachMovie - pictures disappers when scrolling.. mOnkEymAn Components 1 07-30-2004 07:23 PM

All times are GMT. The time now is 01:50 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.