Quick Tip: Set a ComboBox’s dropdown height with rowCount

I looked and looked for a way to change the height of the dropdown list in a ComboBox in AS3. It can be done by setting the rowCount property on the ComboBox.

rowCount defaults to 5, so if you need to make a ComboBox’s list smaller, it’s actually quite easy:

myComboBox.rowCount = 4

That makes sense, but it’s not immediately obvious. I thought I’d put that up here in case anybody else runs into the same thing.

, , , , ,

Leave a comment

Quick Tip: How to right-align the dropdown List in a ComboBox Component

If you’ve got a ComboBox off to the right of the stage, and the dropdownWidth is longer than the ComboBox itself, you may run into issues where the items in the ComboBox hang off of the stage.

For example, here’s a screenshot of a ComboBox on the right with its items cut off:

Bad alignment…. notice how the items are gone

Ideally, what you’d want is for the scrollbar to align directly under the right edge of the ComboBox, and the items to extend out horizontally as necessary:

To solve this, there’s a quick modification you can do to the ComboBox through inheritance:

package com.nerdabilly
{
	import fl.controls.ComboBox;
	import flash.geom.Point;

	public class RightCombo extends ComboBox
	{

		public function RightCombo()
		{
			// constructor code
		}
		override protected function positionList():void
		{
			super.positionList();
			
			list.x = parent.localToGlobal(new Point(this.x,this.y)).x + width - list.width 
			if(list.verticalScrollBar.visible){
				list.x -= list.verticalScrollBar.width;
			}
		}
	}

}

Once this is done, simply edit the Linkage for the ComboBox (in its Properties panel) so it points to com.nerdabilly.RightCombo instead of fl.controls.ComboBox.

Leave a comment

Determining whether a SWF is running in the IDE or a browser

Here’s something that’s been around for a while that I didn’t learn about until just recently.

The flash.system.capabilities.playerType property can be used to tell whether you’re running in the browser, a standalone player, or the Flash IDE. It returns the following values (from Adobe’s documentation):

  • “ActiveX” for the Flash Player ActiveX control used by Microsoft Internet Explorer
  • “Desktop” for the Adobe AIR runtime (except for SWF content loaded by an HTML page, which has Capabilities.playerType set to “PlugIn”)
  • “External” for the external Flash Player or in test mode
  • “PlugIn” for the Flash Player browser plug-in (and for SWF content loaded by an HTML page in an AIR application)
  • “StandAlone” for the stand-alone Flash Player

Simply check for (flash.system.capabilities.playerType == "ActiveX" || flash.system.capabilities.playerType == "PlugIn") and you’ll know you’re in a browser.

, , ,

Leave a comment

Nerdrodamus was wrong.

Back in January of last year, I made a post called “Nerdrodamus Predicts” where I predicted the iPad would go the way of the Lisa.

Turns out that both the real Nostradamus and I were roughly equal in our knowledge of the iPad.

I’ve noticed an uptick in traffic to that post, which means that someone somewhere is probably calling me an idiot on the Internet.

To which I say: good point, anonymous troll!

I’ve had an iPad since July of last year, and though I don’t get as much use out of it as I’d expected to, the tablet market took off in a way that few people expected, with the iPad at the helm. In other words, my prediction was dead wrong.

Up next: I predict the spectacular success of the Zune.

Leave a comment

St. Paddy’s Day quick update.

Another new year, another blog outage and subsequent rebirth.

Here’s a couple of quick things:

  1. Looks like I wasn’t the only one after all. Last year, most of my traffic was driven by queries like “I hate bigresource” and “bigresource blocker.” Last month Google announced, in much more diplomatic terms, that they’d listened to the complaints. Thanks, Google. You shall continue to be my search engine of choice.
  2. I’ve switched jobs twice since my last update. I’m still a Flash developer but hoping to get into more mobile and HTML5 development. More on that as it pans out.
  3. I’m working on my first Chrome extension. I’ve found the process to be fun, challenging, and rewarding. As I move forward with it hopefully I will post my ideas, thoughts, and tips.

Now go enjoy a Shamrock Shake while you still can.

Leave a comment

How to Stop Those Pesky BigResource Search Results

UPDATE #2 – April 6, 2011

This has been my most-popular blog entry ever.

There’s now the personal blocklist extension for Chrome and the Optimize Google add-on for Firefox that will much more effectively filter out these results.

Also, Google recently announced changes to its algorithm that will hopefully weed this out once and for all.

If, like me, you’re a developer, and if, like me, you often use Google to search for the solutions to questions, then, like me, you’ve probably encountered BigResource.com, and, like me, you absolutely hate the hell out of it.

Last week, in a fit of Big-Resource-induced rage, I went on a mad Googling spree, where I learned that I’m not the only one, and I joined the discussion over at Mike Cann’s blog.

The web is full of clever people, and I figured there must be a way around this. As it turns out, I wasn’t the first to try. There’s a couple of GreaseMonkey scripts out there, but I didn’t have much luck getting them working.

Then, I found this over at Greg Hughes’ blog. Not surprisingly, BigResource is mentioned in the comments as an ideal reason for excluding certain sites from search results.

So, I went ahead and created my own BigResource-blocking Google search, which I’m sharing with you here:

http://www.google.com/cse/home?cx=006044931824241811225:nmaxq9bcu9o&hl=en

Feel free to use it, or create your own according to the instructions linked above.

One More Thing

Personally, I almost never search by first loading up Google’s home page and then entering search terms. I prefer to use the Search box in the top-right corner of the browser window. So, using these instructions from WikiHow, you can make Firefox’s search bar get rid of BigResource too.

Update

I had another idea, and it takes some more effort, but I don’t mind doing it. When you see a search result from BigResource, simply highlight the title, then copy and paste it into a new search. Generally the REAL page (not the BigResource aggregated page-view-stealing page) will be pretty high up in the results. Perhaps someone more competent than me could make a greasemonkey script or Firefox add-on that does this automatically.

I’ve often sought help on sites like ActionScript.org, kirupa.com, StackOverflow, and FlashKit. These sites have helped me out immensely over the years, and never asked for anything in return. Therefore I feel a certain loyalty to them, and can’t help but take it a bit personally when I see other people hijacking their content and co-opting it to show me ads for crap I have zero interest in.

Let’s put the traffic back where it belongs: On the sites that actually answer the questions.

, , , ,

2 Comments

Gmail is now my high-school English teacher

I was writing an email and when it came to click Send, I was greeted with this watch-what-you-say admonishment. I never intended to attach a file.

Leave a comment

  • Least-Old Tweets

    Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Follow

Get every new post delivered to your Inbox.