Hi there,
Try to change your class name by something else, like 'customCube', or
whatever you want, but still different than an already existent class. By
doing this "var cube:Cube=new Cube();", you call a new instance of your
class, not the away3D Cube.
Try it :
package{
import flash.display.*;
import flash.events.*;
import away3d.containers.View3D;
import away3d.primitives.*;
public class customCube extends Sprite{
private var view:View3D;
public function customCube(){
stage.frameRate=30;
addChild(view=new View3D({x:100,y:200}));
view.addEventListener(Event.ENTER_FRAME,onFrame);
var cube:Cube=new Cube();
view.scene.addChild(cube);
}
private function onFrame(ev:Event):void{
view.render();
}
}
}
2011/1/6 Dinesh <[email protected]>
> Hi I am using away3d 2.5.2 and i am new to away3d. While i am creating
> a cube the following error can be showned.
>
> >>>>>1067: Implicit coercion of a value of type Cube to an unrelated type
> away3d.core.base:Object3D.<<<<<<
>
> Is it any wrong with my code.. please help me.
>
>
> my code:
>
> package{
> import flash.display.*;
> import flash.events.*;
> import away3d.containers.View3D;
> import away3d.primitives.*;
> public class Cube extends Sprite{
> private var view:View3D;
> public function Cube(){
> stage.frameRate=30;
> addChild(view=new View3D({x:100,y:200}));
> view.addEventListener(Event.ENTER_FRAME,onFrame);
> var cube:Cube=new Cube();
> view.scene.addChild(cube);
> }
> private function onFrame(ev:Event):void{
> view.render();
> }
> }
> }