dev09
asked on
Flash AS2 - on(press) to attach MovieClip and reveal image
Hi Guys,
I'm stuck on some code I hope someone can help with. It's Actionscript 2 in Flash CS4.
I have a MovieClip that i want to attach to the Stage onClick, and for that to start to reveal an image on the lowest layer. I have a MovieClip which i want to gradually be remove(masked) everytime i click. So onClick 'newName' will affect 'maskMC' to reveal the image underneath.
This is what i have so far...
Hope someone can help.
Thanks
I'm stuck on some code I hope someone can help with. It's Actionscript 2 in Flash CS4.
I have a MovieClip that i want to attach to the Stage onClick, and for that to start to reveal an image on the lowest layer. I have a MovieClip which i want to gradually be remove(masked) everytime i click. So onClick 'newName' will affect 'maskMC' to reveal the image underneath.
This is what i have so far...
on(press) {
_root.clickAmount++;
// ATTACH MOVIE
newName = "crack"+_root.clickAmount;
_root.attachMovie("crackMC", newName, _root.clickAmount, {_x:this._x, _y:this._y});
// MASK
_root.newName.setMask(maskMC); // This doesnt work, not sure how to make it work
}
Hope someone can help.
Thanks
You have to create mask for each movieclip (new instance)
By the way try this code
on(press) {
var depth:Number = _root.getNextHighestDepth( )
// ATTACH MOVIE
var mc:MovieClip = _root.attachMovie("crackMC ", "crack" + depth, depth, {_x:this._x, _y:this._y});
// MASK
mc.mask = maskMC; // This doesnt work, not sure how to make it work
}
I don't know where did you get setMask command
on(press) {
var depth:Number = _root.getNextHighestDepth(
// ATTACH MOVIE
var mc:MovieClip = _root.attachMovie("crackMC
// MASK
mc.mask = maskMC; // This doesnt work, not sure how to make it work
}
I don't know where did you get setMask command
I attach an example
Example.fla
Example.fla
ASKER
Hi dgofman,
Thanks, i've had a play with your file and it's close but doesn't quite solve the problem i have.
I have added a test tree image to your file, when I click it shows only that one part of the tree. I want to click all over the place and reveal the full image... is this possible?
Thanks
Example.fla
Thanks, i've had a play with your file and it's close but doesn't quite solve the problem i have.
I have added a test tree image to your file, when I click it shows only that one part of the tree. I want to click all over the place and reveal the full image... is this possible?
Thanks
Example.fla
ASKER
Hi dgofman,
So close... thank you so much for what you have done, its great.. but can we set it to on Click, rather than on drag... only when you click it will use a movie clip from the library to appear where clicked to reveal the photo of the tree.
Thank you so much!
So close... thank you so much for what you have done, its great.. but can we set it to on Click, rather than on drag... only when you click it will use a movie clip from the library to appear where clicked to reveal the photo of the tree.
Thank you so much!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect, thank you so much!