|
-
I'm not afraid
Dragging createEmptyMovieClips
Hey Guys,
After creating empty movie clips is there any possible way to drag them?
Heres the creation code:
Code:
on(press) {
_root.createEmptyMovieClip("factor",_root.numFactors);
with (_root.factor) {
beginFill(0xFF0000, 25);
lineStyle(1, 0x000000, 100);
lineTo(240, 110)
lineTo(0, 220)
lineTo(0, 0)
endFill()
}
_root.numFactors++;
_root.numFactors = 1;
}
It just creates another triangle over the last each time I click the button.
I want to be able to drag them each individually. Any ideas would be much appreciated.
Thanks,
Fearless
-
Code:
on(press) {
_root.createEmptyMovieClip("factor"+i,++depth);
with (factor) {
beginFill(0xFF0000, 25);
lineStyle(1, 0x000000, 100);
lineTo(240, 110)
lineTo(0, 220)
lineTo(0, 0)
endFill()
}
i+=1;
}
on(release){
factor.onPress = function(){
this.startDrag(false);
}
factor.onRelease = function(){
stopDrag();
}
}
Now you can drag MC "factor", but to drag them each individually, I think you should make MovieClip.prototype.
-
Here's another way to look at it.
Code:
on (press) {
this.createEmptyMovieClip("factor"+_root.numFactors, ++depth);
with (_root["factor"+_root.numFactors]) {
beginFill(0xFF0000, 25);
lineStyle(1, 0x000000, 100);
lineTo(240, 110);
lineTo(0, 220);
lineTo(0, 0);
endFill();
}
_root["factor"+_root.numFactors].onPress = function() {
this.startDrag(false);
};
_root["factor"+_root.numFactors].onRelease = function() {
stopDrag();
};
_root.numFactors++;
}
-ag
-
Excellent! Thanks for this example.
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
|