<< Chapter < Page Chapter >> Page >

This code instantiates an object of the Parallel class and adds the three effects as children of that object. Then the code calls the play method on the Parallel object. This causes all three effects to play simultaneously.

Reset the counter

Finally, Listing 15 resets the value of the effect counter back to 0 so that the sequence will begin anew the next time the event handler for the show event is executed.

Play the same effect on multiple targets simultaneously

You can play the same effect on multiple targets simultaneously by setting the targets property on the effect object instead of the target object. The targets property requires an array containing references to the target objects.

Three steps are required

The following steps are required to play an effect in the Flash Player using this approach.

  1. Instantiate and save a reference to an Effect object.
  2. Set properties on the effect object. Be sure to set the target property for a single target or the targets property for multiple targets.
  3. Call the play method on the effect object.

To play multiple effects in parallel or in sequence

  1. Instantiate and save references to two or more Effect objects.
  2. Set properties on the effect objects, being careful to set either the target property or the targets property.
  3. Instantiate a Parallel object or a Sequence object.
  4. Add the effect objects as children of the Parallel object or the Sequence object.
  5. Call the play method on the Parallel object or the Sequence object.

Note that you can also add Sequence objects to Parallel objects and vice versa. Just make certain that you don't try to play two instancesof the same effect on the same object at the same time.

The end of the program

Listing 15 also signals the end of the Driver class and the end of the program.

Run the programs

I encourage you to run these two programs from the web. Then copythe code from Listing 16 through Listing 18. Use that code to create Flex projects. Compile and run the projects.Experiment with the code, making changes, and observing the results of your changes. Make certain that you can explain why your changes behave as theydo.


I will publish a list containing links to ActionScript resources as a separate document. Search for ActionScript Resources in the Connexions search box.

Complete program listings

Complete listings of the MXML and ActionScript files are provided in Listing 16 through Listing 18 below.

The mxml file used for both programs.

<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"xmlns:cc="CustomClasses.*"><cc:Driver/></mx:Application>

The driver class for effects04.

/*Effects04 11/22/09 This program shows how to set the style on an object witha mouseUpEffect trigger and cause the object to glow. */package CustomClasses{ import mx.containers.VBox;import mx.controls.Button; import mx.controls.Label;import mx.effects.Glow; public class Driver extends VBox{//Instantiate and save references to all of the // objects needed by the program.private var title:Label = new Label(); private var button:Button = new Button();private var glowEffect:Glow = new Glow(); //--------------------------------------------------//public function Driver(){//constructor//Set title properties and add to the VBox. title.setStyle("color","0xFFFF00");title.setStyle("fontSize",14); title.text = "Demo mouseUpEffect trigger";addChild(title); button.label = "Click me and watch me glow.";addChild(button); glowEffect.color = 0xFF0000;glowEffect.strength = 255;glowEffect.duration = 10000; button.setStyle("mouseUpEffect",glowEffect);} //end constructor //--------------------------------------------------//} //end class } //end package

Questions & Answers

I only see partial conversation and what's the question here!
Crow Reply
what about nanotechnology for water purification
RAW Reply
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
scanning tunneling microscope
how nano science is used for hydrophobicity
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
what is differents between GO and RGO?
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
The nanotechnology is as new science, to scale nanometric
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
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
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
what school?
biomolecules are e building blocks of every organics and inorganic materials.
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
sciencedirect big data base
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.
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
How can I make nanorobot?
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!
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?