Jump to content
Search Community

imageLoader running two times

alflasy test
Moderator Tag

Recommended Posts

Alright, here another one. But first thanks to Carl for all your help.

 

My Slide show was working great till I tried to prepend url in xml file. As soon as I tried below code it prepend the URL but it runs the onChildComplete handler two times so all the images and its related text were loaded two times. Like 5 image movie turn in 10 image movie. Also notice that the prependURLs only works when the xml node is LoaderMax it doesn't work if its DATA of something else.

 

 

<LoaderMax name='moduleSlides' load="true" prependURLs="images/" >

<imageLoader....>

<imageLoader....>

<imageLoader....>

</LoaderMax>

 

Thanks

Link to comment
Share on other sites

Hi,

 

By any chance were you setting load="true" on the individual ImageLoader's as well as the LoaderMax? Can't tell from the abbreviated xml you supplied, but we found that could cause the onChildComplete to fire twice.

 

Please try the attached version of XMLLoader.as and let us know if it works better for you.

 

If not, please attach a zipped example of some basic files that we can use to see the problem.

 

Also, I'm not quite sure what you mean by:

prependURLs only works when the xml node is LoaderMax it doesn't work if its DATA of something else.

 

 

Can you provide a little more info on this? Please show more of the xml and point out which nodes aren't getting the proper url prepended.

 

Keep in mind that prepenURLs is only going to apply to the url property of other LoaderMax related loaders: ImageLoader, SWFLoader, MP3Loader etc.

 

if you have a node like:

 

<mySWF url="home.swf" width="500" height="200"/ >

 

prependURLs is not designed to change that node's url attribute.

 

Sorry for the trouble and thanks for your patience.

 

Carl

XMLLoader.as.zip

Link to comment
Share on other sites

Thanks Carl for wonderful response. Yes, I am calling load true on both loaderMax load and imageLoader Node like this

 

 

<LoaderMaxs  name='moduleSlides' load="true" prependURLs="modules/" >
<ImageLoader  name="img_1" url="images/img_0.jpg" estimatedBytes="60000" load="true"  x="0" y="0" >
<newTxtBox txtX="auto" txtY='auto' txtWidth='700' txtHeight='auto' txtAlign='center' textBorder='no'><![CDATA[my text]]>
</newTxtBox>
</ImageLoader>
</LoaderMaxs  >

And

Answer to your Quoted question is below

 

 

<LoaderMaxs name='moduleSlides' load="true" prependURLs="modules/" >

<ImageLoader....

<ImageLoader....

</LoaderMaxs >

 

Prepend works with above xml but doesn't work with below xml

 

 

<data name='moduleSlides' load="true" prependURLs="modules/" >

<dataNode....

<dataNode....

</data>

Link to comment
Share on other sites

Alright, so Carl you are right. calling load true both on LoaderMax node and Imageloader node makes ImageLoader runs two times but whats I notice that when I remove the load true from ImageLoader Node then ImageLoader Load Images in alternate sequences like the image 2 loades first then them Image 1, Image 4 load then Image 3 and so on. Now when I remove load true from LoaderMax and keep the load true on images loader then it worked fine. Not sure why its doing it.

 

Either way the problem of prependURLs worked.

Question - So, if the LoaderMax node have no load true then still its going to load the images?

 

Thanks for all your help.

Link to comment
Share on other sites

Setting load="true" on the LoaderMax is a convenience that allows you to avoid the redundancy of setting load="true" on all the child loaders. If you intend to load every ImageLoader inside a LoaderMax only set load = "true" on the LoaderMax. No need to add anything to the child ImageLoaders. Perhaps if for some reason you don't want a particular ImageLoader to load, you can set load="false".

 

As for making sure each image in the LoaderMax loads in order, set its maxConnections = "1".

 

I noticed in the xml you provided you had were using:

 

<LoaderMaxs> and it should be <LoaderMax> (no s)

 

I'm pretty sure the following should work exactly as you intend:

 

 

<LoaderMax name='moduleSlides' load="true" prependURLs="modules/" maxConnections="1" >

<ImageLoader name="img_1" url="images/img_0.jpg" estimatedBytes="60000" x="0" y="0" >

<newTxtBox txtX="auto" txtY='auto' txtWidth='700' txtHeight='auto' txtAlign='center' textBorder='no'><![CDATA[my text]]>

</newTxtBox>

</ImageLoader>

</LoaderMax>

 

And to clarify a previous issue, if your <dataNode> has an url attribute, prependURLs is not going to change the url value. prependURLs only looks for and works on LoaderMax-related loader nodes <ImageLoader> <SWFLoader> etc.

 

Also, thanks again for pointing out that double onChildComplete firing issue. That was something we needed to fix up.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...