Symbol Properties appearing "undefined"

I’ve been using the contents of this forum a lot recently to help me progress with my recent project, and unfortunately I have to make my first post… asking for help. Not pretty, I know.

I have a function that gets passed an object (node), which has numerous properties, but the only ones we’re interested in are “node.ID” and “node.parentID”.

The function attaches a movie clip from the library like so, and sets it’s values.

_root.createEmptyMovieClip("container",0);
container.attachMovie("NodeGraphic",node.id,container_depth --); 
container[node.id]._x = whatever..
container[node.id]._y = whatever..  

The logic of the code means that children nodes are drawn AFTER parents, therefore if a node is seen as having a parent, we will then draw a linkage using the drawing API from the current nodes x and y co ords, to its parent nodes x and y co ords.

Both node.id and parent.id are in the same format, and here is how I attempt to draw the line:

container.attachMovie("NodeGraphic",node.id,container_depth --);
container.createEmptyMovieClip(node.id+"parentLink",container_depth --);
container[node.id]._x = anything
container[node.id]._y = anything
 container[node.id+"parentLink"].lineStyle(1, 0x000000, 100);
container[node.id+"parentLink"].moveTo(container[node.id]._x, container[node.id]._y);
container[node.id+"parentLink"].lineTo(container[node.parentID]._x, container[node.parentID]._y);
trace(node.ID+" -- drawn");
trace(node.parentID);
trace(container[node.parentID]._x);

The problem is, the final trace (trace(container[node.parentID]._x) returns an undefined value. However, if I trace the x value of the current node object (that I’m drawing), it does appear. I’m guessing this is either a path issue that I don’t seem to have got my head around, or something to do with the movies not being attached properly (however, they do appear on my stage). Maybe the naming syntax I used in the attachMovie is incorrect? I’m using the value straight from the node.id property which is passed into the function via the node object.

What’s happening is I’m unable to draw the link between the nodes as I can’t see the value of the parent node’s x or y properties.

PS. When I CTRL+L during debugging… this is what I see:


Level #0: Frame=1
  Movie Clip: Frame=0 Target="_level0.container"
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=0 Target="_level0.container.undefinedparentLink"
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
    Movie Clip: Frame=1 Target="_level0.container.undefined"
      Shape:
  Movie Clip: Frame=0 Target="_level0.window"

Any help is greately appreciated, and I hope I’ve provided enough information for that to happen… if not, dont hesitate to ask me anything else :P.

Thanks!