'Fmx'...ClipEvents and On handlers

hello,
i have recently downloaded some tutorials and example FLA’s on elasticity (which is actually far too advanced for my current understanding of AS), however, with one of the fla’s i would like to add an On handler in the current code, but can’t figure out how to do it.
below is the code attached to the MC on the main stage, which in turn contains a button.
a frame action on the main timeline defines the variables ‘frenata’ and ‘velocita’…

onClipEvent (load) {
org_x = this._x;
org_y = this._y;
newX = _x;
newY = _y
}
onClipEvent (enterFrame) {
Xspeed = ((_x-newX)/_root.velocita+Xspeed)/_root.frenata;
_x -= Xspeed;
Yspeed = ((_y-newY)/_root.velocita+Yspeed)/_root.frenata;
_y -= Yspeed;
if (velocita<2) {
velocita=2;
}
if (frenata<1) {
frenata=1;
}
_root.menu6.newX = (this._x)+20;
_root.menu6.newY = (this._y)-45;
}

is it possible to add some more script to this that would activate another movie clip??

thank you in anticipation.
janice

Hi janice,
Yes it is possible to do as you want, it just depends when you want to activate another mc as to where you put the code.
For example, if you wanted to activate an mc dependant on the _x pos of _root.menu6 - you could include anothe if statement

if you could be a bit more explicit as to what you are trying to achieve, I can probably help you more.

Do you have a test fla. you can post ?

Cheers

SteveD

Since you’re working with MX, you can put button handlers as well on the clip. No problem :slight_smile:

but you can´t put clip handlers and button handlers together. am i right pom?

but you can´t put clip handlers and button handlers together. am i right pom?

myMovie.onEnterFrame = function(){
this._x+=5
_root.myButton.onRelease = function(){
trace(“myButton Called”);
}
};

Insert this into your first frame actions.

Sorry, but am afraid your abit outdated. :wink: j/k

PS. It can’t be done in Flash 5 tho.

i didn´t mean that there is no way you can do such thing, and did you read the word…

[SIZE=4]together[/SIZE] ??

:stuck_out_tongue:

and… functions are not normal handlers :wink:
but thanks for the code anyways =)

h88 was using Dynamic Event Handlers :wink: Which are technically functions, but are also handlers :slight_smile:

And h88, you can also do…

onClipEvent (enterFrame) {
	_root.instanceName.onPress = function() {
		//do this
	};
}

Where you don’t have to use Dynamic Event Handlers for both handlers, but only the ones contained within the onClipEvent handler (or on handler)

But I am sure you knew that Mr. FlashCoderGeniusGuy

Where you don’t have to use Dynamic Event Handlers for both handlers, but only the ones contained within the onClipEvent handler (or on handler)

Of course we can! But why are you still using onClipEvent handlers?

Who said I still do (although I do sometimes depending on the situation) :wink:

Just stating that you can do that and you don’t have to use Dynamic Event Handlers (which I will refer to as DEH) to have a DEH inside a handler.

Just stating that you can do that and you don’t have to use Dynamic Event Handlers (which I will refer to as DEH) to have a DEH inside a handler.

I got what your trying to say lost.

But I am sure you knew that Mr. FlashCoderGeniusGuy

I knew what you meant here, lol.

LOL… just stating the truths :wink: :slight_smile:

You taught me loadVars… now I love it … genius lol.

Man… thats ashame… I didn’t know loadVars…

(for me thats ashame)

*Originally posted by lostinbeta *
IMr. FlashCoderGeniusGuy

I actually thought you were stating me as quoted in a negative manner. Anyways, I never thought i taught you Loadvars lost. :bandit:

No, I meant it in a good way…lol. You are a great scripter, especially server-side from what I see.

And yeah, you taught me loadVars and onLoad stuff. Not directly, but from reading your posts I thouroughly understood it and got it working in an instant. I use it all the time now.

loadVariables and loadVariablesNum?? What are they?? LOL :wink:

hello,
thanks for the replies…it seems to have caused quite a conversion.
anyway, i have attached the actual fla to see if anyone can come up with a solution. i have tried the suggestions that have already been made, but i haven’t had any luck in getting them to work.

i’m sure it will make a bit more sense when you see the fla.
in the meantime i will continue to find a solution.

thanks again, and look forward to hearing any comments

cheers

hey janice …

i got this unexpected file format error when i try to open your file :-\

Yes, I recieved that error as well. Try putting it in a .zip file and uploading it. It worked last time someone had a file that did that.

*Originally posted by lostinbeta *
**

onClipEvent (enterFrame) {
	_root.instanceName.onPress = function() {
		//do this
	};
}

**
There’s no point declaring the onPress DEH ( :beam: ) in an enterFrame, Lost :slight_smile: I think that guig0 wanted to know if you can do

onClipEvent(enterFrame){
  // blabla
}
on (press){
  // bloblo
}

and I believe you can. Test, anybody?

h88, Lost >> Stop spamming! :trout: :trout:

LOL, I know there is no point to that Ilyas… I blurted out a button handler as fast as I could because I was in a rush, the whole code made no sense anyway, it was just to show something.

And yes, that does work too Ilyas.

i´m not a mac user, and have FMX. :-\