Entries for month: May 2008
Flex: Popup a Window with Javascript
Posted by David in Flex on May 20, 2008
I had the need to popup a browser window from my Flex application and wanted it to popup without toolbars, etc. I found some online examples that did it in different ways. Below is the solution I went with.
FlexPopup.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
public function goToURLPopup(url:String,winName:String,w:int,h:int,toolbar:int,location:int,directories:int,status:int,menubar:int,scrollbars:int,resizable:int):void
{
var fullURL:String = "javascript:var myWin; if(!myWin || myWin.closed){myWin = window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h + ",toolbar=" + toolbar + ",location=" + location + ",directories=" + directories + ",status=" + status + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",top='+((screen.height/2)-(" + h/2 + "))+',left='+((screen.width/2)-(" + w/2 + "))+'" + "')}else{myWin.focus();};void(0);";
var u:URLRequest = new URLRequest(fullURL);
navigateToURL(u,"_self");
}
]]>
</mx:Script>
<mx:Panel width="100%" height="100%" title="Flex Popup Example" paddingLeft="10" paddingTop="10">
<mx:Button label="Google" click="goToURLPopup('http://www.google.com/', 'popup', 640, 480, 0, 0, 0, 0, 0, 1, 1)"/>
</mx:Panel>
</mx:Application>
And here is my example:
Flash Player 10 Beta (Astro) on Labs
Posted by David in Flash on May 16, 2008
Adobe has released Flash Player 10 (Astro) on the Adobe Labs site. Go check it out!
http://labs.adobe.com/wiki/index.php/Astro
For more information, see the Flash Player 10 technology page at
http://labs.adobe.com/technologies/flashplayer10/
And here is a link on how to compile for Flash Player 10 in Flex 3
http://opensource.adobe.com/wiki/display/flexsdk/Targeting+Flash+Player+10+Beta+with+Flex+SDK+3.0.x
You can download the Flash Player 10 beta from here
Adobe Developer Week Recordings
Posted by David in Adobe on May 7, 2008
Flex: Adding Your Own Context Menu Items
Posted by David in Flex on May 1, 2008
Well I've been working with Flex alot more so I will hopefully be posting more things on Flex. Something I have been working on lately is adding Context Menu items to my applications. You can add as many as you'd like but I would limit them to only the essential ones. I searched online and found various examples. Here is how I did it:
FlexContextMenu.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
<mx:Script>
<![CDATA[
[Bindable] public var cm:ContextMenu;
private function init():void
{
// Create custom context menu items
var cm1:ContextMenuItem = new ContextMenuItem("Copyright © 2008 DCFusion.com");
cm1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,cm1_link);
cm = new ContextMenu();
cm.hideBuiltInItems();
cm.customItems = [cm1];
application.contextMenu = cm;
}
private function cm1_link(evt:ContextMenuEvent):void
{
goToURL("http://www.dcfusion.com/blog/");
}
public function goToURL(urlStr:String):void
{
var webPageURL:URLRequest = new URLRequest(urlStr);
navigateToURL(webPageURL, '_blank');
}
]]>
</mx:Script>
<mx:Panel width="100%" height="100%" title="Flex Context Menu Example">
<mx:Label text="Welcome to my Flex app!"/>
</mx:Panel>
</mx:Application>
I added a link to my new context menu item using an event listener, but that is not necessary.
And the final product (right-click on the Flex app to see the context menu):
Recent Comments