Forum Topic: AS2 noob question...

(113 views • 9 replies)

This topic is 1 page long.

<< < > >>
Sad

Pippatchu

Reply To Post Reply & Quote

Posted at: 6/12/09 05:44 PM

Pippatchu LIGHT LEVEL 07

Sign-Up: 05/04/08

Posts: 122

What i want to do is when i click it comes out bullets where ever i aim.
im gonna do that by putting in frame:

new MovieClip (_root.Bullet)
onMouseDown = function() {
add MovieClip (_root.Bullet){
_root.Bullet.moveTo(_xmouse,_ymouse)
}
}

But it seems im doing something wrong.
i have a bullet movieclip in library but not on stage.
Linkage = Bullet
Any help?

saunich's the name, speeds my name | speaking japanese is like playing through fire and flames at expert on guitar hero.

BBS Signature

Shouting

milchreis

Reply To Post Reply & Quote

Posted at: 6/12/09 05:49 PM

milchreis DARK LEVEL 16

Sign-Up: 01/11/08

Posts: 403

At 6/12/09 05:44 PM, Pippatchu wrote: What i want to do is when i click it comes out bullets where ever i aim.
im gonna do that by putting in frame:

new MovieClip (_root.Bullet)
onMouseDown = function() {
add MovieClip (_root.Bullet){
_root.Bullet.moveTo(_xmouse,_ymouse)
}
}

But it seems im doing something wrong.

What language is this?
Check out Actionscript 1,2 or3.

"Even if it's just cynicism that remained to push us ahead, we'll carry on!"


None

Pippatchu

Reply To Post Reply & Quote

Posted at: 6/12/09 05:51 PM

Pippatchu LIGHT LEVEL 07

Sign-Up: 05/04/08

Posts: 122

Read the title. actionscript 2 .

saunich's the name, speeds my name | speaking japanese is like playing through fire and flames at expert on guitar hero.

BBS Signature

None

StaliN98

Reply To Post Reply & Quote

Posted at: 6/12/09 05:55 PM

StaliN98 LIGHT LEVEL 10

Sign-Up: 07/27/07

Posts: 690

That, my friend, was not actionscript 2. At least try and stick to the language you want to use.


None

funkycaveman

Reply To Post Reply & Quote

Posted at: 6/12/09 05:59 PM

funkycaveman FAB LEVEL 19

Sign-Up: 06/10/08

Posts: 2,745

new MovieClip (_root.Bullet)
onMouseDown = function() {
add MovieClip (_root.Bullet){
_root.Bullet.moveTo(_xmouse,_ymouse)
}
}

wtf that is psudeo code if anything, dunno where he got that from

BBS Signature

None

Afro-Ninja

Reply To Post Reply & Quote

Posted at: 6/12/09 06:00 PM

Afro-Ninja EVIL LEVEL 37

Sign-Up: 03/02/02

Posts: 13,466

onMouseDown = function() {
var myBullet:MovieClip = attachMovie("Bullet");
myBullet._x=_xmouse;
myBullet._y=_ymouse;
}

or something along those lines, I didn't test it out.

where did you get this 'add MovieClip{}' syntax from?
and moveTo is for the drawing api, not positioning. Did you browse the reference manual looking for code segments that might randomly apply to what you want to do?

BBS Signature

None

StaliN98

Reply To Post Reply & Quote

Posted at: 6/12/09 06:03 PM

StaliN98 LIGHT LEVEL 10

Sign-Up: 07/27/07

Posts: 690

onMouseDown = function() {
var newMc:MovieClip = this.attachMovie( "Bullet", "", this.getNextHighestDepth());
newMc._x = _xmouse;
newMc._y = _ymouse;
}
}

That should work better although I am tired and I'm used to AS3 so I dunno


None

StaliN98

Reply To Post Reply & Quote

Posted at: 6/12/09 06:06 PM

StaliN98 LIGHT LEVEL 10

Sign-Up: 07/27/07

Posts: 690

Damn, ninja'd. What he said.


None

Afro-Ninja

Reply To Post Reply & Quote

Posted at: 6/12/09 06:24 PM

Afro-Ninja EVIL LEVEL 37

Sign-Up: 03/02/02

Posts: 13,466

At 6/12/09 06:06 PM, StaliN98 wrote: Damn, ninja'd. What he said.

yours actually works though, I forgot the extra params for attachMovie ;)

BBS Signature

None

IOUPAIN

Reply To Post Reply & Quote

Posted at: 6/12/09 09:50 PM

IOUPAIN NEUTRAL LEVEL 12

Sign-Up: 07/20/07

Posts: 412

For one, you need to use better syntax. I haven't used flash for a month or so, but I've been doing PHP and just forgetting to add a semi-colon at the end can screw up your code.


All times are Eastern Standard Time (GMT -5) | Current Time: 03:28 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!