View Full Version : combine on- and onClipEvent-Handler
Hartwig
June 12th, 2002, 11:14 AM
Hi!
Is there any possibility to combine those two handlers.
I want a movieclip changing its scale when a button is pressed.
The change I would write as this:
onClipEvent(enterFrame) {
if (_scale<200) {
_scale+=10;
}
}
But I can't write
on (release) {
onClipEvent(enterFrame) {
...
Do U understand what I want.
Is there a way to realize it?
Many THX
Hartwig
I am not Jubba
June 12th, 2002, 12:39 PM
the on() handler is for buttons, you can't put them on movieclips. you could put a button in the movieclip like this
on(press){
nChange = true
}
and then the code on the MC would be like this :
onClipEvent(enterFrame) {
if(nChange){
if (_scale<200) {
_scale+=10;
}
}
}
suprabeener
June 13th, 2002, 01:43 AM
you can assign an onEnterFrame event within an on(press) like this:
on(press){
this.onEnterFrame = function(){
if(this._scale<200) this._scale += 10;
}
}
on(release){
this.onEnterFrame = null;
}
incidentally, _scale isn't a built in property.
Hartwig
June 13th, 2002, 02:05 AM
Wow. so simple. I must have been blind!
The only thing I had to change was
on(press){
_root.nChange = true
}
and the code on the MC:
onClipEvent(enterFrame) {
if(_root.nChange){
if (_scale<200) {
_scale+=10;
}
}
}
Thanks a lot!
Hartwig
June 14th, 2002, 04:18 AM
Hi Supra!
I haven't seen your reply before posting mine. What are the consequences that _scale is not a built in property?
H.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.