博客园  :: 首页  :: 联系 :: 管理

Flash 和 C# 通讯

Posted on 2010-03-22 09:30  sunrack  阅读(239)  评论(0编辑  收藏  举报

import flash.external.ExternalInterface;
ExternalInterface.addCallback("SetWeight", null, SetWeight);

//-------------------------------------------
ExternalInterface.call("OnStartWeight","");

WeightPanel.labelWeight.text = "0";

//_global.CurPos = Number(0);

trace(_global.CurPos);

stop();

function SetWeight(weigth:String) {
    WeightPanel.labelWeight.text = weigth;
    //_global.CurPos = 190 + Number(WeightPanel.labelWeight.text);

    }

 

 

注意:不同的剪辑之间不能访问共享变量

一般是 主时间轴设接受C#调用,获得参数,然后赋值给全局变量 _global.xxx,

然后在进入剪辑A(movieA)的第一帧,设置 movieA._global.xxx = _global.xxx

这样就可以在剪辑A中使用 _global.xxx了