Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


Skinning the V2 ProgressBar Component, Part 2
Skinning SimpleButton instead of Button

In Part One of this two-part article ("Skinning the V2 ProgressBar component " MXDJ vol 3 issue 4) we did what we set out to do, but I just can't bear to leave the skinning-a-Button issue unresolved.

The warning at the beginning of last month's article pointed out that the Button component is surprisingly difficult to skin because its skin is made up of code, not graphics. As a last exercise, then, let's take a quick look at an alternative approach: skinning SimpleButton instead of Button.

The SimpleButton class is the superclass of Button, and is accordingly less complex. Specifically, SimpleButton instances cannot be resized and do not have text labels - which makes them easy to skin. Follow these steps to skin a SimpleButton instance:

  1. Create a new Flash document (.fla file).
  2. Drag a Button instance to the stage and then delete it. This adds the Button component to the document Library.
  3. Create four movie clips, named up, over, down, and icon, with Linkage Identifiers set to "up", "over", "down", and "icon", respectively.
  4. In the up movie clip, create a graphic that represents the button in an idle state.
  5. In the over movie clip, create a graphic that represents the button when the mouse pointer is above it.
  6. In the down movie clip, create a graphic that represents the button when it is pressed.
  7. In the icon movie clip, create a graphic that will appear in the middle of the button in all states.
  8. Select Frame 1, Layer 1.
  9. Add the following code to the Actions panel:

    import mx.controls.*;

    var initObj = {falseUpSkin:"up",
    falseDownSkin:"down",
    falseOverSkin:"over"};

    initObj.falseUpIcon = "icon";
    initObj.falseDownIcon = "icon";
    initObj.falseOverIcon = "icon";
    initObj.trueUpIcon = "icon";
    initObj.trueDownIcon = "icon";
    initObj.trueOverIcon = "icon";

    // Cast the object returned by createClassObject() to SimpleButton.
    var sButton:SimpleButton = SimpleButton(
    this.createClassObject(SimpleButton,
    "sButtonInstance",
    0,
    initObj));
    sButton.move(250, 200);
  10. To export the movie, choose Control > Test Movie.
In the preceding steps, we created the SimpleButton instance with code (via createClassObject()) because there is no SimpleButton visual component included in the Flash MX 2004 Components panel. It is theoretically possible to subclass SimpleButton and use the subclass to create a component that could be added to the Components panel, but doing so is outside the scope of this article. For information on creating components, see "Further Study," below.

The SimpleButton class is not the only alternative to the Button component. The CustomButton class can also be skinned with graphical movie clips. CustomButton offers the additional features of resizability and a text label. Note, however, that a CustomButton instance can be resized along one axis only - either horizontally or vertically. Accordingly, the CustomButton skin is structured much like the ProgressBar skin; it has two end caps for the edges of the button and a middle section that is stretched between the caps. You can use the SimpleButton skinning technique described above to skin a CustomButton instance. Of course, you'll have to use the CustomButton skin properties instead of the SimpleButton skin properties. For reference, here is a list of CustomButton's skin properties:

  • falseUpSkinL
  • falseUpSkinM
  • falseUpSkinR
  • falseDownSkinL
  • falseDownSkinM
  • falseDownSkinR
  • falseOverSkinL
  • falseOverSkinM
  • falseOverSkinR
  • trueUpSkinL
  • trueUpSkinM
  • trueUpSkinR
  • trueDownSkinL
  • trueDownSkinM
  • trueDownSkinR
  • trueOverSkinL
  • trueOverSkinM
  • trueOverSkinR
  • falseDisabledSkinL
  • falseDisabledSkinM
  • falseDisabledSkinR
  • trueDisabledSkinL
  • trueDisabledSkinM
  • trueDisabledSkinR
In the preceding property names, "false" means that the button is not in a "toggled on" state, while "true" means that the button is in a "toggled on" state. Non-toggle buttons (i.e., normal buttons) use the "false" skins only. The letter "L" means left cap, "M" means middle, stretching section, and "R" means right cap.

Note, however, that rather than relying on the above list of CustomButton skin properties you should always consult the actual source code for the CustomButton class to verify which skin properties it supports. Different versions of the class may support different properties. The source code also contains a brief description for each skin element. The source file for CustomButton is located here:

  • Windows: \Program Files\Macromedia\Flash MX 2004\[LANGUAGE_CODE]\First Run\Classes\mx\controls\CustomButton.as
  • Macintosh: HD/Applications/Macromedia Flash MX 2004/First Run/Classes/mx/controls/CustomButton.as
About Colin Moock
Colin Moock is an independent web guru with a passion for networked
creativity and expression. He is author of the world-renowned guides to
Flash programming, "ActionScript for Flash MX: The Definitive Guide" (O'Reilly
& Associates, 2003, 2001) and "Essential ActionScript 2.0" (O'Reilly &
Associates, 2004). A web professional since 1995, Moock runs one of the web's most venerable Flash developer sites, www.moock.org. He spends most of his
time pursuing his cardinal interest, multiuser application development, and
working on Unity, moock.org's complete commercial framework for creating and
deploying multiuser applications for Macromedia Flash.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Enterprise Open Source Magazine Latest Stories . . .
Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP). The...
With Cloud Expo 2012 New York (10th Cloud Expo) just four months away, what better time to start introducing you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference... We have technical and st...
AMD said late Tuesday that its chief sales officer Emilio Ghilardi had left the company and that CEO and president Rory Read is going to do his job while a replacement is sought. AMD didn’t say why Ghilardi left but it’s assumed Read wants his own people. Read is relatively new to th...
During the lifespan of M3 (Monitis Monitor Manager) there has always been something lacking – timers. M3 execution procedure was outlined in this previous article. The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocati...
Red Hat is putting its bought-in Gluster scale-out NAS storage technology, acquired in October, on the Amazon cloud. It’s styled Red Hat Virtual Storage Appliance for Amazon Web Services and other clouds are supposed to follow in short order.
A new episode of the screencast series is now available at the OpenNebula YouTube Channel. This screencast demonstrates the new easily-customizable self-service portal for cloud consumers. Its aim is to offer a simplified access to shared infrastructure for non-IT end users. The scree...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE