Ryan Gorer

The life and times creating engaging media experiences.

Milton Friedman and Doubtful Authenticity

Since registering a domain name with the goal of making a profit, I've been wondering if my investment will pay off, and it reminded me of a funny anecdote I once read about Milton Friedman regarding doubtful authenticity:

    One Saturday afternoon in downtown Chicago, Milton Friedman, the famous free-market economist, was shopping with his wife.

    "Look Milton!" exclaimed Mrs. Friedman. "There's a $20 bill on the sidewalk!"

    "Don't be foolish, my dear," replied the Nobel laureate. "If that was a $20 bill, someone would have picked it up by now."

Source:
Contemporary Strategy Analysis
by Robert M. Grant - page 223

If there is money to be made on AdvocateBlog.com, wouldn't the experts in the business already have registered that domain name? We'll see what happens.

My Friend Lauren's New Website and New Book

My friend Lauren Kerstein is an expert in the field of working with children diagnosed with Autism Spectrum Disorders. She recently told me about an idea she had to create a website dedicated to featuring books on Autism.

Based upon her deep experience with the subject matter, Lauren put together a categorized list of useful books on Autism. I was glad to help her out from a technical perspective, and last week we launched the Autism Asperger Books website.

Lauren also just became an author at Autism Asperger Publishing Company, as her first book called My Sensory Book is pending publication. She describes the book as follows:

My Sensory Book is a workbook designed to assist children with understanding their sensory systems better and the impact sensory input may have on their emotions. This text is set up for adults to use with children and older children to use on their own. It may be helpful for use at home, in school and in the community.

It is insipring to see how people like Lauren can make such a difference and help other people in their line of work.

eBay Pricing Changes Are Bad for Sellers Like Me

As someone who sells items on eBay periodically, I found it surprising that eBay has announced a new fee structure that gives sellers like me less of an incentive to sell items through their site.

The new fee schedule (basic fees and feature fees) will take effect on Feb 20, 2008 that reduces insertion fees, increases final value fees and does not refund reserve fees. According to an announcement from Bill Cobb, President of eBay North America, their goal in making these changes was to "improve the overall experience for our customers."

However, the new fee structure will have the opposite effect on me. Here is a comparison of fees before and after the change for a typical auction that I would run on their site with a starting price of $0.99, a reserve price of $24.99, and a final value price of $75.00.

Fee before the change: $3.89 ($0.60 insertion fee, plus $0.35 gallery picture fee, plus $2.94 final value fee, plus $0.00 reserve fee [$1.00 reserve fee refunded if item sells])

Fee after the change: $5.49 ($0.55 insertion fee, plus $0.00 gallery picture fee, plus $3.94 final value fee, plus $1.00 reserve fee [reserve fee not refunded if item sells])

There would be a $1.60 increase in cost for a typical item that I would sell on eBay. If the item doesn't sell, my fee would be $1.95 before the change vs. $1.55 after the change, which is a $0.40 decrease in cost compared with the old fee structure.

But, my goal is to sell the item, not to have it listed and then expire unsold meanwhile paying eBay just for the privilege. Because my items sell virtually every time, I don't feel that the risk of having an unsold item needs to be mitigated. The benefit of a $0.40 savings for having an unsold item does not offset a $1.60 increase in cost to sell the item.

Needless to say, this new fee structure doesn't quite satisfy their goal of improving my overall experience and encouraging me to list more items on eBay.

AdvocateBlog.com Domain Name For Sale

Inspired by a blog posting by Erik Heels about registering generic domain names with the goal of profiting from their future sale, I just registered AdvocateBlog.com.

Erik is conducting an experiment by taking a methodical approach toward making an investment in a portfolio of domain names. He took 183 frequently-used short generic words and then coupled them all with a "blog.com" suffix. He purchased these domain names in August 2007 and noted that there are already some interesting results after five months of ownership.

These days the value of domain names is widely understood, and it seems that virtually any potentially valuable name already has been registered. But I figured AdvocateBlog.com could be worth something to someone in the future because if you are an advocate for something, you would want to write about it, and where better to do that than on a blog.

