# Change Dynamic movie position by variables from within a AS2.0 class

**URL:** <https://forum.kirupa.com/t/change-dynamic-movie-position-by-variables-from-within-a-as2-0-class/247775>\
**Category:** flash\
**Created:** [December 29, 2007, 2:24pm UTC](https://forum.kirupa.com/t/change-dynamic-movie-position-by-variables-from-within-a-as2-0-class/247775 "2007-12-29T14:24:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpkhatri\_ind](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rpkhatri\_ind](https://forum.kirupa.com/u/rpkhatri_ind)\
**Post date:** [December 29, 2007, 2:24pm UTC](https://forum.kirupa.com/t/change-dynamic-movie-position-by-variables-from-within-a-as2-0-class/247775/1 "2007-12-29T14:24:46Z")

</div>

[LIST]  
[\*][FONT=Calibri][FONT=Calibri]Can any body help me with this thing. I have to create a dynamic movie from within a[/FONT][/FONT]  
[FONT=Calibri] class file, Load a “swf” file into it , And then reposition it through a variable which is[/FONT]  
[FONT=Calibri] derived from a function.[/FONT]

[FONT=Calibri]After breaking my head to several different ways, i have been succed to load the dynamic movie and it is bieng repositoned too, But it works for a fixed value (see line no.13), i want to use a variable(this.XPositionOfImage see line no.12) for that X-Value,  
[/FONT][/LIST][LIST]  
[\*][FONT=Calibri] How can i use that variable inside the preloader?[/FONT]

[FONT=Calibri]If i don’t use the prelaoder, it doesn’t change the position , not even with a fixed value. The variable i want to use , Does carry a numeric value (have been checked). But when i call it from the preloader function it returns undefined.[/FONT]

[FONT=Calibri]Here is the code.  
[/FONT]  
[FONT=Calibri]  
[/FONT][/LIST][LIST=1]  
[_][FONT=Calibri]public function arrayLMTa(ColumnClicked , SBD:SelectorBoxDecider) {[/FONT]  
[_][FONT=Calibri] var SBD:SelectorBoxDecider = new SelectorBoxDecider();[/FONT]  
[_][FONT=Calibri] SBD.arrayLMT(ColumnClicked)[/FONT]  
[_][FONT=Calibri] XPositionOfImage = SBD.ImagePositionX;[/FONT]  
[_][FONT=Calibri] trace("will move selector to "+XPositionOfImage);[/FONT]  
[_][FONT=Calibri] var container:MovieClip = \_root.createEmptyMovieClip(“container”, 899);[/FONT]  
[_][FONT=Calibri] var mcLoader:MovieClipLoader = new MovieClipLoader();[/FONT]  
[_][FONT=Calibri] mcLoader.loadClip("…/images/"+SBD.ImageFileName , 899);[/FONT]  
[_][FONT=Calibri] var preload:Object = new Object();[/FONT]  
[_][FONT=Calibri] mcLoader.addListener(preload);[/FONT]  
[_][FONT=Calibri] preload.onLoadInit = function() {[/FONT]  
[_][FONT=Calibri] trace("this.XPositionOfImage = "+[/FONT]this.XPositionOfImage);  
[_][FONT=Calibri] \_level899.\_x = 256;[/FONT]  
[_][FONT=Calibri] \_level899.\_y = 0;[/FONT]  
[_][FONT=Calibri] }[/FONT]  
[_][FONT=Calibri]}[/FONT][/LIST]
