<< Chapter < Page Chapter >> Page >

The folks who defined the Button class have already designed the desired characteristics into the Button class and its superclasses. We can use inheritance to take advantage of the existing characteristics and toadd new characteristics by defining unique subclasses of the Button class.

Three new button classes

The program named Skins01 that I will explain in this lesson defines three new button classes named ButterflyButton , FrogButton , and FancyButton . Each of these classes extends the Button class and inherits all of the characteristics of a standard Button object. However, the visual elements of the standard button are modified in thesubclasses through the use of the ActionScript skinning capability.

What is skinning?

According to About skinning ,

"Skinning is the process of changing the appearance of a component by modifying or replacing its visual elements. These elements can be made up ofbitmap images, SWF files, or class files that contain drawing methods that define vector images.

Skins can define the entire appearance, or only a part of the appearance, of a component in various states. For example, a Button controlhas eight possible states, and eight associated skin properties."

Will extend the Button class

In this lesson, I will extend the Button class into three new classes and will modify four of the eight skin properties for objects instantiated fromthe three new classes. I will also define a fourth class named Driver that is designed to exercise and show how to use the new buttons.

Images used as skins for the buttons

Figure 1 shows the images used to define new skins for the three buttons.

Images used as skins for the buttons.

Missing image
Images used as skins for the buttons.

The button class named ButterflyButton was skinned with the four butterfly images in the top row. The button class named FrogButton was skinned with the four frog images in the bottom row. The button classnamed FancyButton was skinned with both butterfly images and frog images and was given the ability to toggle back and forth between butterflies and frogs.

The toggleSkin method

The FancyButton class exposes a public method named toggleSkin . The rightmost button in Figure 2 is an object of the FancyButton class. Whenever this button is clicked, a click event handler registered on the button calls the toggleSkin method. Each time this method is called, the button's skins toggle from butterfly tofrog or vice versa. (See the rightmost button in Figure 5.) This illustrates the capability to change skins on an ActionScript component atruntime.

Spacebar -- Even though this text concentrates on the manipulation of the buttons with the mouse, a button can also be manipulated with thespace bar when it has the focus. Note, however, that this lesson doesn't address the topic of focus.

Skins versus button styles

The different skins on the buttons are exposed by associating the images in Figure 1 with various button styles.

The upSkin style

The two images in the first column in Figure 1 show what the buttons look like when the mouse is not hovering over or pointing at the button. Thiscorresponds to the button style named "upSkin" ,

Questions & Answers

How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
How can I make nanorobot?
Lily
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
how can I make nanorobot?
Lily
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
what is the Synthesis, properties,and applications of carbon nano chemistry
Abhijith Reply
Mostly, they use nano carbon for electronics and for materials to be strengthened.
Virgil
is Bucky paper clear?
CYNTHIA
carbon nanotubes has various application in fuel cells membrane, current research on cancer drug,and in electronics MEMS and NEMS etc
NANO
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Object-oriented programming (oop) with actionscript. OpenStax CNX. Jun 04, 2010 Download for free at http://cnx.org/content/col11202/1.19
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?

Ask