So, I've now dipped my toe into the business of domaining by initiating my annual $10 investment in AdvocateBlog.com. It was somewhat surprising to me that this domain was available, as there are so many things to be an advocate about. But therein may lie its weakness; maybe it's too generic of a name. If someone wanted to start a blog advocating ethanol subsidies, wouldn't he or she just register EthanolSubsidyAdvocate.com? Time will tell.

Yahoo! Maps No Longer Uses Flash

In an earlier post about setting URL hash values from Flash, I referenced Yahoo! Maps as a prime example of employing this technique in Flash applications. However, much to the chagrin of Adobe, Yahoo! Maps no longer uses Flash technology to power its maps application and instead has chosen to use AJAX. Their maps application still updates the URL hash values, and my earlier post still holds water; it's just that Yahoo! Maps is no longer an example that can be referenced.

Announcing the Launch of Vinereader

Vinereader is an innovative newsreader application that creatively displays today's latest news in any subject. I built the application using the Adobe Flex development framework, and it served as a useful focus of mine as I was learning the technology over the past several months.

Given its robustness and seamless cross-platform capabilities, Flex has proven to be well suited for developing a rich internet application such as Vinereader, especially considering the dynamic and data-driven nature of the user interface.

The data presented in Vinereader is obtained from Newsvine, which is an exciting source of news with a mixture of community-driven content and news wire stories. Newsvine makes its structured news data available through RSS feeds available to the public, and Vinereader consumes this data strictly in a non-commercial manner.

As of today, Vinereader is available for anyone to use by clicking this Vinereader link. I hope you find it as enjoyable as I do to see the interesting stories that appear on the screen throughout the day.

Setting a Center Point for Rotating an Object in Flex

When you want to rotate an object in Flex, it seems like it would be simple enough to use the "rotation" property of the DisplayObject class to set the number of degrees to rotate the object.

However, when you adjust this value, it assumes that the center point of the rotation is x=0 and y=0, and I have not been able to find a way to specify a different center point (also called a registration point) about which to perform the rotation.

Although there may be a better solution out there, the workaround I have employed involves using the Rotate class. The Rotate class in the "mx.effects" package allows you to create a motion tween for rotating an object over a specified time duration.

The benefit of the Rotate class is that it allows you to specify a center point for the rotation by setting the "originX" and "originY" values. All you have to do is set the duration of the effect to 1 millisecond before invoking the tween, and when played, the object instantaneously rotates about any center point you desire.

Setting a URL Hash Value from Flash

When building certain Flash applications, it is beneficial to update the URL in the address bar to indicate the area of the application that the user is currently viewing. That way, if the user bookmarks the URL and/or sends the URL in an email, the return visit will result in the Flash application displaying the appropriate information.

The technique employed to accomplish this functionality involves the portion of the URL after the "#" character, which is called the "hash" portion of the URL. Hash values are often used on web pages that do not involve Flash. For instance, some web pages which present a list of FAQ items use standard HTML anchor links that update the hash value (i.e. <a href="#faq16">), resulting in the user being shown the item of interest without having to wait for the entire web page to reload.

Therein lies the beauty of using hash values to keep track of where the user is navigating in a Flash application: Updating the hash portion of the URL does not trigger a page reload. Therefore, it is a good idea to leverage this opportunity to update hash values and provide a better user experience on return visits to the application.

When a user returns to the web page with a hash value stored in the URL, a JavaScript function is used to parse the values out of the hash and then pass those values into the Flash application upon load using FlashVars. Depending upon the values passed to it, the Flash application can then behave accordingly.

A great example of a Flash application that updates (and reads) hash values is Yahoo! Maps. Notice what happens after each time you use your mouse to drag the map around: The URL hash values are updated with the latest latitude and longitude so that if you were to send this URL to a friend, your friend would see just what you see. For example, I copied the URL for Cambridge, MA and am showing it to you here. (Update: Yahoo! Maps no longer uses Flash)

