Jump to content
Search Community

LoaderMax String not working properly...

LeRonj23 test
Moderator Tag

Recommended Posts

I'm creating this xml file using PHP. When I setup php to echo the follow. Her is my issue.
 
This doesnt work:
 
<data>
<LoaderMax name="queue" prependURLs="Images/" childrenVars="width:700,height:630,scaleMode:proportionalInside" alpha="0" load="true">
<ImageLoader name="Company Logo" url="Bed_bath_and_Beyond.png" estimatedBytes="31641" width="750" height="275"/>
<ImageLoader name="Image" url="T-shirt.jpg" estimatedBytes="8611" Item_Id="1" Title="Men T-Shirts" Quick_Desc="Starting at $14.99 each..." Savings_amt="65% off"/>
<ImageLoader name="Image" url="T-shirt.jpg" estimatedBytes="8611" Item_Id="3" Title="Women T-Shirts" Quick_Desc="Starting at $30.11 each..." Savings_amt="20% off"/>
</LoaderMax>
</data>
 
 
--- onChildComplete:imageCompleteHandler

 

public function imageCompleteHandler(event:LoaderEvent):void
{
trace(event.target.content);
 
var loadedImage:ContentDisplay = event.target.content as ContentDisplay;
 
//you must manually add the loadedImage to the display list
addChild(loadedImage);
 
TweenLite.to(loadedImage, 1, {alpha:1});
}

 

What is being traced:

[object ContentDisplay]
[object ContentDisplay]
[object ContentDisplay]
[object ContentDisplay],[object ContentDisplay],[object ContentDisplay]

 

I only have 3 images so I understand this:
[object ContentDisplay]
[object ContentDisplay]
[object ContentDisplay]
 
Why am I getting this:
[object ContentDisplay],[object ContentDisplay],[object ContentDisplay]

 

 

This works:

 
<data>
<ImageLoader name="Company Logo" url="Images/Bed_bath_and_Beyond.png" estimatedBytes="31641" width="750" height="275" scaleMode="proportionalInside" alpha="0" load="true"/>
<ImageLoader name="Image" url="Images/T-shirt.jpg" estimatedBytes="8611" Item_Id="1" Title="Men T-Shirts" Quick_Desc="Starting at $14.99 each..." Savings_amt="65% off" width="700" height="630" scaleMode="proportionalInside" alpha="0"load="true"/>
<ImageLoader name="Image" url="Images/T-shirt.jpg" estimatedBytes="8611" Item_Id="3" Title="Women T-Shirts" Quick_Desc="Starting at $30.11 each..." Savings_amt="20% off" width="700" height="630" scaleMode="proportionalInside" alpha="0"load="true"/>
</data>
 
Everything loads fine when I do it this way. Any suggestions?

 

Link to comment
Share on other sites

No that I run a new trace. This time to show the name:
 
--- onChildComplete:imageCompleteHandler

 

public function imageCompleteHandler(event:LoaderEvent):void
{
trace(event.target.name);

}

 
Image
Image
Company Logo
queue

 

Why am I getting "queue" as an image it's trying to load when i have <LoaderMax name="queue"....>

Link to comment
Share on other sites

The <LoaderMax> is a child of the XMLLoader. Remember, the whole LoaderMax system was built to be very modular and employs polymorphism, so LoaderMax instances can be nested inside other LoaderMax instances as deeply as you want, and they're still treated as a loader (it's just that when you load them, they're loading children and reporting on the overall progress of their children, etc.) 

 

If you only want to report on the ImageLoaders, you can simply put a conditional statement in your listener:

if (event.target is ImageLoader) {
    //code here
}
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...