[LayaNative 2.0]为什么全局属性赋值后,在另外个函数中调用会自动变成undefined


QQ截图20190328204657.png

public class MainPageController extends Scene {
        
        public var camera:Camera;
        
        public function MainPageController(){
            super();
            Laya.stage.scaleMode = Stage.SCALE_FULL;
            Laya.stage.screenMode = Stage.SCREEN_NONE; 
            Scene3D.load("res/model/LayaScene_Car/Conventional/car.ls", Handler.create(null, function(scene:Scene3D):void {
                Laya.stage.addChild(scene) as Scene3D;
                camera = scene.getChildByName("Main Camera") as Camera;
                Laya.stage.on(Event.MOUSE_DOWN, this, onMouseDown);
                trace(camera);
            }))
        } 
        public function onMouseDown():void {
            trace(camera);
            
        } 
    }
 
代码如上 AS3语言
已邀请:

要回复问题请先

商务合作
商务合作