Discussion:
Interaction between MC's
(too old to reply)
Cyman666
2009-03-23 15:38:02 UTC
Permalink
Ok, i have a scene, the background is a movie clip named "landscape_mc" which
is an animation stopped on frame 1.

on a layer above that i have another movieclip named "navigate_mc",within
this movieclip i have a set of buttons.

What i'd like to be able to do is when i click on one of these buttons it goes
to frame 39 of the "landscape_mc" movieclip.

the movieclip "navigate_mc" is also set to be draggable.

ive tried a few things but keep getting "Access of undefined property" errors.
Im guessing because my button instances names are set within its own movieclip
that it doesnt recognise them when playing the scene.

heres my code:

navigate_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
navigate_mc.addEventListener(MouseEvent.MOUSE_UP, mouseReleasedHandler);

function mouseDownHandler(e:MouseEvent):void {
navigate_mc.startDrag();
}

function mouseReleasedHandler(e:MouseEvent):void {
navigate_mc.stopDrag();
}

portal_btn.addEventListener(MouseEvent.CLICK,gotoframe);

function gotoframe(evt:Event):void {
landscape_mc.gotoAndStop ("39");
}

stop();

im fairly new to AS3 so im hoping theres a simple fix :)

many thanks in advance
NedWebs
2009-03-23 16:17:11 UTC
Permalink
If that code is in the timeline that contains landscape_mc and the navigate_mc,
then need to target the buttons thru thenavigate_mc.

navigate_mc.portal_btn.addEventListener(MouseEvent.CLICK,gotoframe);

With those mouse events assigned to the navigate_mc, it will be blocking mouse
access to the buttons.
Cyman666
2009-03-23 16:24:22 UTC
Permalink
Thanks once again Ned thats spot on, and it makes perfect sense too, another lesson learned :)
NedWebs
2009-03-23 17:18:04 UTC
Permalink
You're welcome

Loading...