Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : how to access linked movie clip via DOT syntax???


adamteam
5/14/2004 11:53:16 PM
I have a movie clip that exists only in the library linked to a scrollpane
component using its linkage identifier. It scrolls perfectly. However, in the
movie clip there are additional movie clips I wold like to control, but for
that I need to be able to access them using DOT syntax. How can this be
done???? I'm assuming that since the movie clip in the library has "export in
first frame" checked that I would be able to access it somehow like this:
_root.movieclipidentifier but that doesn't work. PLEASE HELP!
kglad
5/15/2004 12:42:35 AM
you have to instantiate a movieclip before you can control it. you could use
attachMovie() for your additional movies after you give them linkage ids. or
you could use attachMovie() on your _parent movieclip and then control the
children by referencing them with dot notation. an example of the later would
be:

_root.attachMovie("mc1","newMC",1); // mc1 is the linkage id of a movieclip
that is _parent to mc2
// newMC.mc2 is the correct reference to control mc2.
adamteam
5/15/2004 8:21:54 AM
wow! i can't tell you how much you've taught me.
However, it still doesn't work. Here's the heart of the problem:
the only way to set the Scoll Pane content is through either A) entering the
Linkage ID of the content movie in the "Scoll Content" field in the Properties
pane, or B) using actionscript's "setScrollContent" if you used attachMovie()
to load the pane dynamically.
Both times the content movie is referenced using its Linkage ID. But that
doesn't give me DOT syntax access to the content movie. If I were to attach the
content movie to my parent clip using attachMovie() the content movie would
just be another attached movie clip, it wouldn't show up in the scroll pane as
the scroll pane links to content using the idetifier.
What I need is some way to access the Content Movie (and all the movie clips
it contains). Hypothetically, it would look like this (assuming a dynamically
loaded scroll pane using attachMovie()):

[movie clip the scroll pane is attached to].[scroll pane].[scoll pane content
movie].[additional clip contained in content movie]

But there is currently a disconnect where I put the "//"

[movie clip the scroll pane is attached to].[scroll pane] // [scoll pane
content movie].[additional clip contained in content movie]

How do I access the movie clip that is the content to the scroll pane?
rlc5611
5/15/2004 11:19:50 AM
I just made a little experiment and placed a trace(this._name) in a clip that
is loaded into the scrollpane and it came back as

spContentHolder

So I placed a MC (called colorbox) inside the clip that is loaded into
scrollpane (which has an instance name of mypane) and I was able to access it
and control it as

mypane.spContentHolder.colorbox

so I think the "spContentHolder" is the key piece of the puzzle.
rlc5611
5/15/2004 11:59:49 AM
That previous experiment was for the MX 2004 scrollpane. I just tried it with
the MX scrollpane and it came back as

tmp_mc

for both scrollpanes in UI component sets 1 and 2

So the three scrollpanes give their clips different names. To be certain,
temporarily do the trace(this._name) on you paned clip to see what your version
of the scollpane's clip name is. Either way, it has a name and can be
controlled once you know what that name is. The linkage identifier does not
appear to be used anywhere other than to tell the scrollpane what to load.
AddThis Social Bookmark Button