The hash portion of a URL can be updated dynamically by using JavaScript to set "window.location.hash" to a particular value. Without worrying about Flash for a moment, it is fairly straightforward to create a simple JavaScript function to update the page hash on a web page (as is shown in the example below).

Normally, calling a JavaScript function from Flash acts the same way as it would if you were to call the JavaScript function from a button on the web page itself, for instance. However, there is a bug in Internet Explorer 6 which causes it to mishandle the setting of the page hash when the JavaScript function is being called from Flash. Firefox and Safari process this function from Flash just fine; go figure.

In order to get this function to work in IE6, you have to embed the Flash application into an IFrame. Then, the Flash application calls a JavaScript function which sets the value of "parent.location.hash" instead of "window.location.hash". Thankfully, this technique also works in Firefox and Safari, so getting this functionality to work in all browsers can be accomplished using a single approach.

The example below illustrates the technique of setting the hash value from Flash. The Flash application is embedded into the page using an IFrame. The button on the Flash application (using the ActionScript code shown) calls the "sethash" JavaScript function, which sets the parent's hash value to the current time (the number of milliseconds since midnight on January 1, 1970). Notice how the number in the page URL changes after each button click.

A detailed comparison example is also available at this link to illustrate how Internet Explorer 6 handles Flash calling this function in different circumstances. In Exhibit A, Flash is embedded directly in the page, and clicking the button fails to set the page hash after the first button click in IE. Exhibit B illustrates the technique described in this posting, and the hash is set successfully regardless of browser type.

Specifying the Absolute Position of a DIV Relative to a Centered DIV

There is a particular technique for specifying the absolute position of one <div> relative to another centered <div> instead of relative to the web page as a whole. The technique described below works with Internet Explorer, Firefox and Safari.

In the example shown below, there was the desire to have the "div-centered" <div> centered on the page and have the "div-absolute" <div> positioned 175 pixels from the left border of the "div-centered" <div>, regardless of the user's browser window size. The code used to accomplish this requirement is available at this link.


Difference Between "target" and "currentTarget"

When adding an event listener to an object in your ActionScript 3.0 code, it is helpful to understand the difference between the "target" and "currentTarget" objects that can be referenced in the listener function that gets called after the event fires. The object obtained by referencing "target" is the object that dispatched the event. The object obtained by referencing "currentTarget" is the object that is listening for the event. With event bubbling, there can be a difference between the object that dispatched the event and the object that was listening for the event.

Learning ActionScript 3.0

There are several useful resources available from Adobe as you learn ActionScript 3.0. The ActionScript 2.0 Migration guide is particularly helpful for learning the equivalent commands in ActionScript 3.0. The Adobe Development Center also has articles on an ActionScript 3.0 Overview as well as a Tips & Tricks article.

Furthermore, the step-by-step instructions and examples presented in the ActionScript 3.0 Essentials Training video on Lynda.com (subscription required) were instrumental in my coming up to speed with ActionScript 3.0.

Streamline Code Using The Conditional Operator

Instead of writing 5 lines of ActionScript code for a simple if..else block, you can achieve the same logic in 1 line of code using the "?:" conditional operator.

For example, the following piece of code...

     if (x < 5) {
          y = 1;
     } else {
          y = 2;
     }

... can be written in one line as follows...

     y = (x < 5) ? 1 : 2;

More information about the conditionanl operator can be found in the official Adobe documentation.

SWF to SWF Communication Issue Using LocalConnection Class

There is a rather straightforward way to have two SWFs on a single web page communicate with one another, as described in this Adobe TechNote. However, there is a limitation with this simple approach: the communication does not work properly when there are multiple browser windows open at the same time. The problem even occurs when there is one Internet Explorer window open and one Firefox window open. You can easily see this issue by opening the Adobe TechNote in multiple browser windows; the demo application will work on only one of the browser windows.

The reason for the problem involves the name for the connection that is specified in both SWFs when the LocalConnection class is instantiated in the code. Apparently, this connection name is not unique to a browser session, but is unique to the user's machine. Therefore, with multiple browser windows open at the same time, they all try to communicate within the first browser window that was opened.

