Jump to content
Search Community

Tile Background with a Dynamically loaded image using XMLLoader

Marcus Aurelius test
Moderator Tag

Recommended Posts

Hi,

 

I'm not sure if this is a Greensock question or a AS3 question.

 

I was wondering how to tile a background using an image pulled from an xml file e.g.

xml file:

 

<?xml version="1.0" encoding="UTF-8"?>
<configSettings>
<ImageLoader url="com/siteA/assets/images/footerBar.png"
name="footerImage"
estimatedBytes = "1000"
container= "this"
load="true"/>
</configSettings>

 

AS3 code:

 

var footerImage:ContentDisplay = LoaderMax.getContent("footerImage");
  footerContainer = new Sprite();
  footerContainer.graphics.beginBitmapFill("footerImage");
  footerContainer.graphics.drawRect(0, 0, stage.stageWidth, footer.height);
  footerContainer.graphics.endFill();
  footer.addChild(footerContainer);

 

This doesnt work for some reason. There is obviously a lot more code but hope you get the idea.

 

This is how I would do it if the image was in the Library:

 


var footerContainer:Sprite;
var footerImage:BitmapData = new tileImg(0,0);
footerContainer = new Sprite();
footerContainer.graphics.beginBitmapFill(footerImage);
footerContainer.graphics.drawRect(0, 0, stage.stageWidth, footerImage.height);
footerContainer.graphics.endFill();
addChild(footerContainer);

 

But cant seem to figure it out using XMLLoader e.t.c.

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...