Loading dynamic images into a Sky Box

Software: Away3D 4.x

BarfordSimon, Newbie
Posted: 12 October 2012 01:46 PM   Total Posts: 3

I’m trying to use a loader to populate the images in a Sky Box, so instead of using:

[Embed(source="assets/room1/right.jpg")]
public static  var room1_EnvPosX2:Class;

 
skyBoxCubeMap = new BitmapCubeTexture(room1_EnvPosX2().bitmapData,  etc etc etc); 

I’m trying to use something like:

var my_loader:Loader = new Loader();
my_loader.load(new URLRequest("../src/assets/room1/right.jpg"));
   
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETEstartListener);
   
function 
startListener(e:Event):void
   

var mybitmapData:BitmapData;
mybitmapData Bitmap(LoaderInfo(e.target).content).bitmapData;
skyBoxCubeMap = new BitmapCubeTexture(mybitmapDataetc etc etc
   } 

When I do that it throws a null object error on line 130 of BitmapCubeTexture.as

Any suggestions gratefully received!

Simon

 

 

   

Avatar
80prozent, Sr. Member
Posted: 12 October 2012 02:57 PM   Total Posts: 430   [ # 1 ]

hi

i am not shure, but this sounds a lot like you allready added the skybox to the scene, before any skyboxmaterial is applied.


edit: another thing you need to be aware of, is that you have to apply 6 bitmapdatas to the BitmapCubeTexture when creating it.
so maybe you should loadt your bitmapdata one after the other, and store them in a Vector.<BitmapData>.
when the Vector.<BitmapData> has a length of 6 all needed Bitmaps are loadet, and you should be able to create your skybox + CubeBitmapTexture without proplems.


hope that helps

 Signature 

sorry…i hope my actionscript is better than my english…

   

BarfordSimon, Newbie
Posted: 12 October 2012 04:39 PM   Total Posts: 3   [ # 2 ]

Thanks for your reply 80prozent.

I’ve just checked and I’m pretty sure that I add the materials first.

I will experiment with your suggestion and post back how I get on.

Simon

   

BarfordSimon, Newbie
Posted: 17 October 2012 03:18 PM   Total Posts: 3   [ # 3 ]

It transpires that 80prozent’s first suggestion was correct - because of the way I was preloading the skybox was was being added before textures. Many thanks for your help.

   

Avatar
Darcey, Moderator
Posted: 17 October 2012 03:56 PM   Total Posts: 209   [ # 4 ]

2 Articles I made for Away3D 4 Beta, but still works just fine.
Using LoaderMax API from greensock. This will example how to load many items at once also and display progress on them.

Preloaded textures example and source code:
http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/article.php?index=8&subindex=5&aid=320

Preloaded OBJ model example and source code:
http://www.allforthecode.co.uk/aftc/forum/user/modules/forum/article.php?index=8&subindex=8&aid=329

D

   

fcimage, Newbie
Posted: 06 November 2013 02:49 AM   Total Posts: 2   [ # 5 ]

i have no idea of your problem but i do know some vb method to load images from file or load images from url to some place. hope it is helpful to you. it may help you in some way.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X