-
[Question]: MC delete after play
hey guys,
is there a quick and easy way to delete a MC immediately after it plays once?
like a function that plays the clip once and then deletes it?
without knowing of any special functions to do that, i thought about:
-play the movie clip
-wait x seconds for movie clip to run 1 time through
-delete movie clip
EDIT:
or maybe count x number of frames and delete?
thanks,
-
i just dynamically created the object and made an onenter event for it.
in the event, i counted down the number of frames. when it hits zero, i delete the object.
seems to work
-
Pumpkin Carving 2008
Code:
movieClip.aliveTime = 0;
movieClip.onEnterFrame=function() {
if (this._aliveTime < this._totalframes) {
this.aliveTime++;
} else {
this.removeMovieClip();
}
}
I am away from my computer this weekend so you may need to check the syntax on _totalframes, but I believe that is correct. Easy and painless.
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
-
cool....
i came up with something similar:
code:
mc.onEnterFrame = function(){
this.frames--;
if (this.frames == 0){
this.removeMovieClip();
}
it just requires to initiallize mc.frames first.
-
Pumpkin Carving 2008
Either way works fine, but this way you can change number of frames without having to reset your variable.
The 'Boose':
ASUS Sabertooth P67 TUF
Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
8GB G.Skill Ripjaws 1600 DDR3
ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
New addition: OCZ Vertex 240GB SATA III SSD
WEI Score: 7.6
-
Originally Posted by ImprisonedPride
Either way works fine, but this way you can change number of frames without having to reset your variable.
true
-
Code:
mc.onEnterFrame = function() {
if (this._currentframe == this._totalframes) {
this.removeMovieClip();
} else {
}
}
No variables needed.
-
Originally Posted by StephenN
Code:
mc.onEnterFrame = function() {
if (this._currentframe == this._totalframes) {
this.removeMovieClip();
} else {
}
}
No variables needed.
sweet.... that works perfectly.
thanks for the help, guys.
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
|