# How does Event.ADDED\_TO\_STAGE work?

**URL:** <https://forum.kirupa.com/t/how-does-event-added-to-stage-work/309063>\
**Category:** flash\
**Created:** [May 6, 2010, 1:55am UTC](https://forum.kirupa.com/t/how-does-event-added-to-stage-work/309063 "2010-05-06T01:55:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marquizzo](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@marquizzo](https://forum.kirupa.com/u/marquizzo)\
**Post date:** [May 6, 2010, 1:55am UTC](https://forum.kirupa.com/t/how-does-event-added-to-stage-work/309063/1 "2010-05-06T01:55:29Z")

</div>

Hello! I’m attempting to initiate a set of variables within a movie clip _myElement_ as soon as it’s dynamically loaded onto the stage:

frame1 within myElement:

```php

this.addEventListener(Event.ADDED_TO_STAGE, initiateVars); 

function initiateVars(ev:Event):void{     
    var currentY:int = this.y;     
    var currentX:int = this.x; 
}

```

I’m trying to make this happen only once, and only when _myElement_ is first placed on stage, but the code above doesn’t work. Am I misusing the ADDED\_TO\_STAGE event?
