<< Chapter < Page Chapter >> Page >

I will break this program down and explain it in fragments. Aside from the MXML file shown in Listing 14, the program consists of a single class named Driver . A complete listing of the Driver class file is provided in Listing 16 near the end of the lesson.

Beginning of the class named Driver

The Driver class begins in Listing 4. Note that this class extends the Panel class, causing this program to have the same overall appearance as the program provided in the documentation .

Beginning of driver class for effects03.

package CustomClasses{ import flash.events.MouseEvent;import mx.containers.ControlBar; import mx.containers.Panel;import mx.controls.Button; import mx.controls.Image;import mx.controls.TextArea; import mx.effects.Resize;import mx.events.EffectEvent; import mx.events.FlexEvent;public class Driver extends Panel{ //Instantiate and save references to all of the// objects required by the program. private var resize:Resize = new Resize();private var textOut:TextArea = new TextArea(); private var image:Image = new Image();private var bar:ControlBar = new ControlBar(); private var startButton:Button = new Button();private var pauseButton:Button = new Button(); private var resumeButton:Button = new Button();private var reverseButton:Button = new Button(); private var endButton:Button = new Button();private var resetButton:Button = new Button();

In addition to containing all of the required import directives, the code in Listing 4 instantiates and saves references to all of the objects required bythe program.

Beginning of the constructor for Effects03

The constructor begins in Listing 5.

Beginning of the constructor for effects03.

public function Driver(){//constructor this.title="Demonstration of the Resize effect.";this.percentWidth = 100; this.percentHeight = 100;this.addEventListener(FlexEvent.CREATION_COMPLETE,creationCompleteHandler);

The code in Listing 5 sets several properties on the Panel object, which is the object with the light gray background shown in Figure 4. The Panel object is displayed in the browser window, which has a slightly darker gray background color in Figure 4.

Register an event listener

The last statement in Listing 5 registers an event listener named creationCompleteHandler to service creationComplete events dispatched by the Panel object.

As you will see later, the event handler causes the text "Creation Complete!" to be displayed in a TextArea object near the top of the Panel in Figure 4 when the Panel object and all of its children have been constructed, initialized, and drawn.

Prepare the TextArea object and add it to the Panel

Listing 6 sets some properties and some styles on the TextArea object and adds it near the top of the Panel as shown in Figure 4.

Prepare the textarea object and add it to the panel.

textOut.percentWidth = 100;//percent textOut.height = 100;//pixelstextOut.setStyle("color","0x0000FF"); textOut.setStyle("fontSize",14);textOut.text = "Use the Buttons to control " + "the size of the image.";addChild(textOut);

Questions & Answers

what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
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
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
characteristics of micro business
for teaching engĺish at school how nano technology help us
Do somebody tell me a best nano engineering book for beginners?
s. Reply
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
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.
what is the actual application of fullerenes nowadays?
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.
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.
is Bucky paper clear?
so some one know about replacing silicon atom with phosphorous in semiconductors device?
s. Reply
Yeah, it is a pain to say the least. You basically have to heat the substarte up to around 1000 degrees celcius then pass phosphene gas over top of it, which is explosive and toxic by the way, under very low pressure.
Do you know which machine is used to that process?
how to fabricate graphene ink ?
for screen printed electrodes ?
What is lattice structure?
s. Reply
of graphene you mean?
or in general
in general
Graphene has a hexagonal structure
On having this app for quite a bit time, Haven't realised there's a chat room in it.
what is biological synthesis of nanoparticles
Sanket Reply
what's the easiest and fastest way to the synthesize AgNP?
Damian Reply
types of nano material
abeetha Reply
I start with an easy one. carbon nanotubes woven into a long filament like a string
many many of nanotubes
what is the k.e before it land
what is the function of carbon nanotubes?
I'm interested in nanotube
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
preparation of nanomaterial
Victor Reply
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Got questions? Join the online conversation and get instant answers!
QuizOver.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?