Skip to main content
Participating Frequently
November 2, 2006
Question

Getting a symbol to know it's own hierarchy

  • November 2, 2006
  • 6 replies
  • 421 views
I have the following set up:

A movie-symbol (spinner) that contains a spinning movie-symbol (spinner_components).

(Spinner_components) contains three movie-symbols that are animated. One of these is a rectangle (holder) onto which I load an image, “image”+(x)+”uri” When the timeline comes to the end it increases (x) by 1 to change the image and starts again.

The actionscript for all this is in a layer of (spinner_components)

I want to have multiple instances of (spinner) – [spinner1, spinner2 etc.] that all animate the same way but load different images.

The long way would be to make various different (spinner) symbols, but this would use up a lot more memory.

Could anyone tell me if there is a way to make a symbol know in which instance it is of a symbol higher up the hierarchy. (IE so that the (spinner_components) of (spinner1.spinner_components) knows that it is different from (spinner2.spinner_components).

Thanks a lot.
This topic has been closed for replies.

6 replies

LLuis12Author
Participating Frequently
November 6, 2006
OK, sorry, I havent had too much chance to play with this.

Your code:

holder.loadMovie("image"+this._parent._name.substring(7)+x);


Tells any instance of the symbol "holder" to load an image called "image(the seventh letter of the parent symbol)x" So for any instance of holder in spinner1 it will load image1x.

My images are assigned using the following:

var image10:String = "logo/jamon.gif";
etc.

"holder" is in "spinner_components"
The symbol "spinner" contains "spinner_components" spinning using the transform function.

Therefore I also tried the code as:

holder.loadMovie("image"+this._parent._parent._parent_name.substring(7)+x);


and also

holder.loadMovie("image"+this._parent.._parent_name.substring(7)+x);


Neither worked.
Is it the transform function that is messing it all up? or some syntax?

Thanks
kglad
Community Expert
Community Expert
November 2, 2006
you're welcome.
LLuis12Author
Participating Frequently
November 2, 2006
Ok, thanks. I'll have a look over the wekend and see if I cant sort it out.

I might be in touch on Monday!
LLuis12Author
Participating Frequently
November 2, 2006
oh, and thanks very much by the way.
kglad
Community Expert
Community Expert
November 2, 2006
you can use the _parent and _name properties of movieclips.
LLuis12Author
Participating Frequently
November 2, 2006
...so I could code based on some kind of if function where if the parent equaled a certain instance then it would activate

Sorry I'm such a dunce at this. I havent been doing it long...

LLuis12Author
Participating Frequently
November 2, 2006
I tried using the script assistant with the if function but as the symbol spins there is a "transform" and I cannot get passed that to the point in the hierarchy where the instance name changes, which is what the condition of my if clause is going to need.
LLuis12Author
Participating Frequently
November 2, 2006
Any takers?