Add support for image embedding for third party components
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/93be453d Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/93be453d Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/93be453d Branch: refs/heads/apache-tour-de-flex-1.2 Commit: 93be453d58d289649f894f529730b3951a248a10 Parents: 58d0ea6 Author: OmPrakash Muppirala <bigosma...@gmail.com> Authored: Fri Nov 7 16:39:04 2014 -0800 Committer: OmPrakash Muppirala <bigosma...@gmail.com> Committed: Fri Nov 7 16:39:04 2014 -0800 ---------------------------------------------------------------------- TourDeFlex/TourDeFlex3/src/3rdparty.xml | 2 +- TourDeFlex/TourDeFlex3/src/explorer.mxml | 9 +++++++-- TourDeFlex/TourDeFlex3/src/loaderPanel.mxml | 24 ++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/93be453d/TourDeFlex/TourDeFlex3/src/3rdparty.xml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/src/3rdparty.xml b/TourDeFlex/TourDeFlex3/src/3rdparty.xml index 1224d16..97b6b48 100755 --- a/TourDeFlex/TourDeFlex3/src/3rdparty.xml +++ b/TourDeFlex/TourDeFlex3/src/3rdparty.xml @@ -19,7 +19,7 @@ <compTree> <node label="3rd Party Components"> <node label="Ardisia"> - <node thirdParty="true" label="Ardisia Component Library" app="http://www.ardisialabs.com/swfs/TourDeFlex.swf" src="" /> + <node thirdParty="true" label="Ardisia Component Library" app="http://www.ardisialabs.com/tourDeFlex/tour-de-flex.jpg" src="" link="http://www.ardisialabs.com/tour-de-flex" /> </node> <node label="Flexicious"> <node thirdParty="true" label="Dashboard Framework" app="http://www.flexicious.com/resources/demo/FlexiciousClassic.swf" src="" /> http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/93be453d/TourDeFlex/TourDeFlex3/src/explorer.mxml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/src/explorer.mxml b/TourDeFlex/TourDeFlex3/src/explorer.mxml index 9cdeb2f..03808a6 100755 --- a/TourDeFlex/TourDeFlex3/src/explorer.mxml +++ b/TourDeFlex/TourDeFlex3/src/explorer.mxml @@ -80,12 +80,13 @@ private function treeChanged(event:Event):void { var nodeApp:String = compLibTree.selectedItem.@app; + var link:String = compLibTree.selectedItem.@link; var thirdParty:Boolean = compLibTree.selectedItem.hasOwnProperty("@thirdParty") && compLibTree.selectedItem.@thirdParty == "true"; if (nodeApp != null && nodeApp != "") { - loadApp(nodeApp, compLibTree.selectedItem.@src, thirdParty); + loadApp(nodeApp, compLibTree.selectedItem.@src, thirdParty, link); } else { @@ -93,11 +94,15 @@ } } - private function loadApp(application:String, source:String, thirdParty:Boolean):void + private function loadApp(application:String, source:String, thirdParty:Boolean, link:String=""):void { if (application.indexOf(".swf") > 0) { swfLoader.loadApp(application); } + else if(application.indexOf(".jpg") > 0 || application.indexOf(".png") > 0) + { + swfLoader.loadApp(application,link); + } else { swfLoader.loadApp(application + ".swf"); } http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/93be453d/TourDeFlex/TourDeFlex3/src/loaderPanel.mxml ---------------------------------------------------------------------- diff --git a/TourDeFlex/TourDeFlex3/src/loaderPanel.mxml b/TourDeFlex/TourDeFlex3/src/loaderPanel.mxml index bd09faf..02209c9 100755 --- a/TourDeFlex/TourDeFlex3/src/loaderPanel.mxml +++ b/TourDeFlex/TourDeFlex3/src/loaderPanel.mxml @@ -21,11 +21,31 @@ width="100%" height="100%"> <fx:Script> <![CDATA[ - - public function loadApp(swfApp:String):void + import flash.net.navigateToURL; + private var _link:String; + //For third party components, we are loading an image. Clicking on the image + //would take the user to the demo app on the third party website + public function loadApp(swfApp:String, link:String=""):void { myLoader.source = swfApp; + if(link != "") + { + _link = link; + myLoader.addEventListener(MouseEvent.CLICK, handleClick); + myLoader.buttonMode = myLoader.useHandCursor = true; + } + else + { + myLoader.removeEventListener(MouseEvent.CLICK, handleClick); + myLoader.buttonMode = myLoader.useHandCursor = false; + } + } + + private function handleClick(event:MouseEvent):void + { + navigateToURL(new URLRequest(_link),"_blank"); + } ]]> </fx:Script>