# AS3 parent loading in AS2 child that in turn loads in jpegs \*Problem\*

**URL:** <https://forum.kirupa.com/t/as3-parent-loading-in-as2-child-that-in-turn-loads-in-jpegs-problem/299195>\
**Category:** flash\
**Created:** [October 31, 2009, 2:37pm UTC](https://forum.kirupa.com/t/as3-parent-loading-in-as2-child-that-in-turn-loads-in-jpegs-problem/299195 "2009-10-31T14:37:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![melacroso](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@melacroso](https://forum.kirupa.com/u/melacroso)\
**Post date:** [October 31, 2009, 2:37pm UTC](https://forum.kirupa.com/t/as3-parent-loading-in-as2-child-that-in-turn-loads-in-jpegs-problem/299195/1 "2009-10-31T14:37:22Z")

</div>

Hiya everybody.

I’m getting a bald patch on my head from frustration with the following problem.  
I have a parent AS3 swf which loads in a AS2 swf like so;

[COLOR=navy]stop/COLOR;  
[COLOR=navy]var[/COLOR] ldr:[COLOR=navy]Loader[/COLOR] = [COLOR=navy]new Loader/COLOR;  
ldr[COLOR=navy].load[/COLOR]([COLOR=navy]new URLRequest[/COLOR][COLOR=seagreen][COLOR=black]([/COLOR] “as2child.swf”[/COLOR]));  
[COLOR=navy]addChild/COLOR;

contained in the AS2 file is the following script which loads in jpegs when the user clicks the next button, etc.

[COLOR=silver]//stuff that loads in different photos[/COLOR]  
[COLOR=navy]stop/COLOR;  
[COLOR=navy]var[/COLOR] i:[COLOR=navy]Number[/COLOR] = 1;  
[COLOR=silver]//load first image straight away.[/COLOR]  
[COLOR=navy]function[/COLOR] initialloadup () {  
i = 1;  
startLoading([COLOR=seagreen]“pic”[/COLOR]+i+[COLOR=seagreen]".jpg"[/COLOR]);  
};

initialloadup();  
next\_btn[COLOR=navy].onRelease[/COLOR] = function () {  
[COLOR=silver]/_on clicking next image button load next image in sequence_/[/COLOR]  
i++;  
[COLOR=navy]if[/COLOR] (i \> 11 ) {i = 1};  
startLoading([COLOR=green]“pic”[/COLOR]+i+[COLOR=green]".jpg"[/COLOR]);  
[COLOR=navy]trace/COLOR;  
};  
prev\_btn[COLOR=navy].onRelease[/COLOR] = [COLOR=navy]function[/COLOR] () {  
[COLOR=silver]//on clicking previous image button load prev image in sequence[/COLOR]  
i–;  
[COLOR=navy]if[/COLOR] (i \< 1 ) {i = 11};  
startLoading([COLOR=green]“pic”[COLOR=black]+i+[/COLOR]".jpg"[/COLOR]);  
};

[COLOR=navy]function[/COLOR] startLoading(whichImage) {

[COLOR=navy]loadMovie[/COLOR](whichImage, [COLOR=seagreen]“imageLoader”[/COLOR]);  
}

however when you view the AS2 swf via the AS3 swf it does not seem to load in the jpgs when requested.  
I need to retain the AS2 file so cannot rewrite in AS3 as the image loading thing is only a small part of the AS2 file.

Any ideas? might it be to do with how the AS2 is read in AS3?

Cheers for your reading this

Melacroso
