===== Overriding properties on load ===== There is a way to override material and geometry properties during file load process. It could be used for debugging or decorative purposes. For example, during debugging you may want to turn materials to 'wireframe', or decorate it with Goraud shading which is not a reflected in data file. You can also make modification to geometry data. === Registering callbacks === To be able to make changes to loading process a number callback functions can be registered for Xc3Loarer instance: '//onCreateColorMaterial// ' for color material , '//onCreateAssetMaterial//' Asset material ( images, textures etc.. ) and '//onCreateGeometry//' geometrical data. Following code illustrates these: /** * Function performs 3D data load from a X3c file. */ private function loadData(): void { /** stealth - simple model, no animation */ this.loader = new Xc3Loader("stealth.x3c"); this.loader.resourcePath = "/data"; // optimize animation this.loader.preCalcMotion = true; // register notification of load completion this.loader.addEventListener(LoadEvent.LOAD_COMPLETE, this.cast3dLoadComplete); // register notification of load error this.loader.addEventListener(LoadEvent.LOAD_ERROR, this.cast3dLoadError); /** Set Call back functions to modify, augment or substitute * material or/and geometry data. */ this.loader.portLoader.onCreateColorMaterial = onColorMaterial; this.loader.portLoader.onCreateAssetMaterial = onAssetMaterial; this.loader.portLoader.onCreateGeometry = onGeometry; // proceed with load this.loader.load(this.animator.source); } Here is sample code that replaces all materials with 'Wireframe' material. private function onColorMaterial ( name:String, material:ColorMaterial):Material { // if (name == "my_material") var materialAttr:MaterialAttributes = new MaterialAttributes( new LineAttributes( 0.5, 0x0011BB, 0.4 ), // new GouraudAttributes(), new LightAttributes( true, 0.1) ); material.attributes = materialAttr; material.lightingEnable = true; return material; } private function onAssetMaterial ( name:String, material:BitmapMaterial):Material { var materialAttr:MaterialAttributes = new MaterialAttributes( new LineAttributes( 0.5, 0x9911BB, 0.4 ), // new GouraudAttributes(), new LightAttributes( true, 0.1) ); material.attributes = materialAttr; material.lightingEnable = true; return material; } private function onGeometry ( name:String, geom:Geometry3D):void { } === Model could look like ===