flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CodeGirl <MichelleNicho...@yahoo.com>
Subject Loading JPG bitmapdata. Something like Embed but at runtime
Date Fri, 26 Aug 2016 13:23:06 GMT
If I have the image hard coded into my class, I do not get any errors and my
3D image loads.

[Embed("panels/BrownPanel.jpg")]
private static const BROWNPANEL:Class;

this.panelTexture = [new BROWNPANEL().bitmapData];

Guessing the bitmapdata is loaded at compile time.

however, when I try to load the image at run time, I keep getting an error
saying the bitmapData needs to be non-null.  
I have tried loaders of all kinds and I keep getting errors as if the
bitmapdata is not loaded yet at runtime.  I have tried using Image,
BitmapImage, Bitmap.  Still no joy.

I could post code on my loaders but I have tried so many variations. Ones
that supposedly work.

Here is the base classes code where the error is happening in my Shape3D.as
Class.
			graphics.clear();
			//draw
			for (i = 0; i < len; i++) {
				graphics.beginFill(colors[i]);
				graphics.drawTriangles(vertices, indices[i], null,
TriangleCulling.NEGATIVE);
				graphics.endFill();
				graphics.beginBitmapFill(texture[i], null, true, true);
				graphics.drawTriangles(vertices, indices[i], uvt[i],
TriangleCulling.NEGATIVE);
			}
			//finish
			graphics.endFill();

What do I need to do so that the bitmapdata is actually loaded?




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Loading-JPG-bitmapdata-Something-like-Embed-but-at-runtime-tp13402.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Mime
View raw message