Archive for the ‘S.A.M.’ Category

Flex: Creating a custom context menu item for an application

Wednesday, February 13th, 2008

Here is a little piece of code I would like to share with all my fellow Flex Geeks out there. This code explains how to create a custom context menu item for an app. If you have any questions, please feel free to ask. There are other similar flex resources at http://blog.flexexamples.com.

<?xml version=”1.0″ encoding=”utf-8″?>
<!– http://blog.mygeeklife.net/creating-a-custom-context-menu-for-an-application/ –>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”
layout=”absolute”
creationComplete=”contextMenuItems();”
backgroundGradientColors=”[#ffffff, #a9b4d8]”>

<mx:Script>
<![CDATA[

// Declare a bindable private variable

[Bindable]
private var cm:ContextMenu;

// This function initializes a new Context Menu

private function contextMenuItems():void {

// Declare ContextMenuItem variable

var myGeekLifeLink:ContextMenuItem = new ContextMenuItem(”MyGeekLife”);

// Add event listener which calls the myGeekLifeLink_menuItemSelect function declared below

myGeekLifeLink.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, myGeekLifeLink_menuItemSelect);

// Create new context menu

cm = new ContextMenu();

// Hide default context menu items

cm.hideBuiltInItems();

// Add link

cm.customItems.push(myGeekLifeLink);

// Apply context menu to application

application.contextMenu = cm;
}

// Navigates to new url when link is clicked

private function myGeekLifeLink_menuItemSelect(evt:ContextMenuEvent):void {
navigateToURL(new URLRequest(’http://www.mygeeklife.net/’));
}

]]>
</mx:Script>

<mx:VBox width=”100%” height=”100%” horizontalAlign=”center” verticalAlign=”middle”>
<mx:Panel width=”250″ height=”200″ title=”Example App”>
<mx:Text text=”Right click anywhere on the application to initialize the Context Menu. Click on MyGeekLife to be taken to the URL. ” width=”229″ height=”160″ fontFamily=”Arial” fontSize=”17″ color=”#000000″/>
</mx:Panel>
</mx:VBox>

</mx:Application>

Sphere: Related Content

What does your site look like?

Sunday, February 3rd, 2008

Have you ever wondered what your site looks like in another browser? With so many different browsers (IE 6, 7, FireFox, Safari, Opera) knowing what your site looks like can be difficult. When you combine these browsers with different operating systems (OS) such as Windows, Mac, and the 500 different versions of Linux it is almost impossible to gage the presentation of your site.

Well there maybe a solution, introducing Browsershots!!! This is a great service, which is free btw, that allows web designers to see what their pages look like on different browsers.

What is Browsershots?

Browsershots makes screenshots of your web design in different browsers. It is a free open-source on-line service created by Johann C. Rocholl. When you submit your web address, it will be added to the job queue. A number of distributed computers will open your website in their browser. Then they will make screenshots and upload them to the central server here.

*text and image taken from browsershots.org.

Browsershots lets you select the type of OS (Linux, Microsoft, or Mac) and the type of browser you are testing for, then you can come back and view how your site looks. There is no limit to the number of browsers or OSes you can test at once. If you want to know what your site looks like, Browsershots is a great place to start.

You Rock,

S.A.M.

Sphere: Related Content