# Attaching custom data to sprite

**URL:** <https://forum.kirupa.com/t/attaching-custom-data-to-sprite/297608>\
**Category:** flash\
**Created:** [October 5, 2009, 11:59pm UTC](https://forum.kirupa.com/t/attaching-custom-data-to-sprite/297608 "2009-10-05T23:59:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoimt](https://avatars.discourse-cdn.com/v4/letter/z/f08c70/32.png) [@zoimt](https://forum.kirupa.com/u/zoimt)\
**Post date:** [October 5, 2009, 11:59pm UTC](https://forum.kirupa.com/t/attaching-custom-data-to-sprite/297608/1 "2009-10-05T23:59:36Z")

</div>

Hi there.

Basiclally a simple thing, however i dont get an idea on how to solve this one:

Say I have a sprite which is already existing during runtime and at some certain point I want to attach some custom data to it, say, in a string.

How would I do that?

s:Sprite = new Sprite();  
s[“extra”] = … gives me an error, so i got exactly that far till here.

s.name is already reserved for another string and for sure I thought about just adding a TextField with the string inside to it, like

s.addChild(myStringTf);

But I know there is a better way, I just cant find it.  
hasOwnProperty() just returns a boolean true in case i match the value already assigned to it, right? Isn’t there a way to attach an annonymouse object to it? A little hint would be so apprecheated.

Best regards,  
zoimt
