发新话题
打印

[讨论] flash用什么方法可以得天硬件的ID信息?

flash用什么方法可以得天硬件的ID信息?

如题,不知道有没有人会,例如得到硬盘的ID或什么硬件信息的,还请不吝赐教。十分感谢。

TOP

只能通过其他的程序 然后作接口
54371309[请发送:flash8会员问题]
正在更新中..070815   http://zszen.com

TOP

zszen版主能不能给个例子,是用什么方法?是ExternalInterface,还是用别的方法,有主动获得的方法吗?

TOP

ExternalInterface可以和外界沟通 这个类就是主动去获取对方语言的应用
54371309[请发送:flash8会员问题]
正在更新中..070815   http://zszen.com

TOP

那用什么办法,用COM吗,不懂了。

TOP

我从网上找到一个flash和vb.net调用的例子 你研究一下吧

http://blogs.vbcity.com/upload/drydo/Flash8Interaction.zip
54371309[请发送:flash8会员问题]
正在更新中..070815   http://zszen.com

TOP

原文地址:原文内容
引用:

.Net (VB.NET) and Interaction with Flash 8
Well, I received a copy of the new Macromedia Flash 8 and had some fun playing around with some new features and for the sake of this blog, those features that concern interaction with .NET (sample code provided in VB.NET).
A couple of years ago, before the world had crushed my spirit, I wrote this little FAQ titled 'Communicating between Macromedia Flash and VB' @ VBcity and until Flash 7, those elements held true - apart from the mildly cool XML class in ActionScript 1.0 Library that came out with Flash 6 - but it was only file/web based access.  (Would have been cool if it was Stream / byte based as well...)
So how does the Flash 8 control work differently?  Well, the control still supports the 'setVariable' and 'FSCommand' events so the techniques described in the  above article are fine.  However, both methods are not ideal - especially in circumstances where you want to execute routines in either Flash or .NET without any convulted timer / flag based systems.
Settle down my pink-cheeked children and let me show you new jive that replaces the old shuffle.
Flash 8 now has a new class called 'flash.external.ExternalInterface' that allows the Flash movie to communicate to the actual Flash Container (or ActiveX container if you wish).  Within this class are two methods, one for communicating to the control and one for adding functions that can be called from the control to the actual movie.  These are...
  • flash.external.ExternalInterface.addCallback - Which binds a function to the container allowing the container to call this function within the movie.
  • flash.external.ExternalInterface.call - Which executes a function at the control and thus its parent container.
Now it must be pointed out that using these methods for web use is completely different than using it for desktop use.  When used within a browser, the flash control dynamically identifies the appropriate function (e.g. Javascript function) to execute when using 'call' method and likewise the bound function can be called directly from the object itself (e.g. document.MyFlashControl.MyCustomFunction() ).  But, using the .NET framework a received 'call' is simply captured using the 'FlashCall' event - likewise, bound functions set using the 'addCallback' must be called using the 'CallFunction' method.
Another interesting element of this communication method is that data is now XML formatted.  Now I haven't looked too much into the various syntax flags specific for Flash (maybe something for another day), but a string can be passed as an argument using <string>Hello World</string> (which also ties into the ActionScript 2.0 notation).  So numerical values can be passed to and fro using <number>4</number>.  In fact, arrays can also be passed, e.g. "<array><property id='0'><number>1</number></property><property id='1'><number>4</number></property><property id='2'><number>16</number></property></array>", which is cool rather than delimiting large amounts of data...
Anyway, you can download all the project files just here, and if you haven't got a copy of Flash 8 Authoring (to viwe the source FLA), you can still use the compiled Flash 8 SWF file - but you will need the Flash 8 player installed.  
Have fun - M
Development Note: one interesting bug that occured was when I attempted to convert the e.request XML string from the FlashCall event into a .NET XML object.  Originally I tried a Dataset, which kept throwing 'The path contains invalid characters' error.  I tried an XMLTextReader that didn't work - I also tried converting the string using ASCII Encoder and UTF8 Encoder - but with no luck.  In the end, I passed the XML string through a StringReader which seemed to do the trick! :-o
54371309[请发送:flash8会员问题]
正在更新中..070815   http://zszen.com

TOP

外部发送给flash 同时,flash也要响应
vb.net的发送方法是[vb.net本人没看过,纯属抄袭,如果不对请指点]
Me.flash8Player.CallFunction("<invoke name=""沟通名称"" returntype=""xml""><arguments><string>" & 发送值 & "</string></arguments></invoke>")
js的发送方法是
window[swfobj的名称].沟通名称(发送值)
document[swfobj的名称].沟通名称(发送值)

给flash传递信息的时候一定要抓住flash这个插件对象
因为是静态函数 所以flash这边很轻松 写这个东西
flash中写上
ExternalInterface.addCallback("沟通名称", 实例对象[可不填], 响应函数);

=========================================
=========================================
flash发送给外部,同时外部响应
ExternalInterface.call("响应函数",参数...)

外部有这个响应函数就可以了 其他的没有添加的
54371309[请发送:flash8会员问题]
正在更新中..070815   http://zszen.com

TOP

当swf是在本地时,这种flash与外部交互的方法可取;如果swf在线,就行不通了,我也找过很多相关资料,不过都没找到答案
关于生命与花的寓言……

TOP

可以借助JS
复制内容到剪贴板
代码:
<script>
function getCode() {
      var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
      var service = locator.ConnectServer(".");
      var properties = service.ExecQuery("SELECT * FROM Win32_Processor");
      var e = new Enumerator (properties);
          var code;
      for (var p = e.item ();!e.atEnd();e.moveNext ()){
                code+= p.Caption;
            code+= p.DeviceID;
            code+= p.Name;
            code+= p.CpuStatus;
            code+= p.Availability;
            code+= p.Level;
            code+= p.ProcessorID;
            code+= p.SystemName;
            code+= p.ProcessorType;
      }
    return code;
}
</script>
在FLASH里面直接调用这个JS,就可以得到返回的CPU信息。要返回其它硬件信息也可以用这个方法。但需要用户确认允许AX控件执行

TOP

斑竹的意思是说 借助AX控件的话 可以通过JS获取硬件信息?
这样也不错也,之前我给我组长说有人提出可以用JS等获取,他不相信。。。
关于生命与花的寓言……

TOP

上面那个方法是我测试过才贴出来的
肯定可行。

TOP

上面那个方法是我测试过才贴出来的

上面那个方法是我测试过才贴出来的
肯定可行。

TOP

发新话题