<< 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.

Resources

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

short run AC curves?
Jasmin Reply
what is short run AC curves?
Jasmin
what is short run curves?
Jasmin
what is short run curves?
Jasmin
nooo am not from India why!?
Godwin Reply
h
Hamid
Godwin which level of education are you please
Millionaires
millionaires am in SHS 2
Godwin
vnsgu BBA ki first sem ki all subjects ki koi app he ?
Modi Reply
one is business economics app
mudasir
all subjects ki koi nhi he ?
Modi
for accounts u can download accounts complete course app ... step by step Al the topics r mentioned
mudasir
Muje BBA ke first semester ke liye chahiye.... Vnsgu
Modi
there is a app for bba
Muhammad
named as college tutor on play store
Muhammad
isme sab subject ki books aa jayegi ?
Modi
han g
Muhammad
baqi main bad main batata hun abi online paper ho raha ha
Muhammad
okk....
Modi
Apki knsi uni ha
Muhammad
aik aur app ha but wo indian ha
Muhammad
Named as bba books
Muhammad
okk
Modi
collage tutor mein join teacher wala hi aata he or kuch nhi aata he
Modi
Mera Vnsgu he
Modi
asslam alaikum
Hamid
BBA books app ki photo send kijiye naa please
Modi
photo kesy send ho skty ha yahan sy?
Muhammad
I mean iska option kahan ha
Muhammad
haa.. sorry
Modi
collage tutor mein join teacher wala hi aata he or kuch nhi aata he
Modi
ok
Muhammad
Mera Vnsgu he
Modi
Ap play store py ja ky waha search ker lain wahan sy asani sy ye app mil jay ga apko
Muhammad
ab books kaha lau ?
Modi
oh sorry
Muhammad
main apko sham rak batata hun abi paper ho raha ha☺☺
Muhammad
kya search maru ?
Modi
yar ap ki books ka name kia ha?
Muhammad
modi
Hamid
who know accounting
Hamid
Hmare pass koi bhi subject ki book nhi he
Modi
abi 1st semester ha
Muhammad
ha... First semester
Modi
Yes sir
Modi
mujy book pary ha pdf ma accounting economic statistics Kay book ha mery pass
Hamid
pdf ma h
Hamid
to send karo naa
Modi
ya pa kasy kro
Hamid
kya ?
Modi
whatsp number do
Hamid
number bejo whatsp ka
Hamid
jaldi
Hamid
technical error bta rha he
Modi
number send nhi ho paa rha he
Modi
fb I'd name batio
Hamid
mery Hamid Ali shaikh ha
Hamid
mein nai use krti
Modi
fb I'd ka name bejo
Hamid
aap kaha se ho ?
Modi
fr kiya hoga
Hamid
ap kiya Kiya chlty ho batio
Hamid
mtlb ?
Modi
kiya use krty h wo Batio ma koxhes krta h fr
Hamid
ma pakistan sa h
Hamid
fb dowled Kro ap fr kam hiGa ap ka
Hamid
Krishi Modi iss fb id pe bhejo
Modi
Modi
Muhammad
profile kon sy h
Hamid
Modi are you from india
Muhammad
yr privacy ha Aik I'd pa req nhi jaty
Hamid
who was the father of economic ?why?
Mahesh Reply
who was the known as father of economic?why?
Mahesh
Rationing and hoarding
Semiat Reply
how do the size of a country's population affect labour force
Evans Reply
a mixed economic system
Ngong Reply
What are the types of price elasticity of demand
Juliana Reply
what are massures to promote geographical mobility of labor?
Ngong
Is to make sure that a labourer to know more about his salary to earn before going to the direction
shehu
what is trade
PHILIPPE Reply
Trade is a basic economic concept involving the buying and selling of goods and services, with compensation paid by a buyer to a seller, or the exchange of goods or services between parties. Trade can take place within an economy between producers and consumers.
Miss
what is fisical policy?
ha Reply
fisical policy or fiscal policy?
Miss
what are.the characteristics of economic goods
Hamis
what are the importance of labour market?
Rachael
how discrib the rural development and their four stages
Sheikh Reply
ye economics se related ha
Sheikh
1..traditional stage..no science and technology is applied hence poor productionuu.2..the take off stage..some development strategies are initiated eg transport system is improved but the traditional cultural belief still remain .3..the prematurely stage..technological methods of production are appl
President
applied leading to higher GDP..4..stage of mass consumption..
President
What is Easiest Formula For National Income?
Tenzin Reply
national income/ agrrigate net value
Sheikh
what do you mean by the supply of goods
sachin Reply
supply of good refer to the total unit of production which is ready to sell at a given price
Tenzin
what is implicit cost
fuseini Reply
Yeah
MOHAMED
any cost that has already occurred but not necessarily shown or reported as a separate expense.
President
The links don't seem to be working
Scorch Reply
While the American heart association suggests that meditation might be used in conjunction with more traditional treatments as a way to manage hypertension
Beverly Reply
Researchers demonstrated that the hippocampus functions in memory processing by creating lesions in the hippocampi of rats, which resulted in ________.
Mapo Reply
The formulation of new memories is sometimes called ________, and the process of bringing up old memories is called ________.
Mapo Reply
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