Skip to main content
Inspiring
March 9, 2009
Question

masking an image inside a dynamic mc

  • March 9, 2009
  • 13 replies
  • 1013 views
I have a 8x 10 array of mcs on stage each which contains a small image. So, there are 8 parent clips (columns) each containing 6 child clips containing the thumbnail images. If the movie clip arrays are created dynamcally (therefore loaded into the top layer) how can I mask them? I'd like to be able to mask 1 vertical (parent) column at a time (so only 1 of the 8 columns (6 images) is visible.
(I used to do this by creating the mc array in advance and it was easy)
thanks,
chop
This topic has been closed for replies.

13 replies

kglad
Community Expert
Community Expert
March 10, 2009
you're welcome.

you can either use the onLoadInit() to determine when you can assign your onRelease handlers or even easier: load into a child of thumbSet_mc[thisColName][thisClipName] and leave your onRelease defined for the parent.
Inspiring
March 10, 2009
Ahhh! Okay I get it.

Not all images have loaded. The script runs ahead a little. A coule of extra frames or a Listener for the loadMovieClip.. yes, that's it.
I suppose I'll have ti set up some sort of polling procedure for the .onRelease() . I can't "hard wire" in every possibility of mc1... etc if there are 50-100 clips. Although I DO know which column is showing, so that narrows it down a little.

thanks
Inspiring
March 10, 2009
Yes, but that comes before defining the onRelease doesn't it?
kglad
Community Expert
Community Expert
March 10, 2009
no? what's

image_mcl.loadClip("rich.jpg",thumbSet_mc[thisColName][thisClipName]);
kglad
Community Expert
Community Expert
March 10, 2009
thumbSet_mc.col3_mc.mc3.onRelease=function()

will fail if:

1. there is a mouse handler defined for thumbSet_mc or thumbSet_mc.col3_mc or

2. you loaded something into one of those ancestors of mc3 AFTER defining the onRelease.
Inspiring
March 10, 2009
I don't think I've done either of the two you listed. My script is as follows:

Inspiring
March 10, 2009
I've come across one more, hopefully final, glitch in this method:

thumbSet_mc.onRelease=function() // this works when I click on any of the columns


thumbSet_mc.col3_mc.onRelease=function() // this works when I click on the particular column targeted


thumbSet_mc.col3_mc.mc3.onRelease=function() // this doesn't work when I click on the individual target "mc3" or any of the grandchildren of thumbSet_mc.

Is it because I've loaded an image into the grandchild? That's the only difference between the 3 "generations".
thanks in advance for your help
kglad
Community Expert
Community Expert
March 10, 2009
you're welcome.

by changing matrixMask_mc's x property so it covers one column, you reveal that column and hide the others.
Inspiring
March 10, 2009
Ok. I make "thumbSet_mc" the parent of all.
THEN:
thumbSet_mc.setMask(matrixMask_mc);
This made all columns invisible.

THEN:
I put the "matrixMask_mc" clip so it covered the col1_mc on the left of the stage. This made it visible, keeping the others invisible. The same "mask" both show AND hides objects. I guess that's what I had trouble with, as well as the use of [ ] within dot syntax.

Anyway I think I get it.
Thanks for your assistance once again
Chop
kglad
Community Expert
Community Expert
March 9, 2009
levels/depths make no difference when using actionscript to assign a mask. flash handles that for you.

when using the authoring environment to assign a mask, layers/depths do make a difference.
Inspiring
March 9, 2009
okay, that makes sense. Suppose I have the following:
thumbSet_mc.col1_mc.mc1

"thumbSet_mc" = the grandParent
"col1_mc" , "col2_mc" ,"col2_mc"etc. = the children of "thumbSet_mc"
"mc1, m2, mc3" etc = the grandChildren of "thumbSet_mc"

Does each clip have to be on a separate level? I.E can "thumbSet_mc" and its children "col1_mc, col2_mc etc." be on the same level?

This is the most perplexing thing, levels, ...what can exist on the same level? I'm thinking that disassociated (unrelated) mcs need a separate level but is seems that children should be on the same level as their parent. Else it would be like a "dysfunctional family"!