|
-
Senior Member
[mx]Getting nested clips to go to a designated frame label
I have a main movie clip (within another clip) containing a number of sub clips which are used as buttons.
I wanted to loop through the buttons in the movie clip & go to and stop at the relevant frame of the holding clip dependant on which button is pressed. Each button (clip) has a property called “monica” that gives the frame label of the frame that buttons release action should go & stop So I have something like this to set the values:
_root.hold_mc.serButs_mc.pearl_mc.monica = "pearl";
_root.hold_mc.serButs_mc.topaz_mc.monica = "topaz";
_root.hold_mc.serButs_mc.diamond_mc.monica = "sapphire";
And then this to make the whole thing work.
for (i in _root.hold_mc.serButs_mc) {
_root.hold_mc.serButs_mc[i].onRelease = function() {
_root.hold_mc.goToAndStop(_root.hold_mc.serButs_mc[i].monica)
};
}
but it don't work. Any idea how I can go about this?
You will know everything when you know you never will.
-
its a bit confusing, any chance you could provide your .fla file? Also im not sure if you can use properties in Flash like you have done, since AS takes it as an object name!?
-
Senior Member
Hi Ameretat,
Thank you for taking the time to reply.
Unfortunatly the fla is too large to upload (975 kb) I can mail it to you?
Sorry that the post is a bit confusing, but it really boils down to how you would get a movie to go & play a selected frame from a "for(i in...)" loop.
for (i in _root.hold_mc.serButs_mc) {
_root.hold_mc.serButs_mc[i].onRelease = function() {
_root.hold_mc.goToAndStop(_root.hold_mc.serButs_mc [i].monica)
};
}
With regards to your point on properties,I think you can do something like:
_root.hold_mc.serButs_mc.graphite_mc.monica = "graphite";
as you are just adding a named property to a clip?
You will know everything when you know you never will.
-
there probably isnt anything wrong with the loop. But still nothing is better that having a look at the file. Ill IM you my email. send it there.
-
Senior Member
Solution - I developed the folowing version of the "for" loop addressing the clip being pressed as "this" & then obtaining it's "monica" property from there:
for (i in _root.hold_mc.serButs_mc) {
_root["thisOne"+i] = _root.hold_mc.serButs_mc[i];
_root["thisOne"+i].onRelease = function() {
_root.hold_mc.gotoAndStop(this.monica);
};
}
You will know everything when you know you never will.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|