|
-
Angkor-What?
Dynamicaaly create button/movieclip
Hi,
I was wondering if the next is possible and how it would be possible. I want to create buttons dynamically with code. So not attaching a mc form the library but create one! Well there is no such thing as createButton() right? So I thought maybe with createEmptyMovieClip. But is there a way to 'fill in' multiple frames with dynamic created stuff...? I want to create a movieclip in which the first frame is the up state, the second is the over state etc etc...
Cheers,
Bart
MX 2004 Pro - Oops I did it again!!!
SWF, it's a journey... not a destination
-
Banned
Hi,
Just something I came up with quickly that could probably be improved...
Single button....
code:
myButton = _root.createEmptyMovieClip("button", 10);
with (myButton) {
lineStyle(2, 0xFF0000);
beginFill(0xFF0000, 50);
moveTo(200, 200);
lineTo(250, 200);
lineTo(250, 250);
lineTo(200, 250);
lineTo(200, 200);
endFill();
}
myButton.onRollOver = function() {
trace("Mouse is on me!");
myButton.clear();
with (myButton) {
lineStyle(2, 0xFF0000);
beginFill(0x0000FF, 100);
moveTo(200, 200);
lineTo(250, 200);
lineTo(250, 250);
lineTo(200, 250);
lineTo(200, 200);
endFill();
}
}
myButton.onRollOut = function() {
trace("Mouse is off me!");
myButton.clear();
with (myButton) {
lineStyle(2, 0xFF0000);
beginFill(0xFF0000, 50);
moveTo(200, 200);
lineTo(250, 200);
lineTo(250, 250);
lineTo(200, 250);
lineTo(200, 200);
endFill();
}
}
myButton.onPress = function() {
trace("I was pressed");
}
myButton.onRelease = myButton.onReleaseOutside=function () {
trace("I was released");
}
-
Angkor-What?
Very nice... this will work perfectly for me!
Thanx a million!!!
MX 2004 Pro - Oops I did it again!!!
SWF, it's a journey... not a destination
-
Angkor-What?
Is there a way to do a line2fill with coding? The corners are rounded with lineTo...
I know I know... mr pixel perfect but just wondering!
Cheers
MX 2004 Pro - Oops I did it again!!!
SWF, it's a journey... not a destination
-
Banned
Not sure what your referring to. Maybe try a thinner lineStyle....
lineStyle(1, 0xFF0000);
The value 0 indicates hairline thickness; the maximum thickness is 255.
-
Angkor-What?
Alright thanx, I treid with 1.... but ofcourse didn't think of 0!
Cheers
MX 2004 Pro - Oops I did it again!!!
SWF, it's a journey... not a destination
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
|