This seems better but now I am getting:
TypeError: Error #1009: Cannot access a property or method of a null
object reference.

So I'm assuming I'm not referencing the material name/id quite
right!?!

This is what it says in my DAE:

<library_images>
                <image id="BodyDefault_png-img" name="BodyDefault_png-img">
                        <init_from>BODY.png</init_from>
                </image>
        </library_images>
        <library_materials>
                <material id="BodyDefault_png" name="BodyDefault_png">
                        <instance_effect url="#BodyDefault_png-fx"/>
                </material>
        </library_materials>

I am using "BodyDefault_png" as my material name as this is what
worked in Papervision.

I literally slapped that debug code (Debug.active = true;) in at the
top?!? I wasn't aware I had to do anything else. I have more of a
design brain than a programming one, though I am learning...
slowly. ;-)

Many thanks again Rob! By the way, I'm giving Away 3D a go after
seeing your talk at FOTB... I was very impressed! :-)

Away 3D seems a lot more user-friendly than Papervision but I suppose
that depends on whether or not I can get my project to work!

Ian



On Oct 27, 3:51 pm, "Rob Bateman" <[EMAIL PROTECTED]> wrote:
> The material returned in the getMaterial method can be any number of
> diferent types, whcih is why is it case as the geenric material type. If you
> are accessing materials that are bitmap textures, you can cast the returned
> material to BitmapMaterial before accessing properties, like so:
>
> var myBitmapMaterial:BitmapMaterial =
> materialLibrary.getMaterial("theIdFromTheDAE").material
> as BitmapMaterial
>
> myBitmapMaterial.smooth = true;
>
> this should get rid of your error.
>
> Unfortunately you haven't given enough information on how you are activating
> debug mode to see what the problem might be there!
>
> atb
>
> Rob
>
>
>
> On Mon, Oct 27, 2008 at 3:07 PM, Albinal <[EMAIL PROTECTED]> wrote:
>
> > Thanks. But unfortunately I can't get it to work. I have this error:
> > 1119: Access of possibly undefined property smooth through a reference
> > with static type away3d.materials:IMaterial.
>
> > I looked at the IMaterial.as file but it didn't really help?!? Do I
> > also have to update my material or something?!?
>
> > I also couldn't get the debug to work?!?
>
> > Elye
>
> > On Oct 22, 11:44 pm, "Rob Bateman" <[EMAIL PROTECTED]> wrote:
> > > on the loaded ObjectContainer3D or the Object3DLoader itself is the
> > > materialLibrary property:
>
> > > materialLibrary.getMaterial("theIdFromTheDAE").material.smooth = true;
>
> > > a bit more long winded, but having the material as a property of the
> > library
> > > object allows us to replace the material if we so wish like this:
>
> > > materialLibrary.getMaterial("theIdFromTheDAE").material = new
> > > BitmapMaterial(myBitmap);
>
> > > which can be handy too.
>
> > > a lot of the time the id and name attributes are the same for materials
> > and
> > > objects in a collada file. But just in case they're not, the loader
> > always
> > > uses the id attribute of the collada items for the names of objects and
> > > materials.
>
> > > if you prefer not to go rooting around in xml for object and material
> > names,
> > > you can do the following at the start of your application:
>
> > > Debug.active = true;
>
> > > this puts Away3d into debug mode, using the trace window to output data
> > > about various events. In the case of a collada file loading, the names of
> > > all parsed materials, bones, containers and mesh objects are output,
> > helping
> > > you find the right name for your material.
>
> > > hth
>
> > > Rob
>
> > > On Wed, Oct 22, 2008 at 3:04 PM, Albinal <[EMAIL PROTECTED]>
> > wrote:
>
> > > > If I am loading a texture through my DAE how do I set the texture to
> > > > smooth? In Papervision they have something like
> > > > "GetMaterialByName("theNameFromTheDAE").smooth = true;
>
> > > > Many thanks!
>
> > > > Elye
>
> > > --
> > > Rob Bateman
> > > Flash Development & Consultancy
>
> > > [EMAIL PROTECTED]
>
> --
> Rob Bateman
> Flash Development & Consultancy
>
> [EMAIL PROTECTED]

Reply via email to