;

PDA

Click to See Complete Forum and Search --> : Why this code doesn't work


blanius
09-15-2005, 10:30 AM
I have the following in the first frame of a simple movie

on ClipEvent (load) {
this.createTextField("coords_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
coords_txt.autoSize = true;
coords_txt.selectable = false;
}
on ClipEvent (mouseMove) {
coords_txt.text = "X:"+_root._xmouse+",Y:"+_root._ymouse;
}

It doesn't work, I tired moving it to a second frame just in case that was the issue but it still doesn't work.

I cannot get any on ClipEvents to work however I can if I assing them as functions

This works:

this.onLoad=function(){
txt1.text="testing";
}

This Does not
on ClipEvent(Load){
txt1.text="Testing"
}

blanius
09-15-2005, 03:15 PM
What is going on with on ClipEvent? I cannot get it to work at all

blanius
09-15-2005, 03:18 PM
Awww jez it's all lowercase!!!!!

onclipevent which is NOT consistant with AS1 nor the any other commands.

Ultra Pulse
09-17-2005, 03:39 PM
when you said on ClipEvent(Load){
txt1.text="Testing"
}

you left a space between on and ClipEvent

blanius
09-17-2005, 11:00 PM
when you said on ClipEvent(Load){
txt1.text="Testing"
}

you left a space between on and ClipEvent

Actually I had it without the space and thought maybe that was the problem. Turns out it has to be all lowercase onclipevent which is not correct but is the only way it would work.

w.brants
09-18-2005, 02:20 AM
Turns out it has to be all lowercase onclipevent which is not correct but is the only way it would work.

There should have been another problem. I worked with onClipEvent using the right syntax without problems. If I'm not mistaken onClipEvent isn't compiled as text like most actionscript and therefore also works when the casing is wrong but with other actionscript you will get problems. It's best to always accustom yourself to use the right syntax.

blanius
09-18-2005, 10:34 PM
yea yea whatever all I know is this code doesn't work:

onClipEvent(enterFrame){
txt1.text="hi"
}

Now I just put the
txt1.text="hi" it works

I'm not crazy I could not for the life of me get the correct syntax for onClipEvent to work with any event. Now I trying it right now and I can't get it to work regardless of case....... I must be losing my mind. I know I was having this problem and when I looked at one of the examples it was lowercase so I tried that even knowing it was wrong and what I had been working on worked. Now no.... Arg.

blanius
09-18-2005, 10:39 PM
Here is a bit of code directly from Macromedia site
onClipEvent (load) {
this.createTextField("coords_txt", this.getNextHighestDepth(), 0, 0, 100, 22);
coords_txt.autoSize = true;
coords_txt.selectable = false;
}
onClipEvent (mouseMove) {
coords_txt.text = "X:"+_root._xmouse+",Y:"+_root._ymouse;
}

Doesn't work for me. Remove the onClipEvents and just leave the instructions it works.... Someone explain that to me. This is v5.0.2

w.brants
09-19-2005, 02:05 AM
Someone explain that to me. This is v5.0.2

I can't explain it.
I copy and paste the code you posted using 5.0.2 and it works fine.

Are you sure your export settings aren't set to flash 5 ?

Bob Hartzell
09-19-2005, 09:00 AM
Are you also sure that the flash plugin on Internet Explorer is 6 or greater?

blanius
09-19-2005, 09:14 AM
yep Lowest player version I have around here is 7 and thats in IE, in Firefox it's 8 and standalone it's 7......

See it yourself here:
http://bretlanius.com/flash/onclipproblem_player.htm

I screen captured it

blanius
09-19-2005, 10:26 AM
Ok here's the deal....... For those that didn't know this (like me) onClipEvent is ONLY for movie clips NOT the root timeline......

This is the kind of basic stuff NOT in the help files.

So the problem was totaly my error. Bob figured it out. How was I suppose to know this is the real question.

Any way at least I can stop thinking my computer was out to get me.