Skip to main content
Known Participant
September 29, 2006
Question

Passing values from mc to mc/instance to instance

  • September 29, 2006
  • 72 replies
  • 3385 views
Ive made a new topic for this cos the last one went wildly off-topic...

Im trying to use info from the soldier instance to set up bullets he fires.
Each new bullet wants to be its own instance/mc whatever. Thing is that I cant get the info out of _root.soldier and into _root.bulletX (where X is an arbitary value)

there is code in the bullet onClipEvent(load) like
this._rotation = soldier1._rotation;
Which by the looks of some traces Ive done just gives soldier._rotation as undefined.

How can I pass a value out of soldier to use here?
This topic has been closed for replies.

72 replies

Known Participant
September 29, 2006
hmm afraid that the kind of code I was using. The problem is you cant take a variable out of one instance and use it in another.

I know that soldier1._rotation is working cos it work for soldier clip.

The problem comes when you want to pass soldier1._rotation onto the bullet cos a statement like

bullet._rotation = soldier1._rotation;

within the code for the bullet will simply decide that it cant find soldier1._rotation. What I think I need is a way to make the value public
Inspiring
September 29, 2006
this._rotation = whatever. //defines this._rotation, it does not define "whatever"

soldier1._rotation = whatever //defines soldier1._rotation.

X = Y //defines X using Y.

Y = X //defines Y using X.

does that help?