This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Flash Site Design > January 2007 > Re: Site Navigation
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Site Navigation
|
|
| melissa_v 2007-01-30, 9:29 am |
| Ok, so I've figured EVERYTHING out on my own except getting the stupid
coordinates. This is the code I have:
btn_dryin_about.onRelease = function(){
_root.attachMovie("linkage_aboutPage_mc","mc_aboutPage",1);}
mc_aboutPage._x = 500
mc_aboutPage._y = 350;
When I take away "_root" the symbol aboutPage actually does change
coordinates, but not under my control (weird?). I also tried leaving the '}' to
the end to put it within the function, and that didn't work.
Like I said, all the naming is correct because everything is working other
than the coordinates. I did one practice file where I could change the
coordinates but I honestly can't see a difference.
Again, thanks for all your help - you're practically saving my life.
| |
| aniebel 2007-01-30, 9:29 am |
| I think you're having a "scope" issue. When you put code on a timeline...
whether it's the main timeline (_root) or a timeline of a movie clip, you can
refer to anything that happens on THAT particular timeline as "this". If you
put code on the main timeline and are referencing another timeline (movie clips
each have their own), then you have to tell it how to get to the other timeline.
So, if you put code on the main timeline (which is recommended) to control
everything else, you have to do some code navigation, if you will. When you use
"btn_dryin_about.onRelease..." everything within the curly braces is talking
about "btn_dryin_about" timeline. So think of it as if you've now stepped into
that button's timeline. Yes, buttons essentially have their own timelines too.
(Don't forget that the "_mc" goes at the end of the instance name in order for
Flash to assist in code.)
In order to then control something else that may sit on the main timeline, you
have to tell the code to step back out, then into the other movieclip or
button. You can use "this._parent" to take that step back since the main
timeline IS the parent of anything that sits on it. So, something like:
btn_dryin_about.onRelease = function(){
this._parent.attachMovie("linkage_aboutPage_mc","aboutPage_mc",1);
this._parent.aboutPage_mc._x = 500
this._parent.aboutPage_mc._y = 350;
}
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|