no, I thought you were using to 4.0.

to parse your result handle, 
take a look at some classes in tools where you'll find recursive methods.

your test is limited to first level. take the case for instance where handle is 
a container and only child is a container with meshes inside.
your loop will not access these, while its precisely the one you want in order 
to mod their materials.

Fabrice


On May 18, 2011, at 10:41 AM, danhpc wrote:

> I'm using Away3D 3.6 & Flash Player 10. Broomstick cans do this?
> I see in the Obj.as file has the comments as below:
> 
> /**
>    * File loader for the OBJ file format.<br/>
>    * <br/>
>       * note: Multiple objects support and autoload mtls are supported
> since Away v 2.1.<br/>
>       * Class tested with the following 3D apps:<br/>
>       ....
>       * - geometry supported tags: f,v,vt, g<br/>
>       * - geometry unsupported tags:vn,ka, kd r g b, kd, ks r g b,ks,ke r g
> b,ke,d alpha,d,tr alpha,tr,ns s,ns,illum n,illum,map_Ka,map_Bump<br/>
>       * - mtl unsupported tags: kd,ka,ks,ns,tr<br/>
>       * <br/>
>       * export from apps as polygon group or mesh as .obj file.<br/>
>       * added support for 3dmax negative vertexes references
>    */
> 
> It seems the version 3.6 can't help, right?
> 
> Regards,
> danhpc
> 
> On May 18, 3:09 pm, richardolsson <[email protected]> wrote:
>> What version of Away3D are you using? Is this Broomstick (Flash Player
>> 11, Away 4.0), or one of the older engine versions?
>> 
>> Cheers
>> /R
>> 
>> On May 18, 5:59 am, danhpc <[email protected]> wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Sorry Michael for my typo. Correct your name.
>> 
>>> On May 18, 10:48 am, Cong Danh Pham <[email protected]>
>>> wrote:
>> 
>>>> Thanks for your supports Michael and Fabrice.
>> 
>>>> I tried to load obj file. It cans appear but the color is still random?
>>>> The attached files was exported from 3D Max.
>>>> It seems that was lost name of object3d in away3d. ??? --> I need the name
>>>> of these.
>>>> khoi2.obj & khoi2.mtl is the same folder.
>> 
>>>> This is my code:
>>>> loader = Obj.load("presentation/assets/khoi2.obj", { scaling:10,
>>>> bothsides:true });
>>>> loader.addOnSuccess(onSuccess);
>> 
>>>> private function onSuccess(event:Loader3DEvent):void
>>>>             {
>>>>                 if (loader) {
>>>>                      var objContainer3D:ObjectContainer3D =
>>>> event.loader.handle as ObjectContainer3D;
>>>>                      for (var i:int=objContainer3D.children.length-1; 
>>>> i>=0;)
>>>>                      {
>>>> // NAME IS NULL HERE
>>>>                         //var meshObject:Mesh =
>>>> ObjectContainer3D(event.loader.handle).getChildByName(objContainer3D.childr
>>>>  en[i].name)
>>>> as Mesh;
>> 
>>>> HOW TO GET ORIGINAL COLOR IN ".mtl file" TO SET TO THESE OBJECT3D?
>> 
>>>>                          group.addChild(objContainer3D.children[i]);
>>>>                          i--;
>>>>                      }
>>>>                 }
>>>>             }
>> 
>>>> Regards,
>>>> danhpc
>> 
>>>> On Tue, May 17, 2011 at 7:28 PM, Fabrice3D <[email protected]> wrote:
>>>>> loading another file(.dae, .obj...) in away3d that cans show
>>>>>> original color of object?
>> 
>>>>> ObjParser does support file based color objects.
>>>>> The .mtl parser reads the following tags for color objects definitions:
>> 
>>>>> "Ka": ambientColor
>>>>> "Ks": specularColor
>>>>> "Ns": specular value
>>>>> "Kd": diffuseColor
>>>>> Transparency is supported by "tr": or "d" tags
>> 
>>>>> Fabrice
>> 
>>>>> On May 17, 2011, at 12:54 PM, Michael Iv wrote:
>> 
>>>>> In such a case I would suggest you a workaround. The simpliest is to 
>>>>> append
>>>>> to each model's file name a prefix or suffix holding the color value.Then
>>>>> when loading the model you can read the file name and parse its
>>>>> suffix/prefix to the color flag then using simple "swtich()" or "if" 
>>>>> assign
>>>>> the matching colors during the runtime. The more complex way is to hack 
>>>>> the
>>>>> exporter and parser .
>> 
>>>>> On Tue, May 17, 2011 at 1:49 PM, danhpc 
>>>>> <[email protected]>wrote:
>> 
>>>>>> Thanks for your quickly answer.
>>>>>> But I don't want to assign my own color to those object. Because I
>>>>>> have a lot of 3ds file. Each one has object3ds with different color. I
>>>>>> don't want to hard code to assign this. It's not accord with my
>>>>>> business.
>>>>>> If I use loading another file(.dae, .obj...) in away3d that cans show
>>>>>> original color of object?
>> 
>>>>>> Do you have any way to do this?
>> 
>>>>>> Regards,
>>>>>> danhpc
>> 
>>>>>> On May 17, 5:22 pm, Michael Iv <[email protected]> wrote:
>>>>>>> You can't.Away3D assigns usually by default a random ColorMaterial to
>>>>>> the
>>>>>>> objects that have no texture supplied.But you can always assign your own
>>>>>>> color inside Away3D :)
>> 
>>>>>>> On Tue, May 17, 2011 at 1:16 PM, danhpc <[email protected]
>>>>>>> wrote:
>> 
>>>>>>>> Hi all,
>> 
>>>>>>>> I'm newbie in away3d. I have a problem that is loading original color
>>>>>>>> of object3d which was made from 3DS MAX.
>>>>>>>> I have a model 3d without material (because some model don't have
>>>>>>>> material, it just have color). I have just assined color to it then
>>>>>>>> export it to 3ds file. I want to load that model with assigned
>>>>>>>> color.
>>>>>>>> Because I have yet to set the material property on any of our meshes.
>>>>>>>> They are all displayed using the default material type - a
>>>>>>>> WireColorMaterial object with a random color defined for the surface
>>>>>>>> fill. --> That I don't want.
>> 
>>>>>>>> How can I load my model with assigned color like the model which I
>>>>>>>> drew from beginning in .max file?
>> 
>>>>>>>> ex:
>>>>>>>> I have Box, I set green color to box and then export to 3ds file. Then
>>>>>>>> show that model with that color without mesh type.
>> 
>>>>>>>> Could you please help me out?
>> 
>>>>>>> --
>>>>>>> Michael Ivanov ,Programmer
>>>>>>> Neurotech Solutions Ltd.
>>>>>>> Flex|Air |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.net
>>>>>>> Tel:054-4962254
>>>>>>> [email protected]
>>>>>>> [email protected]
>> 
>>>>> --
>>>>> Michael Ivanov ,Programmer
>>>>> Neurotech Solutions Ltd.
>>>>> Flex|Air |3D|Unity|
>>>>> www.neurotechresearch.com
>>>>> http://blog.alladvanced.net
>>>>> Tel:054-4962254
>>>>> [email protected]
>>>>> [email protected]
>> 
>>>>  khoi2.mtl
>>>> < 1KViewDownload
>> 
>>>>  khoi2.obj
>>>> 42KViewDownload

Reply via email to