PDA

View Full Version : i got a MC working, but then i moved it. paths question


scottkenyon
05-30-2005, 04:16 AM
i had this movie working fine, until i put the MC inside of the scroller MC.

Now I can't figure out how to relink the paths.
can anyone help me here?

here's the part i'm struggling with

MC.mylink.text = sgig1URL;
trace(MC.mylink.text);
MC.onRelease = function() {
getURL("http://"+MC.mylink.text, "_blank");
};

it worked fine while it was on the main timeline, i need it to work from within the scroller...

any help?

icio
05-30-2005, 11:38 AM
give the scrollbar an instance name and then reference the `MC` movieclip using:
/*scrollbarInstanceName*/ .MC.onRelease = function() {
//...
}
replace /*scrollbarInstanceName*/ with the instance name you gave to the scrollbar.

hope this helps :)

Navarone
05-30-2005, 11:45 AM
The code is looking for the movieclip on the main time line since you have it inside another movieclip, try adding _root to the path. I didn't have your text file to test it but thats my opinion. What does the trace(_root.MC.mylink.text); give you when you run the code? :)

_root.MC.mylink.text = sgig1URL;
trace(_root.MC.mylink.text);
_root.MC.onRelease = function() {
getURL("http://"+_root.MC.mylink.text, "_blank");
};

scottkenyon
05-30-2005, 01:53 PM
thanks guys..
i tried that. the scroller has instance name scroller, and i tried writing out the entire path.

also, i tried using _root, and i tried using level 0, since that's where the variables load into in frame one.

neither worked.

navarone, your suggestion made sense to me, i thought that was correct, but i get a trace value of undefined. it should be a link to http://www.harpersferryboston.com

btw, my band plays there tuesday night if you're anywhere near north america

here's the text file to test with...

scottkenyon
05-30-2005, 02:07 PM
...because i've read all the relative tuts at least twice, and i thought i understood them. for a designer with no programming background, this isn't exactly a cakewalk! much respect to all of you that have got it down cold. :cool:

icio
05-30-2005, 02:22 PM
post your fla ?

scottkenyon
05-30-2005, 02:46 PM
here it is, it's slightly newer attempt at what i did on the first post...

icio
05-30-2005, 06:46 PM
ah ok, i get it -
i put:
trace(this); in the first frame of your MC movieclip and found out that you need to reference it using:
`_root.scroller.spContentHolder.MC`

and so your code becomes:
_root.scroller.spContentHolder.MC.onRelease = function() {
getURL("http://"+_root.scroller.spContentHolder.MC.mylink.text, "_blank");
};

:D

scottkenyon
05-30-2005, 07:08 PM
yes, that did it!

thanks so much, how did you figure that out? is there a help file or tutorial i should look at for that, or did you just know that?

and thanks!

icio
05-30-2005, 08:11 PM
no, i accessed the url movieclip through the library and puttrace(this)in it so that it returned it's path from the root and it traced

_level0.scroller.spContentHolder.mc

so that's how i knew. from this i discovered that `spContentHolder` is the instance name of the movieclip within the scrollPane that the movieclip you want to scroll is attached as. Probably using this sort of method:

scrollPane.attachMovie(movieToScroll, "spContentHolder", 0);

:)