Greetings fellow air-breathers!
I’ve got this little flash thing I’m working on…
[SIZE=7]HERE
[SIZE=2]
And I’m having a hard time figuring out how to deal with the problem of the stars overlapping the label box… Its definitely because I’m using _root.getNextHighestDepth in both attachMovie’s
But I can’t figure out how to change it so that the label_mc’s and the star_mc’s are on two different playing fields if you know what I mean…
[SIZE=7]
THE CODE
[SIZE=2]
var xcord_a:Array = new Array();
var ycord_a:Array = new Array();
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("xml.xml");
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
xcord_a.push(String(xmlNode.childNodes*.childNodes[0].firstChild.nodeValue));
ycord_a.push(String(xmlNode.childNodes*.childNodes[1].firstChild.nodeValue));
/*** HERE ***/
_root.attachMovie("star_mc", ["star"+i+"_mc"], _root.getNextHighestDepth(), {_x:xcord_a*, _y:ycord_a*});
_root.attachMovie("label_mc", ["label"+i+"_mc"], _root.getNextHighestDepth());
/************/
_root["star"+i+"_mc"].index = i;
_root["star"+i+"_mc"].onRollOver = function() {
_root["label"+this.index+"_mc"]._x = _root._xmouse;
_root["label"+this.index+"_mc"]._y = _root._ymouse;
fadeIn(this.index);
};
_root["star"+i+"_mc"].onRollOut = function() {
cur = _root["label"+this.index+"_mc"]._currentframe;
_root["label"+this.index+"_mc"].gotoAndPlay(22-cur);
_root["label"+this.index+"_mc"].stopDrag();
};
}
} else {
trace("ERROR");
}
}
function fadeIn(theIndex) {
var labelHeight:Number = _root["label"+theIndex+"_mc"]._height;
var labelWidth:Number = _root["label"+theIndex+"_mc"]._width;
var stageWidth:Number = Stage.width-labelWidth;
var stageHeight:Number = Stage.height-labelHeight;
if (_root["star"+theIndex+"_mc"]._y>stageHeight && _root["star"+theIndex+"_mc"]._x>stageWidth) {
trace("BOTH");
_root["label"+theIndex+"_mc"].labelCont_mc.labelPos_mc._x = (-1)*(labelWidth/2+15);
_root["label"+theIndex+"_mc"].labelCont_mc.labelPos_mc._y = (-1)*(labelHeight+10);
} else if (_root["star"+theIndex+"_mc"]._y>stageHeight) {
_root["label"+theIndex+"_mc"].labelCont_mc.labelPos_mc._y = (-1)*(labelHeight+10);
} else if (_root["star"+theIndex+"_mc"]._x>stageWidth) {
_root["label"+theIndex+"_mc"].labelCont_mc.labelPos_mc._x = (-1)*(labelWidth+20);
} else {
trace("TOP/LEFT");
}
_root["label"+theIndex+"_mc"].gotoAndPlay(2);
_root["label"+theIndex+"_mc"].startDrag(true);
}
Can anyone offer me some wisdom?
[FONT=Courier New][LEFT]
[/LEFT]
[/FONT]
[/SIZE] [/SIZE] [/SIZE][/SIZE]