# How to modify the code to use the image on stage instead of in library?

**URL:** <https://forum.kirupa.com/t/how-to-modify-the-code-to-use-the-image-on-stage-instead-of-in-library/323251>\
**Category:** flash\
**Created:** [June 22, 2011, 2:42pm UTC](https://forum.kirupa.com/t/how-to-modify-the-code-to-use-the-image-on-stage-instead-of-in-library/323251 "2011-06-22T14:42:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![learner\_7n](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@learner\_7n](https://forum.kirupa.com/u/learner_7n)\
**Post date:** [June 22, 2011, 2:42pm UTC](https://forum.kirupa.com/t/how-to-modify-the-code-to-use-the-image-on-stage-instead-of-in-library/323251/1 "2011-06-22T14:42:30Z")

</div>

Hi,

The following code I found on website is for working with the image which is in library. But how to modify it to work with the image on stage. Because I don’t want to use it from the library.

The second question ------ Is it the AS2 code or AS3. If it is AS2 code then please let me know how to modify it to work with AS3.

animator = CreateEmptyMovieClip(‘animator’,1);  
bg\_1 = animator.attachMovie(‘bg\_mc’,‘bg\_1’,1);  
bg\_2 = animator.attachMovie(‘bg\_mc’,‘bg\_2’,2);  
bg\_1.\_x = bg\_1.\_width/2:  
bg\_2.\_x = bg\_2.\_width/2:  
speed = 1;  
cloudWidth = 380;  
animator.onEnterFrame = function(){  
bg\_1.\_x -= speed:  
bg\_2.\_x -= speed:  
if(bg\_1.\_x \<= -bg\_1.\_width) bg\_1.\_x = cloudWidth;  
if(bg\_2.\_x \<= -bg\_2.\_width) bg\_2.\_x = cloudWidth;  
}

Thanks.
