-
on(press) on a generated button
hey, was looking through some movies and found the old mono* menu done by "legus" (http://www.flashkit.com/movies/Inter...-269/index.php)
i can't seem to figure out how to put links on the buttons cause they are generated by AS
any help appreciated
Last edited by shorty116; 04-16-2006 at 09:44 AM.
-
All 1s and 0s
Hi,
Go into movBut, and alter the code like this:
code:
var labelArray = ["First Item", "Another Item", "Home", "Images", "Links", "Six", "7", "Ate", "Neuf", "Final Item"]
trace(labelArray);
while (Number(n)<19) {
n = Number(n)+1;
bn = "kv" add n;
duplicateMovieClip("kv", bn, n);
setProperty(bn, _x, Number(getProperty(bn, _x))+Number(n*getProperty(bn, _width)));
setProperty(bn add "/b", _x, getProperty (bn add "/b", _x) + (random (20)+1));
set(bn add ":n", n);
if (Number(n)<10) {
trace(labelArray[n]);
set(bn add ":text", labelArray[n]);
} else {
set(bn add ":text", labelArray[n-10]);
}
}
There seems to be a glitch with the first item though, so you need to manually change the text in the box on the stage to the same value as your first item.
"If I have seen further, it is by standing on the shoulders of giants." - Sir Isaac Newton
-
thanks i needed this information, too. but what i intenionally wanted to know was how can i put like an "on (press)" action on the different items?
-
-
All 1s and 0s
This is just a cheap fix. If you want better, you'll probably want to rewrite the code to a more modern specification.
Change the code on movBut like this:
code:
kv.b.onPress = function() {
//Behaviour for the first item;
}
while (Number(n)<19) {
n = Number(n)+1;
bn = "kv" add n;
duplicateMovieClip("kv", bn, n);
setProperty(bn, _x, Number(getProperty(bn, _x))+Number(n*getProperty(bn, _width)));
setProperty(bn add "/b", _x, getProperty (bn add "/b", _x) + (random (20)+1));
set(bn add ":n", n);
this[bn].b.onPress = function() {
//Behaviour for all other items;
}
if (Number(n)<10) {
set(bn add ":text", "item " add n);
} else {
set(bn add ":text", "item " add (n-10));
}
}
You also might need to increase the publish settings to at least Flash Player 6.
"If I have seen further, it is by standing on the shoulders of giants." - Sir Isaac Newton
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
|