The solution is to devise a way to define a unique connection name for each browser window that is opened. The same unique connection name must be declared in both SWFs in the same browser window. The approach I took to solve this problem is to generate a random number in JavaScript and then pass that number into both of the SWFs on the page through a querystring variable when providing the URL of each SWF.

For instance, the random string can be defined in JavaScript as follows:

     var ranString = Math.random().toString();
     ranString = ranString.substr(ranString.length - 10, 10);

... and, the random string can be passed into the SWF as follows (assuming that the SWF is being presented using SWFObject):

     var swfurl = 'movie.swf?rs=' + ranString;
     var so = new SWFObject(swfurl, 'swfname', 100, 100, '7', '#ffffff');
     so.write('divname');

Then, whenever you reference the name of the connection in ActionScript, you append the random string that was passed into the SWF, for example:

     incoming_lc.connect("lc_example" + _root.rs);

Now, whenever a browser page loads, the two SWFs on the page reference the same connection name, and this name is unique to that particular browser window. Multiple browser windows can be open with the same page loaded, and the SWF to SWF communication will work as desired.

Online Flash Users Group - Flex Training

There is a Flash Users Group that conducts all of its meetings online once per month. The meetings are recorded so that you can watch the presentation later. The group has not actually met as frequently as monthly, but the following recorded meetings provided some high-level introductions to Flex:

  • Flex Data Binding and Events - This presentation illustrated methods for binding data between components using the BindingUtils class and the bindProperty method.
  • Flex Containers and Event Bubbling - Part 1 discussed the basics of containers and the presentation aspects of them. Part 2 illustrated the difference between the capture, target and bubble phases of events.
  • Object Oriented Programming in Flex - This presentation illustrates the construction of a custom list box control using custom components, custom events and click handlers.
  • Simple Singletons in Flex - Singletons are classes that have only one instance in the entire application. The Singleton class illustrated in the presentation extended the UIComponent class so that events could be dispatched from the Singleton.
Flex Quick Starts: More Handling Data

Since my original post on the subject, there are 2 additional tutorials for handling data in the Flex Quick Starts area of the Adobe Flex Development Center.

  • Accessing XML data: ActionScript 3.0 used in Flex 2 leverages the ECMAScript for XML (E4X) specification to make available improved functionality for working with XML data. Because XML is a native data type in Flex, you write XML and assigning it to a variable. The tutorial explains how to access data values and assign data values with XML by using dot notation. Another example illustrates how to assemble and transform XML objects using the prependChild, appendChild, insertChildBefore, and insertChildAfter methods. (There was also a note about a known issue in Flex: when deleting an item from the data provider of a list control, the selectedIndex value is set to an incorrect value.) Another example illustrated various ways to query XML data right within ActionScript.
  • Loading external data with HTTPService: This tutorial provides an example of using the HTTPService to obtain external data via HTTP calls. Data can be obtained from other domains, but they have to employ the proper use of a crossdomain.xml file. In this particular example, the resultFormat was set to "e4x", and the namespace was set to the atom namespace.
More Entries:
» ASP.NET Scheduled Processing
» Flex Skinning Napkin Example
» Flex Quick Starts: Working With Tree Controls
» My Friend Kevin The Artist
» Step-by-Step Flex Training
» ActionScript and MXML Code Samples
» Delivering More Responsive Flex Applications
» Flex Quick Starts: Handling Data
» Flex Quick Starts: Building Custom Components
» Flex Quick Starts: Building an Advanced User Interface
» MXML Tags and ActionScript Classes
» Pros/Cons of Number vs. int vs. uint
» Flex Quick Starts: Building a Simple User Interface
» Flex Quick Starts: Getting Started
» Resource Management in ActionScript 3
» Hillman Curtis Films
» ActionScript 3 Coding Environment Options
» Samorost2 Flash Game
» Flash Marketplace at Wallop
» PostSecret - Real. Human. Emotion.
» "Cinema Rules" Flash Spot
» Object Oriented Programming Overivew
» Building Flex Apps With Flex Builder
» Using _root (or not)
» Introduction to Developing with Flex
» Flex Builder 101
» The First Entry