# \-Simple AS3 question (I hope) -

**URL:** <https://forum.kirupa.com/t/simple-as3-question-i-hope/283982>\
**Category:** flash\
**Created:** [March 13, 2009, 10:06am UTC](https://forum.kirupa.com/t/simple-as3-question-i-hope/283982 "2009-03-13T10:06:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shaedo](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Shaedo](https://forum.kirupa.com/u/Shaedo)\
**Post date:** [March 13, 2009, 10:06am UTC](https://forum.kirupa.com/t/simple-as3-question-i-hope/283982/1 "2009-03-13T10:06:25Z")

</div>

Hi thanks for taking the time. Sorry to post such a simple question here but after extensive looking I either can’t find the answer I am after, or more likely can’t recognise it when I see it.

In AS3 I can happily pass variables and call functions between unrelated objects created in the main time line **if I pass in a reference** to the target object.  
I would like to be able to do it without having to pass in a reference.  
In AS2 this was easy I just used

```auto
'myTargetVar = _root.objectInstanceName.someProperty' syntax.

```

or the reverse…

So for example I could have the rotation value of one object change by running a function in another object.

So in AS3 can I still do that? I can see how I do it with parent and child relationships, but I can’t seem to be able to work out how to do it with unrelated objects.

I have attempted this approach:  
main time line code

```auto
 
var A1:aaaa1 = new aaaa1;
this.addChild(A1);
 
var B1:bbbb1 = new bbbb1;
this.addChild(B1);

```

then for example adding a line of code in the bbbb1 class

```auto
rotation = root.A1.rotation;

```

but that gives me the error:

1119: Access of possibly undefined property BGScroller through a reference with static type flash.display:DisplayObject.

I tried messing around with assigning instance names but Senocular said that he (almost) never used instance names in AS3 and I figure if its good enough for him then who am I to question!

Obviously my example is simplified for the question but I am sure that if I can just get this then I can work out the rest no problem.

Incidentally if this is a really bad way of coding things and I should just put in references and like it then could someone explain why?

Thanks for your time. Please feel free to snicker at my question.
