Be a Supporter!

Trouble with clipevents!

  • 359 Views
  • 25 Replies
New Topic Respond to this Topic
MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Trouble with clipevents! 2009-05-24 21:22:15 Reply

I am trying to apply clipevents to movieclips to my flash animations but I get syntax errors saying "clipevents can onlybe applied to movieclips." But I AM applying it to a movie clip soooooo, help?


At first I was like O.o but then, I LoLed! XD

atomoxic
atomoxic
  • Member since: Feb. 16, 2009
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Trouble with clipevents! 2009-05-24 21:24:41 Reply

It would not give that error if you were actually applying it to a movieclip. Make sure its not a button or a frame you are trying to apply the code to.


BBS Signature
Magical-Zorse
Magical-Zorse
  • Member since: May. 10, 2008
  • Offline.
Forum Stats
Member
Level 40
Melancholy
Response to Trouble with clipevents! 2009-05-24 21:24:45 Reply

Are you putting it on the actual mc itself? or on a frame inside the mc?


BBS Signature
MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-24 23:31:48 Reply

On a frame in the mc. is that the problem? If so then what DO I do?


At first I was like O.o but then, I LoLed! XD

VicBiss
VicBiss
  • Member since: Nov. 17, 2007
  • Offline.
Forum Stats
Member
Level 16
Game Developer
Response to Trouble with clipevents! 2009-05-24 23:42:24 Reply

What kind of clipevent is it? If it's enterFrame, then you can just take out the ClipEvent.


sig'd

Johnny
Johnny
  • Member since: Apr. 17, 2004
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Trouble with clipevents! 2009-05-24 23:59:54 Reply

At 5/24/09 11:31 PM, MilesKitsune wrote: On a frame in the mc. is that the problem? If so then what DO I do?

Yup, that's the problem. The proper place for onClipEvents is if you simply left click the MC one time from the _root (or it's parent clip). You should get a blue bounding box. Open the actions panel, and put the code there.


Perpetually looking for time to return to the arts.

BBS Signature
MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-25 00:34:13 Reply

Thats all? holy crap! do you know that I have spent the past 3 months trying to figure out what was wrong? I always thought I was using the wrong code. man do I feel dumb! but thx that is a MONUMENTAL help.


At first I was like O.o but then, I LoLed! XD

MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-25 11:39:18 Reply

Hey wait I just tried what you said but it applied the code to the main movie and STILL gave me the same syntax error!


At first I was like O.o but then, I LoLed! XD

Johnny
Johnny
  • Member since: Apr. 17, 2004
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Trouble with clipevents! 2009-05-25 13:25:32 Reply

Let us see what code you're trying to apply to your clip.


Perpetually looking for time to return to the arts.

BBS Signature
MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-25 14:20:39 Reply

onClipEvent (load) {
numCopies = 10;
this.swapDepths(1100);
if (_name == "pie") {
for (i=1; i<numCopies+1; i++) {
duplicateMovieClip("_root.pie", "dmc"+i, i+1000);
_root["dmc"+i].nm = i; //Holds the # of the MC
_root["dmc"+i].af = 100/numCopies;
_root["dmc"+i].onEnterFrame = function() {
with (this) {
if (_root.pie._currentframe == _root.pie._totalframes) {
_alpha-=af;
if(_alpha<=0) {this.removeMovieClip();}
} else {
gotoAndStop(_root.pie._currentframe-nm);
_alpha = 100-(af*nm);
}
}
};
}
}
}


At first I was like O.o but then, I LoLed! XD

51lver
51lver
  • Member since: Jan. 14, 2008
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Trouble with clipevents! 2009-05-25 14:28:38 Reply

At 5/25/09 02:20 PM, MilesKitsune wrote: a mess of code

its because you're doing it wrong

onClipEvent(enterFrame){} goes on MC
onEnterFrame = function(){} goes on a frame

you've done both on the MC
try:

onClipEvent (enterFrame) {
	numCopies = 10;
	this.swapDepths(1100);
	if (_name == "pie") {
		for (i=1; i<numCopies+1; i++) {
			duplicateMovieClip("_root.pie", "dmc"+i, i+1000);
			_root["dmc"+i].nm = i; //Holds the # of the MC
			_root["dmc"+i].af = 100/numCopies;
			if (_root.pie._currentframe == _root.pie._totalframes) {
				_root["dmc"+i]._alpha-=af;
			}
			if(_root["dmc"+i]._alpha<=0) {
				_root["dmc"+i].removeMovieClip();
			} else {
				_root["dmc"+i].gotoAndStop(_root.pie._currentframe-nm);
				_root["dmc"+i]._alpha = 100-(af*nm);
			}
		}
	}
}

all i did was take your code and put it into one onClipEvent(enterFrame){}
it should work how you want it to work if you put that code on the MC

