Hooch Posted June 2, 2009 Share Posted June 2, 2009 Hello all, I have Googled this a couple ways and have found absolutely nothing.I simply want a flash file to get it's background color from an xml file.Eventually I will change the xml file to a php file that gets the color froma database. Then I will have a member pick their own color scheme. Thank you. Link to comment Share on other sites More sharing options...
OmerHassan Posted June 3, 2009 Share Posted June 3, 2009 Hello all, I have Googled this a couple ways and have found absolutely nothing.I simply want a flash file to get it's background color from an xml file.Eventually I will change the xml file to a php file that gets the color froma database. Then I will have a member pick their own color scheme. Thank you.I don't think you can change the background of your Flash movie but you can use a different colored rectangle as the background.This is how you read a color from an XML file:var xmlLoader:URLLoader = new URLLoader( new URLRequest("bgcolor.xml") );xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);function xmlLoaded(e:Event):void{ var bgcolor:XML = XML(xmlLoader.data); var bg:Shape = new Shape(); bg.graphics.beignFill(uint(bgcolor.color)); bg.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); bg.graphics.endFill(); addChildAt(bg, 0);} bgcolor.xml is your XML file which contains the hexadecimal color code inside <color></color> tags. Link to comment Share on other sites More sharing options...
Hooch Posted June 3, 2009 Author Share Posted June 3, 2009 Thanks OmerDo I make the rectangle a movie clip?I am not up on flash.ty Link to comment Share on other sites More sharing options...
OmerHassan Posted June 4, 2009 Share Posted June 4, 2009 No, the rectangle will be a Shape object. It takes up less memory and will do the job. It will be generated by the code I wrote in my previous post (I have not tried executing it so let me know if it's erroneous); you won't have to draw your own rectangle. Link to comment Share on other sites More sharing options...
Hooch Posted June 4, 2009 Author Share Posted June 4, 2009 The xml code needs tweakinghere's what I have. <?xml version="1.0" encoding="utf-8"?><color bgcolor="0xff6600"></color> I have tried the following with no luck either <?xml version="1.0" encoding="utf-8"?><color>#FF6600</color> Link to comment Share on other sites More sharing options...
Hooch Posted June 13, 2009 Author Share Posted June 13, 2009 Hey Omer any ideas on the xml file? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.