Skip to main content
Known Participant
December 13, 2009
Question

Accessing a named movieclip in a movieclip using as3

  • December 13, 2009
  • 1 reply
  • 316 views

Hi,

I have created a new instance of a movieclip and named it in as3.

I want to put this in another movieclip. How does this effect the reference because everything seems fine while the dynamic movieclip is just dealing with the stage. As soon as I put it in a movieclip, I get:

Error #1009: Cannot access a property or method of a null object reference.
    at com::Gallery/instancesOut()

Heres part of my code:

for(var i:int = 0; i < 20; i++)
{
    var transition:mcTransition = new mcTransition();

    addChild(transition);
    transition.name = "transition_mc" + i;
    transition.x = i * 100;

I can reference using the string name but if I put the addchild in a movieclip it errors

Transition_mc.addChild(varTransition);

Please help

Thanks

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
December 13, 2009

I don't see any connection between the two segments of code you show nor with the error message as it might relate to them.

The only thing I can imagine is that you are using invalid instance names...

Transition_mc.addChild(varTransition);

Do you have an object with the instance name ' Transition_mc ' on the stage?  I don't see any object you give a name of varTransition, so I am unable to determine what that might intend.