Mac FlexWeaver: Edit & Compile Flex Apps in Dreamweaver
Last Monday, I wrote about how you can configure Dreamweaver to edit and compile MXML. However, that method only works in Windows, since it uses some Windows-only (and undocumented) methods of the Dreamweaver Extensibility API.
It is a week later, and I have been busy brewing up a solution for us Mac users. One caveat at the outset: I'm on an Intel-based Mac, and so I haven't tested any of this on the Power PC architecture. This procedure requires Dreamweaver 8, and assumes that you have installed the Flex 2 SDK.
For your convenience, I have packaged the necessary files into a handy zip archive. You can download them here: http://labs.tom-lee.com/FlexWeaver/FlexWeaver.zip.
Installation
Opening the package, you'll see several folders. This section will tell you what they are, and where to put them.
Configuration
After you have copied the files to their proper locations, launch Dreamweaver. In the "Commands" menu, you should now see two new commands: Flex Compile, and Flex Preferences. Flex Preferences allows you to specify the location of the Flex compiler, the FlexCompileHelper app, and the output path for your SWF file, as well as any command line options you wish to use.
As you can (hopefully) see from the screen-shot, I have left the SWF Output Directory field blank. Since it is blank, SWFs will be placed in the same directory as their corresponding MXML files. Also, I have typed "-incremental=true" in the Additional Compiler Options field, to enable incremental compiling. When you click the "Save" button, a file called "FlexCompilerPreferences.txt" is created in your Dreamweaver configuration folder. This file merely stores all the values you enter into the Flex Compiler Preferences dialog.
Before we continue on, it would be a good idea to set MXML files to open in Dreamweaver. To do so, select an mxml file (you can find one in flex_sdk_2:samples) and go to File > Get Info in the Finder. Find where it says "Open With", select "Other" from the drop-down menu, and then browse to your Dreamweaver installation. Once you have Dreamweaver selected, you can click the "Change All" button to make all MXML files open in Dreamweaver.
Now it's time to compile something. Just open an MXML file in Dreamweaver, and select Commands > Flex Compile. This does a number of things:
Error Checking
If the Flex Compile Preferences have not been set correctly, or an MXML file is not the active file in Dreamweaver, the Flex Compile command will not be available. Here is a list of the conditions under which Flex Compile will be grayed out:
Further Explanation
This may seem like a lot of moving parts to achieve what should be a simple task. It was easier on Windows, thanks to the MM.createProcess command, which allowed me to call mxmlc directly from Dreamweaver and also catch its output. Unfortunately, this command does not work on the Mac. So, I had to create the AppleScript application which I could call with the more standard dreamweaver.openWithApp command. Since that command does not facilitate passing data to the application it's launching, I had to first write the necessary parameters into a text file which the application could then read.
I also spent a fair amount of time fighting with the mxmlc shell script, which choked on spaces in filenames. By default, it treats a space as an argument separator. If you open mxmlc in a text editor, and look at the last line, you will see this:
By the way, if you want to see what's in FlexCompileHelper.app, feel free to open it up. I have not protected the contents from being decompiled, so you should be able to see it in Script Editor.
Conclusion
Well, that's it for now. Can this be improved upon? You betcha. This meets my needs for now though, so I probably won't spend too much more time on it. If you have a suggestion on how to streamline this puppy, I'm all ears. I'm kind of intrigued by the fact that even Dreamweaver's code hinting is extensible. I may take on the challenge of adding code hinting to FlexWeaver, but if I do, it won't be for a while. Enjoy, and let me know if you have questions or comments.
It is a week later, and I have been busy brewing up a solution for us Mac users. One caveat at the outset: I'm on an Intel-based Mac, and so I haven't tested any of this on the Power PC architecture. This procedure requires Dreamweaver 8, and assumes that you have installed the Flex 2 SDK.
For your convenience, I have packaged the necessary files into a handy zip archive. You can download them here: http://labs.tom-lee.com/FlexWeaver/FlexWeaver.zip.
Installation
Opening the package, you'll see several folders. This section will tell you what they are, and where to put them.
- Commands - Contains the necessary files for two new Dreamweaver command extensions. Place the contents of this folder in Dreamweaver's "Commands" directory. (Dreamweaver 8:Configuration:Commands)
- DocumentTypes - This contains a copy of the file MMDocumentTypes.xml, which has been modified to allow Dreamweaver to treat MXML files like XML files instead of plain text. Place this in Dreamweaver 8:Configuration:DocumentTypes. Note: if you have already modified your MMDocumentTypes file for another purpose, don't overwrite it - instead, manually edit line 150 like so: <documenttype id="XML" writebyteordermark="false" file="Default.xml" macfileextension="xml,xsd,rss,rdf,dtd,vtm,vtml,csn,config,mxi,mxml" winfileextension="xml,xsd,rss,rdf,dtd,vtm,vtml,csn,config,mxi,mxml" internaltype="XML">
- Helper - Contains an AppleScript application called FlexCompileHelper.app. This bridges the gap between Dreamweaver and the Flex compiler, as I'll explain later. You can put this file anywhere you like.
- mxmlc - Contains a copy of the mxmlc shell script from the Flex 2 SDK which has been modified to allow support for spaces in filenames. Place this in flex_sdk_2:bin. Feel free to name this file something else if you don't wish to overwrite the one in the SDK.
Configuration
After you have copied the files to their proper locations, launch Dreamweaver. In the "Commands" menu, you should now see two new commands: Flex Compile, and Flex Preferences. Flex Preferences allows you to specify the location of the Flex compiler, the FlexCompileHelper app, and the output path for your SWF file, as well as any command line options you wish to use.
As you can (hopefully) see from the screen-shot, I have left the SWF Output Directory field blank. Since it is blank, SWFs will be placed in the same directory as their corresponding MXML files. Also, I have typed "-incremental=true" in the Additional Compiler Options field, to enable incremental compiling. When you click the "Save" button, a file called "FlexCompilerPreferences.txt" is created in your Dreamweaver configuration folder. This file merely stores all the values you enter into the Flex Compiler Preferences dialog.
Before we continue on, it would be a good idea to set MXML files to open in Dreamweaver. To do so, select an mxml file (you can find one in flex_sdk_2:samples) and go to File > Get Info in the Finder. Find where it says "Open With", select "Other" from the drop-down menu, and then browse to your Dreamweaver installation. Once you have Dreamweaver selected, you can click the "Change All" button to make all MXML files open in Dreamweaver.
Now it's time to compile something. Just open an MXML file in Dreamweaver, and select Commands > Flex Compile. This does a number of things:
- The Flex Compile command reads the Flex Compiler Preferences and creates a file on your hard drive called "FlexCompileJob.txt" in the same directory as the Flex Compile Helper application. This file contains 4 items: the path to the mxmlc shell script in the Flex 2 SDK, the path to the MXML file being compiled, the output path for the SWF, and any additional command-line options. Then, it launches the Flex Compile Helper application.
- The Flex Compile Helper application reads FlexCompileJob.txt, creates a command-line for the job, and passes it to the mxmlc shell script.
- When the mxmlc script returns its output, the Flex Compile Helper writes that output to a text file (FlexCompileOutput.txt) and instructs Dreamweaver to open that file.
- Flex Compile Helper instructs the Standalone Flash Player (located in the Flex 2 SDK) to open the SWF, and makes that window topmost.
Error Checking
If the Flex Compile Preferences have not been set correctly, or an MXML file is not the active file in Dreamweaver, the Flex Compile command will not be available. Here is a list of the conditions under which Flex Compile will be grayed out:
- FlexCompilerPreferences.txt does not exist or is empty
- No compiler is specified, or the specified compiler does not exist
- No Flex Compile Helper app is specified, or the specified one does not exist
- No document is open
- The active document is not an MXML document
Further Explanation
This may seem like a lot of moving parts to achieve what should be a simple task. It was easier on Windows, thanks to the MM.createProcess command, which allowed me to call mxmlc directly from Dreamweaver and also catch its output. Unfortunately, this command does not work on the Mac. So, I had to create the AppleScript application which I could call with the more standard dreamweaver.openWithApp command. Since that command does not facilitate passing data to the application it's launching, I had to first write the necessary parameters into a text file which the application could then read.
I also spent a fair amount of time fighting with the mxmlc shell script, which choked on spaces in filenames. By default, it treats a space as an argument separator. If you open mxmlc in a text editor, and look at the last line, you will see this:
java $VMARGS -jar $FLEX_HOME/lib/mxmlc.jar $*To fix it, I changed it to this:
java $VMARGS -jar $FLEX_HOME/lib/mxmlc.jar "$@"For the exact reasons why, check out this page on bash scripting. I don't want to get into it right now, it kind of gives me a headache. With that line of code in there, you can escape any spaces in your filename by surrounding the filename in single quotes. FlexCompileHelper takes care of that for you, but if you put any file paths in the Additional Compiler Options field, you'll need to take that into account.
By the way, if you want to see what's in FlexCompileHelper.app, feel free to open it up. I have not protected the contents from being decompiled, so you should be able to see it in Script Editor.
Conclusion
Well, that's it for now. Can this be improved upon? You betcha. This meets my needs for now though, so I probably won't spend too much more time on it. If you have a suggestion on how to streamline this puppy, I'm all ears. I'm kind of intrigued by the fact that even Dreamweaver's code hinting is extensible. I may take on the challenge of adding code hinting to FlexWeaver, but if I do, it won't be for a while. Enjoy, and let me know if you have questions or comments.
27 Comments:
Hey Rick, sorry you're having trouble with it. I should be able to take a look at things this evening. Meanwhile, what version of OSX are you running? Are you on a Power PC or Intel-based Mac? Are you using any additional command-line arguments (in the "Additional Compiler Options" field)? If not, try '-incremental=true' and let me know if it works that way. This is probably an issue in my AppleScript. If so, I'll fix it as soon as I can.
How can I add an "mxml" document type in the DW preferences so I can color code my code? I assume I would just add something to a JS file somewhere in the Dreamweaver install (?).
Many thanks Tom, I used your plugin to build about 80% of this app: Flex Video Show & Snap app.
hello
my name is sandeep, i have one JSP page can i implement it in FLEX 2.0 , as i am very much interested to design the UI part in FLEX 2.0 , can i make it, the JSP page is a login page it contains username and password textfields and onclicking the submit button it has to validate the user and password is valid or not, and onclicking reset button it has to clear the textfields. can u give suggest how to implement this in FLEX 2.0 ,
thanks & regards
sandeep.mk@adobe.com
Sandeep,
From what you describe, the UI should be a trivial task in Flex. Here are some quick start guides to get you started:
http://www.adobe.com/devnet/flex/?tab:quickstart=1
Good luck!
Sorry, posted this on the Windows version.
Thanks for putting this together its a great! I have a problem though:
I tried using the MMDocumentTypes.xml but DeamWeaver pops up with a dialog saying the doc types "...will not be added because it uses a file extension that is already associated with a prior Document Type" (this is with alll of the doc types in this file I think). I even tried manually editing the file but its the same. It seems that even if you don't change anything within this file (Save as) it throws up the pop-ups.
Sorry, no - I started using Flex Builder instead. It seemed like a better use of my time. :)
Hello,
This is a very good article.
Search Engine Optimization
Artikel News
Hi Tom,
Have been working out for ages how to do this stuff without using FlexBuilder on my G5 Mac and all I can say is a HUGE thanks as it appears to work fine for me :)
Definitely going to be using Flex more now!
Mike London
紅酒,
Quality Wine,
Terrior Wine,
Riesling Wine
搬屋,
物流公司,
搬屋公司,
包裝公司,
搬屋服務
搬寫字樓,
Office Relocation,
搬屋公司,
運輸公司,
搬運服務
購物袋,
包裝袋,
不織布袋,
Non Woven Shopping Bag,
Recycle Bag,
Wine Bag
辦公室傢俬,
僱傭中心,
寫字樓傢俬,
辦公室屏風,
Office Furniture,
Storage Rack,
成立公司,
商業登記,
稅務顧問,
Accounting Service
Hi Tom, does this work on Dreamweaver CS3? I followed the directions but it didn't save a 'FlexCompilerPreferences.txt' file...please help!
環保袋,
Recycle Bag,
Recycle Shopping Bag
djfdjklj k
威龍 勃起不全,勃起薬,勃起,勃起 不全勃起機能低下,インポ,精力剤 ,カマグラ,Max,精力剤 ,マックス
吉原 ソープ今までの吉原にはまったくない、新しい吉原 ソープのお店です。お客様に提供するのは、究極の癒しとリラクゼーションです。今まで吉原 ソープに縁の無かったお客様のニーズにお応えします。
すすきの風俗情報満載!エッチ動画やエッチ画像見放題。 すすきののソープランド,ファッションヘルス, デリヘル,キャバクラ,札幌のデリバリーヘルスを3000人のフードルプロフで紹介
shanghai hotel
guangzhou hotel
shenzhen hotel
beijing hotel
china hotel
guangzhou hotel
shenzhen hotel
shanghai hotel
beijing hotel
回转支承
转盘轴承
slewing ring
slewing bearing
slewing bearings
slewing ring
slewing bearing
slewing bearings
男人加油 SEO地爱歪博客 研究生论文写作网 酷狗 QQ繁体字 瑞星 卡巴斯基 酷狗 申通快递 起点 lianliankan 新浪ut uc 网络测试服务 waga 酷我音乐盒 西妮子音乐博客毕业论文 qq繁体字 qq空间代码 qq炫舞 feixin 画皮在线观看 Cervical erosion
铜米机
碳雕
炭雕
活性炭
活性炭雕
空气净化产品
好想你枣
北京好想你枣
轴承
进口轴承
FAG轴承
NTN轴承
NSK轴承
SKF轴承
网站建设
网站推广
googel左侧优化
googel左侧推广
搜索引擎优化
仓壁振动器
给料机
分子蒸馏
短程蒸馏
薄膜蒸发器
导热油
真空泵油
胎毛笔
手足印
婴儿纪念品
婴幼儿纪念品
园林机械
草坪机
油锯
小型收割机
收割机
割灌机
割草机
电动喷雾器
地钻
采茶机
婚纱
北京婚纱
婚纱礼服
北京婚纱店
个性婚纱
礼服
北京礼服
礼服定制
礼服出租
飘人|飘人2008|云淡风清
铣刀
意大利留学
留学意大利
钢管舞
钢管舞培训
北京钢管舞
爵士舞
北京音皇国际
泳池设备
桑拿设备
印刷厂
油锯
割草机
绿篱机
风力灭火机
留学意大利
意大利留学
好日子小吃车
好日子烧烤小吃车
好日子多功能小吃车
好日子烧烤车
中频感应熔炼锻造设备
高频感应加热钎焊设备
保护膜
佛具
律师事务所
北京律师事务所
法律咨询
北京律师
北京法律咨询
小吃车
多功能小吃车
烧烤小吃车
烧烤车
拓展训练
水泥艺术围栏
水泥艺术围栏设备
水泥艺术围栏机械
水泥栅栏设备
艺术护栏
艺术栏杆
环保艺术围栏
环保围栏
环保围栏机械
环保围栏设备
彩色艺术围栏
花瓶柱
阳台柱
阳台护栏设备
阳台护栏
北京写字楼
写字楼出租
写字楼租赁
塑料轴承
陶瓷轴承
破碎镐
铣刨机
china tours
china travel
china tour packages
tibet tour
泳池设备
桑拿设备
珍珠棉
防伪标签
防伪商标
防伪印刷
防伪包装
防伪胶带
防伪公司
特殊防伪
特殊标签
防伪材料
防伪不干胶
防伪印刷材料
防伪封箱胶带
物流标签
保修标签
防伪胶带
防伪标
防伪标贴
防伪标识
防水标签
保修标签
たっきゅうびんたっきゅうびん家居速遞-速遞公司-速遞-家居速遞公司-
人妻人妻人妻人妻人妻人妻人妻
オナカップ
AV女優無料動画
風俗 大阪
人妻無料動画
兵庫 出会い
レズ動画
ローター
マニア系動画
レズビアングッズ
オナニーグッズ
風俗 大阪
ラブドール
パイパン動画
人妻動画
風俗 大阪
SMグッズ
人妻無料動画
JK無料動画
オナホール
AV女優無料動画
素人投稿
素人投稿
素人投稿
素人投稿
素人投稿
京都無料 出会い
ラブコスメ
大阪無料 出会い
オナニーグッズ
素人投稿
ラブドール
エロアニメ動画
台北套票package-台灣旅遊套票-台北機票-台北酒店-旅遊套票-預訂酒店-酒店預訂-香港酒店預訂-澳門套票package-澳門酒店-澳門酒店預訂-新捷旅遊-吉沢明歩-光月夜也-松島かえで-S1-Moodzy-SOD-光月夜-巨乳
「出会い系サイトcocoa brown」では出会いを探すのに最適の出会い系サイトをジャンル別でご案内。
「出会い系サイトDiscovery」では新しい出会いが見つかるオススメ最新出会い系サイトをご紹介!!
「出会い系サイトGraphite」では出会いが見つかると人気の出会い系サイトをご紹介!!
「出会い系サイトGIFT」ではあなたに素敵な出会いをプレゼントしてくれるオススメの出会い系サイトをご紹介します。
「出会い系サイトFantastic」ではジャンル別にオススメの出会い系サイトをご紹介していきます。
出会い系サイトpowder blue
「出会い系サイトpowder blue」はあなたの求める出会いが見つかる出会い系サイトを紹介していきます。
出会い系サイトRights
「出会い系サイトRights」ではちょっと時間があるときに軽く遊べるお手軽出会い系サイトをご紹介!!
出会い系サイトCaffe
出会い系サイトCaffeでは出会い探しに最適のオススメ出会い系サイトをご紹介していきます。
出会い系サイトNEWS PAPER
「出会い系サイトNEWS PAPER」では出会い系サイトの中でも最新の出会い系サイトを中心にご紹介していきます。
出会い系サイトGREEEN
「出会い系サイトGREEEN」では無料で楽しめるオススメの出会い系サイトをみんなで選ぶRanking形式でご紹介していきます。
無料出会い系サイト~あなたの出会いをジャンル別でプロデュース~
無料で出会いが探せる無料出会い系サイトを純愛・メル友・セフレ・人妻・・・etc様々なジャンル別でご紹介
出会い系サイトSunshine yellow
「出会い系サイトSunshine yellow」では素敵な出会いが見つかるオススメの出会い系サイトを皆さんにご紹介いたします。
出会い系サイトTravels
「出会い系サイトTravels」では出会いを見つけるのにピッタリ!!オススメの出会い系サイトをご紹介。
出会い系サイトS○XMANIA
「出会い系サイトS○XMANIA」ではセフレと出会えるSEXを楽しむための出会い系サイトをご紹介します。
出会い系サイトSplash
「出会い系サイトSplash」は出会い探しに最適のオススメ出会い系サイトを紹介するポータル出会い系サイトです。
出会い系サイトSugar
「出会い系サイトSugar」では甘くて切ない純愛系出会い系サイトだけを厳選してお届け!!
Post a Comment
<< Home