Groups | Blog | Home
all groups > flash actionscript > december 2006 >

flash actionscript : Quick Actionscript question


fwitt
12/1/2006 8:15:27 PM
If you have two superimposed movie clips, how would you refer only to the
exposed area of the bottom movie clip? Let's say that there's a large circle
with a smaller circle on top of it. If you have...

smallCircle.onPress = function() {
do something...
}

bigCircle.onPress = function() {
do something else...
}

...clicking on the small circle would be interpreted as clicking on the big
one as well. How would you get the click to apply only to the samll one?
MotionMaker
12/1/2006 8:41:55 PM
Two movie clips with instance names.
Layer over one another same layer or two different layers.


small_mc.onRelease = function()
{
trace ("small_mc - onRelease");

}

big_mc.onRelease = function()
{
trace ("big_mc - onRelease");

}

small_mc.onPress = function()
{
trace ("small_mc - onPress");

}

big_mc.onPresee = function()
{
trace ("big_mc - on press");

}
I tried
12/1/2006 8:44:37 PM
Flash should interprete the click only for the top level element. Try using
the onRelease event rather than the onPress. I very rarely (once in my
programming career) have used onPress, and only because that specific situation
required it. The onRelease event seems to handle everything much more smoothly.
fwitt
12/1/2006 8:56:24 PM
Sorry, I should have given more details. The small circle would be on the layer
on top of the big one. So draw a big circle, convert to movie clip, double
click it, draw a small circle, and convert to movie clip.
MotionMaker
12/1/2006 9:02:36 PM
[q][i]Originally posted by: [b][b]fwitt[/b][/b][/i]
Sorry, I should have given more details. The small circle would be on the
layer on top of the big one. So draw a big circle, convert to movie clip,
double click it, draw a small circle, and convert to movie clip.[/q]

Exactly. That will work with the code I posted



small_mc.onPress = function()
{
trace ("small_mc");

}

big_mc.onPress = function()
{
trace ("big_mc");

}
arunbe
12/2/2006 12:00:00 AM
I think, you are having the two movie clips inside a main movie clip.
Right ??? Now you have onPress code for the main movie, and its intrepreted
the inside movie clips onPress Actions.... Am i right ????
fwitt
12/2/2006 12:00:00 AM
arunbe
12/2/2006 12:00:00 AM
You cant do like that....
The Flash doesnt support any actions inside a button clip...
Even you are using a movie clip as a button, the Flash in turn will consider as
a buttons , so all the actions, button and movieclips inside that clip will
not a be accessable.....
AddThis Social Bookmark Button