- 浏览: 1451551 次
- 性别:
- 来自: 苏州
文章分类
- 全部博客 (564)
- 算法 (7)
- 流金岁月 (1)
- Javascript (30)
- actionscript (108)
- as3.0 game (14)
- flex (84)
- fms2 (27)
- 正则表达式 (7)
- 开源组件代码(as3.0) (1)
- Pv3d (13)
- Cairngorm (4)
- vbs (54)
- VB程序设计 (26)
- 计算机应用与维护 (4)
- 职场实用穿衣技巧 (3)
- 历史风云 (15)
- 淡泊明志,宁静致远 (12)
- 情感 (26)
- 杂谈 (41)
- 越南风 (14)
- DirectX (9)
- Dev-cpp (11)
- 回望百年 (2)
- 建站经验 (2)
- Python (24)
- 网络赚钱 (4)
- php (2)
- html (1)
- ob0短址网 (1)
- ob0.cn (1)
- wordpress (1)
- pandas logistic (1)
- haxe (1)
- opencv (1)
- 微信小程序 (3)
- vue (3)
- Flutter (1)
最新评论
-
GGGGeek:
第一个函数滚动监听不起作用,onPageScroll可以
微信小程序--搜索框滚动到顶部时悬浮 -
naomibyron:
解决办法:工具 -> 编译选项 -> 编译器 ...
dev-c++中编译含WINSOCK的代码出现错误的解决方法 -
haichuan11:
这个…… 代码不全真的是让人很憋屈的感觉啊
actionScript 3.0 图片裁剪及旋转 -
chenyw101:
老兄能留个QQ号吗?具体的我有些东西想请教下你
用VB制作网站登陆器 -
yantao1943:
貌似有点问题,只派发一次事件啊
使用ActionScript 2.0或ActionScript 3.0处理音频文件的提示点(cue
1, http://hi.baidu.com/qinpc/blog/item/58253df3f9a04654352acc36.html 复杂的界面有多层窗口组成,当windows在窗口改变大小的时候是先重画父窗口,然后重画子窗口,子父窗口重画的过程一般无法在一个刷新周期内完成,所以会呈现闪烁。我们知道父窗口上被子窗口挡住的部分其实没必要重画的。 解决方法:给窗口加个风格 WS_CLIPCHILDREN ,这样父窗口上被子窗口挡住的部分就不会重画了。如果同级窗口之间有重叠,那么需要再加上 WS_CLIPSIBLINGS 风格 Nothing explains it like code. Take a look at the following C++ snippet1: Flex C++ Bridge is a C++ library that lets you communicate with Flex in a manner more suited for the normal C++ programmer, i.e, you can communicate to flex from c++ by writing code like shown above. Once you put the Flex Ajax bridge into a Flex application, it is exposed to scripting in the browser. You can use a slightly modified version of the same FABridge.as2 (or even the same one) on the actionscript side and the flex application is exposed to the Flex C++ Bridge. This is for C++ applications that need an awesome UI but do not want to re-write their existing c++ code and libraries to actionscript / javascript. It's a normal desktop application, you can interact with all your favorite C++ libraries and APIs and still have all the rich expressiveness that flex can deliver. You could do all this before as well, but the bridge makes it really easy to use Flex from C++. A lot of the reasons for FABridge applies to this as well, but this is outside the browser realm so those reasons have to be filtered to suit that particular fact. The project is licensed under MPL 1.1 and both the C++ and actionscript source code is available atcode.google.com. It's open source, so feel free to participate and contribute to it. Note: The source (both flex and cpp) is available for all the examples. Here, each individual cells in the ADG are editable. You can type in any Excel formula into it and hit the "Compute" button. The application invokes Excel using COM, computes the results and populates the result into the ADG. When the Scan button is clicked, a TWAIN dialog pops up letting you use your scanner to scan images directly into the pages of the flexbook component. The bridge supports multiple flash player instances. It can talk to each instance in a different manner. If you look at the screenshot, both the instances are loading the same swf file. But the C++ code for one instance adds a datagrid and removes an element shown in the pie chart. The flash player ActiveX control is added to a MFC dialog. Now the content in the flash player can talk to the C++ application via ExternalInterface. ExternalInterface.call("fnname") will dispatch a FlashCall message on the C++ side which will have the arguments passed to call() in XML. This XML has to be parsed to understand what the message was from the actionscript side. All this complexity is hidden by the bridge. The bridge talks with the actionscript side of Ely's FABridge and facilitates calling and referencing to actionscript objects, classes and methods. There are multiple worker threads waiting to process incoming or outgoing flash requests so that the main MFC thread does not block. The bridge can even support multiple flash player instances each with it's own bridge back to the C++ application. Also, Actionscript exceptions are serialized and thrown on the C++ side. To start off, you need the root object which is the main application object of your flex application. Now you can access the public methods and properties of your application. Getters and setters are treated differently: A property "width" will be translated to "getwidth" for retrieving the value and "setwidth" for setting the value. Ely's FABridge had camel casing here, but that has been removed so that constants like MOUSE_DOWN don't confuse the bridge. The "Call" method shown in the snippets above take a string as the first argument that is the name of the method or property (suitably modified using above defined rules) and the arguments for it. Common types like string, int, reference to an AS object, custom anonymous AS object etc are converted internally to an ASObject thanks to copy constructors and operator overloads. For more examples of the syntax, take a look at the Worker() method in ASWorkSample.cpp. FABridge did not originally have support for accessing methods and variables of static classes. This was added by Devin Garner and I have incorporated his code into FABridge.as along with some of my changes. Currently, it supports only Windows since it embeds the internet explorer flash ActiveX control in a MFC dialog. But it's an open source project and I hope I'll get contributors to help me make it more platform agnostic. I'd love to know what you guys think about this and how it's being used. CategoryFlexCPPBridge Comment(s) [1] Now, this is a better way to communicate rather than saying m_Shockwave.CallFunction("asfnname") where asfnname has to be exposed by using ExternalInterface.addCallback on the actionscript side. 3. 关键字: flex win32 vc++ vc externalinterface
What?
//addeventlistener to call a cpp function
oRootObj.Call("getbutton1").Call("addEventListener", "click", SampleCallback);
//where SampleCallback is:
void SampleCallback(CASObject& obj, CFlexBridge* pBridge)
{
CASObject oRootObj;
pBridge->Root(oRootObj);
oRootObj.Call("getpanel1").Call("settitle", "Title from CPP");
}
//c++ way of saying Alert.show("StaticClassCalled")
pBridge->ClassRef("mx.controls.Alert").Call("show", "StaticClassCalled");
//create a datagrid and add it to the flex app
CASObject oDGrid = pBridge->Create("mx.controls.DataGrid");
oRootObj.Call("addChild", oDGrid);
Flex is for the web, AIR is for the desktop. What is this for?
Where can I get it from?
Sample Applications
AdvancedDataGrid that supports Excel formulae computation:
Scan images right into flexbook:
Sample app showing two flash player instances each with a flex application:
How does it work?
C++ Syntax Rules
Fine Print
[2] Minor changes to support passing of primitives from me and additional support for accessing static classes, variables and methods thanks to Devin Garner)Flex与Win32通信实例之ExternalInterface
项目中要实现Flex打开文件夹选择框(Flex做为桌面程序的UI),没办法,如果不用AIR只能在下面加一层Container了。网上搜来搜去差不多都是讲FSCommand怎样与VC++交互,可是FSCommand不能及时返回值呀。经过一番摸索,终于调通了ExternalInterface在VC++中的处理流程,看代码。
Cpp代码
void CMyBicapDlg::OnFlashCallShockwaveflash1(LPCTSTR request)
{
// TODO: Add your control notification handler code here
// "<invoke name='%s' returntype='xml'><arguments><string>%s</string></arguments></invoke>"
// parse request
TiXmlDocument request_xml;
request_xml.Parse(request);
const char* request_name = request_xml.RootElement()->Attribute("name");
if (strcmp(request_name,"savedVideosDirectory") == 0 || strcmp(request_name,"bufferDirectory") == 0 || strcmp(request_name,"preferredExportDirectory") == 0)
{
// choose path
CoInitialize(NULL);
BROWSEINFO bi;
bi.hwndOwner = this->GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = NULL;
bi.lpszTitle = NULL;
bi.ulFlags = BIF_BROWSEFORCOMPUTER|BIF_RETURNONLYFSDIRS|BIF_STATUSTEXT;
bi.lpfn = NULL;
LPCITEMIDLIST pidl = SHBrowseForFolder(&bi);
if(pidl != NULL)
{
TCHAR tpath[MAX_PATH] = _T("");
BOOL bresult = SHGetPathFromIDList(pidl, tpath);
if (bresult)
{
std::string re_value = "<string>";
re_value = re_value+tpath+"</string>";
m_FlashPlayer.SetReturnValue(re_value.c_str());
}
}
CoUninitialize();
}
}
首先,需要在项目中嵌入Flash player插件,网上有很多例子。另外Flex也要写好代码,这里略掉。
添加一个ExternalInterface的事件处理函数,对于Flash player来讲就是FlashCall事件(跟FSCommand不同的),这里的事件处理函数是void CMyBicapDlg::OnFlashCallShockwaveflash1(LPCTSTR request)。没有返回值(下面会讲到),参数是一个XML格式的字符串。格式是"<invoke name='%s' returntype='xml'><arguments><string>%s</string></arguments></invoke>",去查查帮助就知道了。
处理request:标准C++没有处理XML的库,我去下载了tinyxml,小巧好用。下面就是按照个人需要处理request了,我这里是,打开一个文件夹选择对话框然后选择一个路径。
返回值。事件处理函数是没有返回值的,但是flash player提供了一个方法:m_FlashPlayer.SetReturnValue(re_value.c_str());,专门传递返回值,格式是<string>%s</string>(也可以是别的AS结构,具体看帮助)。
需要提醒的是,在处理期间要block掉Flex,ExternalInterface.call是有返回值的,如果不阻塞Flex,可能返回就是NULL,呵呵,不知道深层原因。另外,反过来调用格式也是一样的。
调试环境:win xp, VC++6.0, Flex builder 2.0
发表评论
-
Apache FlexJS 0.0.1 和 Apache Flex FalconJX 0.0.1发布
2015-11-01 19:44 554原文地址:http://note.sdo.com/u/634 ... -
Flash Catalyst 常用键盘快捷键
2011-03-28 15:38 1065转自:http://www.riameeting.com/ ... -
8款很实用的Actionscript写的位图(BitMap)操作类
2011-03-24 12:09 1943AS3 Scale9 Bitmap ... -
flex应用开发/flash应用开发 代做flash作业/flex作业
2011-01-09 20:37 347专业承接flex应用开发/flash应用开发 ... -
脑袋里的秘密,输入姓名就可以知道你在想什么! flex版
2010-12-29 11:34 2548输入名字就可以知道她/他在想什么的工具~~ -
一个flex聊天机器人
2010-12-18 10:42 1657无聊之下所作,供大伙娱乐,随边聊聊。。。 -
Flex:基于Flex-config.xml的命令行编译
2009-07-01 09:33 1893关键字: Flex Flex2 编译 mxmlc ... -
抽出flash与java 用AMF交互代码
2009-06-30 15:09 3661最近做的一个java 与flash通讯的项目,由于项目框 ... -
BulkLoader类和PV3D
2009-06-26 17:02 1969AS3取消了movieclip的loader类,所以加 ... -
使用 Flex Builder 3.x 分析工具 Profile
2009-06-25 11:26 3415前言 关于分析工具 (原文见Flex Builder ... -
AMF3+JAVA的调用范例
2009-06-24 17:44 2564[AS3]AMF3+JAVA的调用范例 amf是Ad ... -
Flex 程序性能测试
2009-06-24 16:02 1953Flex 程序性能测试 作者:叶晖俊 yehui ... -
Flex RemoteObject类参考
2009-06-19 11:39 1243<mx:RemoteObject>标记 ... -
flex画的菱形
2009-05-11 16:19 3456package com { impo ... -
理解 Flex itemRenderer - 第 4 部分: 状态和过渡
2009-05-08 09:23 1718itemRenderer 最擅长与应用 ... -
理解 Flex itemRenderer - 第 5 部分: 效率
2009-05-08 09:21 1769如果您要显示大量 itemRenderer-无论在 Dat ... -
VO to XML converter
2009-05-04 09:00 1152private function convertToXM ... -
Flex全屏
2008-09-26 11:11 1795private function goFullScreen( ... -
ExternalInterface在Firefox下出错的bug
2008-09-16 09:28 3181使用Document Class为避免命名空间冲突,通常会取消 ... -
Flex与Win32通信实例之ExternalInterface
2008-09-11 16:34 3490关键字: flex win32 vc++ vc externa ...
相关推荐
例如,在VC++环境中,你可以创建一个lex源文件(通常扩展名为.l或.flex),编写正则表达式规则来定义不同类型的词素,然后使用flex工具将其转换为C++代码。 **解析器生成器(Parser Generator)** 解析器生成器,如...
通过上述详细的步骤,初学者可以轻松地在VS2008环境中使用Flex和Bison工具。正确地配置这些工具不仅可以提高开发效率,还能帮助理解词法分析器和语法分析器的工作原理。希望本指南能帮助大家顺利地完成学习任务。
"vc运行环境"指的是Visual C++的开发环境,因为Flex通常与C或C++一起使用,且在Windows环境下可能需要VC++的编译器和支持库来编译和运行生成的代码。 "Flex.exe"很可能是Flex工具本身,这是一个命令行工具,可以...
例如,当Flex中的按钮被点击时,可以触发一个事件,MFC接收到事件后执行相应的操作。 8. **调试与优化**:在开发过程中,要确保MFC和Flex的交互无误,可能需要使用Flex的调试器和MFC的调试工具进行联合调试,找出并...
在VC++环境中,我们可以创建一个新的MFC应用程序项目,然后在该项目中集成编译器的不同组件。例如,我们可以创建一个文本编辑器窗口供用户输入源代码,使用MFC的消息处理机制来捕获用户的编译请求,接着调用自定义...
C++标准库中并没有内置的正则表达式支持,但在VC++6.0环境下,开发者可能会选择第三方库如Flex和Bison,或者自定义的算法来实现这个功能。 词法分析器的工作流程如下: 1. 读取源代码文件:从指定的输入文件中读取...
词法分析器通过识别输入流中的模式来完成这个过程,这个过程通常基于正则表达式或者使用自动生成的工具,如lex或flex。 在VC++环境中实现词法分析器,开发者需要对C++语言有深入的理解,同时熟悉编译原理中的词法...
VC 和 VC++ 的区别是,VC 是一个开发工具,VC++ 是使用 C++ 语言的工具。 VB(Visual Basic)是一种桌面程序开发技术,微软研发的。Basic 是比尔盖兹发家致富的一大工具。主要用来做桌面程序,C/S 系统。现在有了 ...
Java、C、C++、VC、VC++、VB 是编程领域的六种重要语言或开发工具,它们各有特点,适用于不同的应用场景。...学习编程还需要关注相关平台、框架和库,如.NET中的C#,或是Web开发中的Flex和Ruby等。
- VC++ 使用了Microsoft的MFC库,简化了Windows应用程序开发。 5. VB(Visual Basic): - VB 是微软开发的基于Basic语言的可视化编程工具,曾经流行于桌面应用开发。 - VB 提供了直观的拖放界面设计,适合快速...
在VC++环境中,可以使用自定义的词法分析器来实现这一过程。词法分析器通常通过正则表达式或者有限状态自动机(FSA)来识别和分类输入中的不同元素。 语法分析紧接着词法分析,它负责验证由词法分析器生成的token...
同时,对于想要提升MFC应用开发能力的程序员,这份源码同样有价值,因为它展示了如何在实际项目中运用MFC框架。 总的来说,通过研读这份VC++编写的C编译器源代码和设计文档,我们可以增强对编译原理的理解,提升C++...
2012-06-11 09:50 3,412,722 内部文件非内部程序员禁止访问谢谢1234567890123456789能够实现文件的多选,统一上传,从而实现文件的批量上传Flex多文件上传源码VS2005.rar 2012-06-11 10:08 1,481,225 几个C语言小...
7. **工具支持**:在VC++环境中,开发者可以使用如Flex(词法分析器生成器)和Bison(语法分析器生成器)等工具,它们能够根据给定的规则文件自动生成词法分析器和语法分析器的源代码。 8. **源代码文件管理**:在...
6. **预编译头文件(stdafx.h)**:VC++项目中常见的预编译头文件,用于包含常用库和常量定义,减少编译时间。 7. **调试技巧**:VC++的IDE提供了强大的调试工具,如断点、单步执行、查看变量值、调用堆栈分析等,...
标题中的"CPP_flash.rar"表明这是一个使用C++编程语言编写的程序,而"FlashMX/Flex源码"则表示该程序涉及到Adobe Flash MX或Flex的相关技术。"Visual C++"是指开发环境,即使用了微软的Visual Studio IDE,特别是...
总之,"cifafenxiqi.rar_cifafenxiqi" 实验提供了一个实践性的平台,让我们深入理解编译原理中的语法分析过程,结合VC++的使用,能够加深对编译器构造的理论知识与实践经验的结合。无论是对于学术研究还是工程实践,...
需要注意的是,C++ 是语言,VC++ 是工具,是一门使用 C++ 语言的工具。 VB VB(Visual Basic)是一种桌面程序开发技术,由微软研发。VB 的主要用途是做桌面程序、C/S 系统。然而,由于 Delphi 的冲击,VB 被强占了...