|
-
The easiest way would be to use the ._name function.
The issue with this is it will call what ever the rollover is set on which would be the holding mc in 99% of cases.
Creating a rollover for each individual item would be impractical.
This mean you have 2 option create a listener for onRollOver of the movie clips, or create a loop and have all the names within an array.
Personally I would go for option 2 as it gives you the most flexibility and it will work.
The example has been tested in CS3 AS2, working 100%, just place the code in the _root timeline actions.
I have commented so you know what is going on.
I have a holding mc called holder, and all the item inside I which to have the rollover text has an instance of B[i], aka, B1, B2, B3, B4
Code:
Item = "";
//Contains the item number to pull from the array
tempItem = "";
//Contains the instance name you rollover Ie: B1
var naming:Array = new Array("square", "circle", "pentagon", "triange");
//List of the names you which to appear in your text, Starting with item B1
onEnterFrame = function(){
//Function is check constantly at the frame rate from the moment you enter the frame
for (i=1; i<=naming.length; i++) {
//Loop for the rollover items. i = Starting instance number, i<= The length of your array, ie number of items
holder["B"+i].onRollOver = function () {
//Holder is the holding mc, the child mc's refering to B + i, the item length, when mouse goes over start the check process
tempItem = this._name;
//Set Temp item as the instance name you rolledOver
Item = tempItem.substring(1);
//Remove the starting letter from the instance
trace(naming[Item-1]);
//THIS IS A TRACE IT IS NOT REQUIRED
//Though this will trace the name of the item from the array, arrays start at 0 hence item-1
}
}
}
All you need to do is refer your dynamic text to the trace which you will want to replace with
Code:
var = naming[Item-1];
Where var is the name your dynamic text is looking for
Lastly you will want to add a function to clear the dynamic text when nothing is selected as a guess
Also guessing you will want to get the text item to follow the mouse.
Both are fairly simple, I wish you the best of luck.
If all is good pls Mark as Resolved 
Thanks
Mr Wabbit
P.s I almost forget if you want something more powerful, I advise goggle, AS2 ToolTip.
Last edited by Mr Wabbit; 02-01-2013 at 01:49 PM.
Trust my code, and not my english.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|