[Papervision3D] How to retrieve embedded CSS backgroundImage and use it in Papervision?

aboteler aboteler at harris.com
Thu Aug 20 08:33:54 PDT 2009


I want to fetch the embedded resource backgroundImage in the Application
Class selector.  What I am doing is not working.  How can you fetch the
bitmap data from that embedded resource?

Here is what I tried: (image always equal null)

var selector:CSSStyleDeclaration =
StyleManager.getStyleDeclaration("Application");
var colors:Array = null;
var alphas:Array = null;
var imageClass:Class = null;
var image:BitmapAsset = null;
		
// clear out assets
while (backgroundSprite.numChildren > 0) {
	backgroundSprite.removeChildAt(0);
}
			
// is there an image to load?
imageClass = selector.getStyle("backgroundImage");
if (!imageClass) imageClass = selector.getStyle("backgroundImage");
image = new imageClass as BitmapAsset;
if (image) {
	alpha = selector.getStyle("backgroundAlpha");
	if (!(alpha as Boolean)) alpha = selector.getStyle("background-alpha");
	if (alpha as Boolean) image.alpha = alpha;		
	g.clear();
        g.beginBitmapFill(image.bitmapData,null,false);
	g.drawRect(0,0,viewport.width,viewport.height);	
	g.endFill();
} 

Thanks,

Aaron
-- 
View this message in context: http://www.nabble.com/How-to-retrieve-embedded-CSS-backgroundImage-and-use-it-in-Papervision--tp25064304p25064304.html
Sent from the Papervision3D mailing list archive at Nabble.com.




More information about the Papervision3D mailing list