loading multi files help

17 views
Skip to first unread message

NighterNet

unread,
Apr 19, 2009, 2:04:24 PM4/19/09
to away3d.dev
I need help on how to loaded multi files and making sure it fully load
and ready to be clone. I am trying to building a map editor to ease
some area. Not sure how code the right way.

desgraci

unread,
Apr 20, 2009, 10:06:09 AM4/20/09
to away3d.dev
Which way yoiu want to load them? i think you should explain in a more
comprehesive way what are you trying to do.

What i can think off imho, its to load the files to classes at the
very begining of the code, like when you have this:

function init():void
{
initEngine();
initMaterials();
initLights();
initObjects();
initButtons();
initListeners();
}

at initMaterials(){
//load your files here
}

or at the init, if u have, (i made that one time because the fies were
too big ^^, but just for one element XD so the user wont get a white
screen)

Or, if what u want is to load multiple assets without overcharging
your .swf u can use for sure the BitmapFileMAterial

var var1M:BitmapFileMaterial;
.
.
.
var varnM:BitmapFileMaterial;


var1M = new BitmapFileMaterial("./assets/XX1.JPG");
.
.
.
.
varnM = new BitmapFileMaterial("./assets/XXn.JPG");

Now if that doesnt solve ur problem, lets say u want to load a file
type .docx or stuff like that, well, i suggest to make with in Flex
components and the link them to the away engine.

http://www.switchonthecode.com/tutorials/getting-started-with-adobe-flex-and-away3d
or google it :s

NOW, if that doesnt help u, im really lost then XD

btw i was looking for that about the loading, i couldnt find info, in
fact i was trying to make a code but , well look:

funciont 1 (whatever, on click, over, front/behind :D ){
M1= new BitmapFileMaterial("./assets/1.JPG");
M2= new BitmapFileMaterial("./assets/2.JPG");
M3= new BitmapFileMaterial("./assets/3n.JPG");
M4= new BitmapFileMaterial("./assets/4.JPG");
M5= new BitmapFileMaterial("./assets/5.JPG");
M6= new BitmapFileMaterial("./assets/6.JPG");
myCube= new Cube ( {width:128, height:128, depth:128,faces:{front:M1,
back:M2, top:M3, bottom:M4,right:M5, left:M6} } );
// myCube.addOnSuccess(Charged);
/*
ok heres te mistake this addOnSucces i think is for a model, case like
3ds class, theres one for the cube?

*/

}

function Cargo(event:LoaderEvent)
{
//blah blah your code here
}

So i came up with that question also, theres a way to tell the engine,
hey u just finished loaded the materials, now do something. (?)

NighterNet

unread,
Apr 20, 2009, 11:06:48 AM4/20/09
to away3d.dev
Well I am trying to get the mesh and material loaded differently and
wait until it fully loaded. Then I be assigning mesh to a materials.
Next it to clone and build the map once all data is loaded. I am
trying to create map format for xml. To able to read and save map
format.
> http://www.switchonthecode.com/tutorials/getting-started-with-adobe-f...

desgraci

unread,
Apr 20, 2009, 12:00:51 PM4/20/09
to away3d.dev
ok about loading the mesh and textures, usually i do something like
this: (i use my models from 3ds xd)

var myLoader:Object3DLoader;
var myModel:ObjectContainer3D;

myLoader = Max3DS.load("assets/myModel.3ds",
{material:myModelMaterial, ownCanvas:true, centerMeshes:true,
pushfront:true});
myLoader.addOnSuccess(XXX);
scene.addChild(myLoader);

and in the function XXX i put what i want to be done when it loads the
texture. in this case the model attributes, or functions or stuff like
that, i think this is a very simple way to send secuencial acts with
your models, not sure how it works with primitives or Mesh, cause i
have to read who extends who, and that, im handing over the answer to
a dev, cause in fact im asking the same now XD (its contagious ur
question mr NighterNet)
Reply all
Reply to author
Forward
0 new messages