# ReferenceError: Error #1056: Cannot create property ... on flash

**URL:** <https://forum.kirupa.com/t/referenceerror-error-1056-cannot-create-property-on-flash/306091>\
**Category:** Uncategorized\
**Created:** [March 9, 2010, 2:21pm UTC](https://forum.kirupa.com/t/referenceerror-error-1056-cannot-create-property-on-flash/306091 "2010-03-09T14:21:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mutluturk](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@mutluturk](https://forum.kirupa.com/u/mutluturk)\
**Post date:** [March 9, 2010, 2:21pm UTC](https://forum.kirupa.com/t/referenceerror-error-1056-cannot-create-property-on-flash/306091/1 "2010-03-09T14:21:19Z")

</div>

Hello all,

Here is a specific problem I am facing most of the time; let me try to explain with an example.

Say I create a shape, and I want to move it with a ENTER\_FRAME event, like this:

```
    public function makeShape(){            
        var myShape=new Shape();
        addChild(myShape);
        myShape.addEventListener(Event.ENTER_FRAME,moveMyShape);
    }
    public function moveMyShape (event:Event) {
        event.currentTarget.x+=1;

```

It is cool up to here.  
But what if I want to pass a variable with my shape to the event function. Say my shape has a no or a name or anything like a data; so I rewrite the code;

```
    public function makeShape(){            
        var myShape=new Shape();
myShape.thisShapesNo=50;
        addChild(myShape);
        myShape.addEventListener(Event.ENTER_FRAME,moveMyShape);
    }
    public function moveMyShape (event:Event) {
        event.currentTarget.x+=1;
trace(event.currentTarget.thisShapesNo)

```

And now I get the error code,  
"Cannot create property thisShapesNo on flash.shape… "  
OK, I understand that, but it is not fair. Anything you create with a code can have a property you want to dub or add on it, and you should call it anytime you like.  
I learned that there are 2 ways to get around it, but both of them are extra work for the code, and I don’t like to spend that precious memory for a cheap error like this.  
First one is to add the shape as a child to a movieclip, I use this most of the time and goes like this:

```
    public function makeShape(){            
         var myShape=new Shape();
var myClip=new MovieClip();
 myClip.addChild(myShape);
myClip.thisShapesNo=50;
 myClip.addEventListener(Event.ENTER_FRAME,moveMyShape);
     }
     public function moveMyShape (event:Event) {
         event.currentTarget.x+=1;
trace(event.currentTarget.thisShapesNo)

```

See the extra workload… And the other way (and I’ve never tried) is to write your own event function where you can pass variables… I guess something like this:

```
myShape.addEventListener(Event.ENTER_FRAME, moveMyShape, 50 );

```

So it seems like this is another extra workload for the code.  
And so here is my question: How can I add a you-name-it property to any thing I’ve created in AS3?

Regards.