if the rest of the code is right that is
MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-25 14:56:12 Reply

Nope, still having syntax errors.


At first I was like O.o but then, I LoLed! XD

51lver
51lver
  • Member since: Jan. 14, 2008
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Trouble with clipevents! 2009-05-25 15:21:56 Reply

At 5/25/09 02:56 PM, MilesKitsune wrote: Nope, still having syntax errors.

what errors?

LuxGamer
LuxGamer
  • Member since: May. 31, 2008
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to Trouble with clipevents! 2009-05-25 15:28:59 Reply

Try 'On' instead of 'onClipEvent'... xP


ain't about how hard you hit... It's about how hard you can get hit, and keep moving forward... how much you can take, and keep moving forward.

BBS Signature
MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-25 15:49:56 Reply

Clip events are permitted only for movie clip instances


At first I was like O.o but then, I LoLed! XD

51lver
51lver
  • Member since: Jan. 14, 2008
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Trouble with clipevents! 2009-05-25 15:55:36 Reply

At 5/25/09 03:49 PM, MilesKitsune wrote: Clip events are permitted only for movie clip instances

:S well put it on a movie clip?

select the movie clip, make sure it is by looking in the bottom left of the properties panel it should say Movie Clip above where you enter the instance name. to open the properties panel press CTRL+F3

while the MC is slected press F9 to open the actionscript panel, then paste the code i put in there.

NOT ON A FRAME IN THE MOVIE CLIP!

MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-25 16:47:13 Reply

I am using the code on a movie clip, see thats the problem for some reason my flash doesn't realize that i am using it on a movie clip! or somethin' like that.


At first I was like O.o but then, I LoLed! XD

Johnny
Johnny
  • Member since: Apr. 17, 2004
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Trouble with clipevents! 2009-05-25 17:17:21 Reply

Just upload the FLA somewhere. Will be much easier for someone to find the problem that way.


Perpetually looking for time to return to the arts.

BBS Signature
ColdLogic
ColdLogic
  • Member since: Nov. 12, 2003
  • Offline.
Forum Stats
Member
Level 19
Blank Slate
Response to Trouble with clipevents! 2009-05-25 18:44:53 Reply

maybe this is a longshot but could you be useing AS2 code inside an AS3 enviroment? I would try selecting an AS2 document when you first start up flash, then trying your code in there.

MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-25 18:49:50 Reply

I am using AS2. and to the guy 2 above me, what?


At first I was like O.o but then, I LoLed! XD

51lver
51lver
  • Member since: Jan. 14, 2008
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Trouble with clipevents! 2009-05-25 18:51:42 Reply

At 5/25/09 06:49 PM, MilesKitsune wrote: I am using AS2. and to the guy 2 above me, what?

he means to upload the .fla file to here for one of us to have a look at and see what is wrong, as so far we've proven to be ineffective

ColdLogic
ColdLogic
  • Member since: Nov. 12, 2003
  • Offline.
Forum Stats
Member
Level 19
Blank Slate
Response to Trouble with clipevents! 2009-05-25 19:13:57 Reply

i know your useing AS2 code but im pretty sure thats the exact error i got when throwing AS2 code into an AS3 document.

MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-25 21:20:10 Reply

At 5/25/09 06:51 PM, 51lver wrote:
At 5/25/09 06:49 PM, MilesKitsune wrote: I am using AS2. and to the guy 2 above me, what?
he means to upload the .fla file to here for one of us to have a look at and see what is wrong, as so far we've proven to be ineffective

Umm... I, uh, okay?


At first I was like O.o but then, I LoLed! XD

Johnny
Johnny
  • Member since: Apr. 17, 2004
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Trouble with clipevents! 2009-05-26 12:22:54 Reply

At 5/25/09 09:20 PM, MilesKitsune wrote: Umm... I, uh, okay?

The .fla file? When you do something in flash and save it, it creates an .fla file.
If you upload that file, we can basically see exactly what you did, and where the problem is.


Perpetually looking for time to return to the arts.

BBS Signature
MilesKitsune
MilesKitsune
  • Member since: Jan. 17, 2009
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to Trouble with clipevents! 2009-05-26 16:15:49 Reply

yeah i get it now, and ive uploaded it to the link that other guy gave me. right now im just trying to learn the code i need for the game im making, so what i uploaded is just a test run of the code im using.


At first I was like O.o but then, I LoLed! XD

Johnny
Johnny
  • Member since: Apr. 17, 2004
  • Offline.
Forum Stats
Member
Level 24
Blank Slate
Response to Trouble with clipevents! 2009-05-26 16:38:23 Reply

We need a link to where you uploaded it... the exact path, so we can download it and review it.


Perpetually looking for time to return to the arts.

BBS Signature