Forum Topic: Where's The Problem?

(49 views • 4 replies)

This topic is 1 page long.

<< < > >>
None

fractureboy

Reply To Post Reply & Quote

Posted at: 10/28/08 10:20 AM

fractureboy LIGHT LEVEL 13

Sign-Up: 05/18/08

Posts: 370

Hey NG I've been playing with some actionscript and don't know why it doesn't work this is the code I've got so far...

this._x=_root._xmouse
this._y=_root._ymouse

this._xscale = this._yscale = Math.random() * 40 + 10

var xSpeed = Math.random() * 6 %uFFFD 3

var ySpeed = 2

this.onEnterFrame = function()
{

this._x += xSpeed

this._y -= ySpeed

this._alpha -= 1;

if(_alpha == 0)
{

this.removeMovieClip();
}
}

Gamertag - RobTheMoose ll Element Search & Win!

BBS Signature

None

WolfAkela

Reply To Post Reply & Quote

Posted at: 10/28/08 10:27 AM

WolfAkela LIGHT LEVEL 08

Sign-Up: 12/19/05

Posts: 2,327

removeMovieClip() only works for MCs which have positive depth.

Use swapDepths(_root.getNextHighestDepth()) before that.


None

fractureboy

Reply To Post Reply & Quote

Posted at: 10/28/08 10:40 AM

fractureboy LIGHT LEVEL 13

Sign-Up: 05/18/08

Posts: 370

At 10/28/08 10:27 AM, WolfAkela wrote: removeMovieClip() only works for MCs which have positive depth.

Use swapDepths(_root.getNextHighestDepth()) before that.

Even when I do that it comes up with this:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: Statement must appear within on/onClipEvent handler
this._x=_root._xmouse

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: Statement must appear within on/onClipEvent handler
this._y=_root._ymouse

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 6: Statement must appear within on/onClipEvent handler
this._xscale = this._yscale = Math.random() * 40 + 10

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 9: Syntax error.
var xSpeed = Math.random() * -3 %uFFFD 3

Total ActionScript Errors: 4 Reported Errors: 4

Gamertag - RobTheMoose ll Element Search & Win!

BBS Signature

None

WolfAkela

Reply To Post Reply & Quote

Posted at: 10/28/08 11:15 AM

WolfAkela LIGHT LEVEL 08

Sign-Up: 12/19/05

Posts: 2,327

Go study the basics of coding instead of copy pasting code.


Questioning

Spaltzer

Reply To Post Reply & Quote

Posted at: 10/28/08 12:13 PM

Spaltzer NEUTRAL LEVEL 15

Sign-Up: 06/29/08

Posts: 103

Just as it says. You're putting this code inside a MovieClip. When you do this, you need an "OnEventHandler". Try On(EnterFrame){}.


All times are Eastern Standard Time (GMT -5) | Current Time: 11:31 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!