View Full Version : attachMovie and setMask, help please
marws
July 21st, 2005, 08:34 AM
Hello, i am working on a piece of code, it does not seem very complicated but I am stuck, here is the deal:
I have a empty mc on top of another mc with a figure in it, using set mask I make the empty mc work as a mask over the figure, nothing shows, great. Now I want to have the user click on empty mc and attach a mc inside it to mask the figure and show a little piece of it. And it just does not happen.
here is the code:
empty_mc.onRelease=function(){
this.attachMovie("ball", "b", 2);
}
empty2_mc.setMask(empty_mc);
Also I need to duplicate the ball mc , so every time the user clicks on empty mc a smal piece of the figure shows
Dont know if I am making myself clear, but I really need help with this
Thanks in advance
stringy
July 21st, 2005, 10:12 AM
Hello, i am working on a piece of code, it does not seem very complicated but I am stuck, here is the deal:
I have a empty mc on top of another mc with a figure in it, using set mask I make the empty mc work as a mask over the figure, nothing shows, great. Now I want to have the user click on empty mc and attach a mc inside it to mask the figure and show a little piece of it. And it just does not happen.
here is the code:
empty_mc.onRelease=function(){
this.attachMovie("ball", "b", 2);
}
empty2_mc.setMask(empty_mc);
Also I need to duplicate the ball mc , so every time the user clicks on empty mc a smal piece of the figure shows
Dont know if I am making myself clear, but I really need help with this
Thanks in advance
maybe
var i = 1;
empty_mc.onMouseDown = function() {
var clip = this.attachMovie("ball", "b"+i, i);
clip._x = this._xmouse;
clip._y = this._ymouse;
i++;
};
empty2_mc.setMask(empty_mc);
marws
July 21st, 2005, 10:33 AM
Thanks man, that is what I figure out, my problem now is that when the figure is completly masked another mc has to play, I was tracking the number of clicks on the empty_mc to make this happen, but using mouseDown keeps the focus on the whole stage and not just on the mc, and I can not use on release now, I have no ideia how to make flash detect when the whole figure is showing
any hints?
thanks again for the replay
stringy
July 21st, 2005, 11:41 AM
Thanks man, that is what I figure out, my problem now is that when the figure is completly masked another mc has to play, I was tracking the number of clicks on the empty_mc to make this happen, but using mouseDown keeps the focus on the whole stage and not just on the mc, and I can not use on release now, I have no ideia how to make flash detect when the whole figure is showing
any hints?
thanks again for the replay
try this
var i = 1;
myarray = [];
for (var x = 0; x<6; x++) {
for (var y = 0; y<5; y++) {
myarray.push({X:-10+x*2*28/3, Y:-15+y*2*40/3});
}
}
function shuffle() {
return Math.floor(Math.random()*3)-1;
}
myarray.sort(shuffle);
empty_mc.onMouseDown = function() {
if (empty2_mc.hitTest(_root._xmouse, _root._ymouse)) {
var clip = this.attachMovie("ball", "b"+i, i);
clip._x = myarray[i].X;
clip._y = myarray[i].Y;
i++;
if (i>myarray.length+1) {
this.onMouseDown = null;
trace("done");
}
}
};
empty2_mc.setMask(empty_mc);
marws
July 21st, 2005, 01:00 PM
thank you
thank you
thank you
Using the power of copy+paste I was able to use your code, and worked great, but to be honest I have no idea of what that array or those math are doing.
Please, could you give me a brief explanation??
thanks a lot man
stringy
July 21st, 2005, 02:49 PM
thank you
thank you
thank you
Using the power of copy+paste I was able to use your code, and worked great, but to be honest I have no idea of what that array or those math are doing.
Please, could you give me a brief explanation??
thanks a lot man
you are welcome
its just a modified grid. 28 is the _width of your clip and i approximated that if the clips were at 2/3 their width apart there would be no holes.However there was a little bit not covered on the left so i subtracted a few pixels.similarly with _y.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.