So far I have a set of functions that are doing exactly as told. But I need to modify the set to be able to work on the parent but the listeners need to be on a child movieclip with the name clickarea or something similar to that. Basically I have a series of shapes that overlap eachother and as is its difficult to get some of the shapes to trigger because of others getting in the way. By having the smaller clickable area within the parent MC this issue will be resolved. But I’ve been having a killer of a time trying to get this to work. Please help.
stop();
import flash.external.*;
import flash.display.MovieClip;
function mapTree():void {
var paths:Array = new Array();
paths[0] = "magician";
paths...
var orbs:Array = new Array();
orbs[0] = "kether";
orbs...
var buttons:Array = orbs.concat(paths);
for (var i:int = 0; i < buttons.length; i++) {
var branch:String = buttons*;
var elem:MovieClip = this[buttons*];
elem.addEventListener(MouseEvent.MOUSE_OVER, tweenForward);
elem.addEventListener(MouseEvent.MOUSE_OUT, tweenBackwards);
elem.addEventListener(MouseEvent.CLICK, sproutInfo(branch));
}
}
function sproutInfo(branch:String):Function {
var foo:Function = function (evt:MouseEvent):void {
var jsFunc:String = "sprout";
var id:String = String(branch);
var className:String = "";
ExternalInterface.call(jsFunc, id, className);
}
return foo;
}
function tweenForward(e:MouseEvent) {
var tar:* = e.currentTarget;
tar.removeEventListener(Event.ENTER_FRAME, loopBackwards);
tar.addEventListener(Event.ENTER_FRAME, loopForward);
}
function tweenBackwards(e:MouseEvent) {
var tar:* = e.currentTarget;
tar.removeEventListener(Event.ENTER_FRAME, loopForward);
tar.addEventListener(Event.ENTER_FRAME, loopBackwards);
}
function loopForward(e:Event) {
var tar:* = e.currentTarget;
if (tar.currentFrame == tar.totalFrames) tar.removeEventListener(Event.ENTER_FRAME, loopForward);
else tar.nextFrame();
}
function loopBackwards(e:Event) {
var tar:* = e.currentTarget;
if (tar.currentFrame == 1) tar.removeEventListener(Event.ENTER_FRAME, loopBackwards);
else tar.prevFrame();
}
mapTree();