<< Chapter < Page Chapter >> Page >

Very similar to the previous code

The code in Listing 15 matches the code in Listing 11 and Listing 12 with a few exceptions:

  • There is no import directive for the MouseEvent class.
  • There are no click event handlers registered on the buttons.

Set properties on the custom effect

Listing 16 sets the properties on the custom effect.

Set properties on the custom effect.

//Set various properties needed by the effect. theEffect.theDuration = 4000;theEffect.rotateAngleFrom = 0; theEffect.rotateAngleTo = 720;theEffect.wipeShowTarget = true; theEffect.glowColor = 0xFF0000;theEffect.glowInner = true; theEffect.glowStrength = 255;

Once again, this code is very similar to the code in Listing 13. There is one major difference, however. The targets property for the effect is not explicitly set to the buttons as is the case in Listing 13.

Apply the effect to the two buttons individually

Listing 17 shows the major difference between the two programs.

Apply the effect to the two buttons individually.

btnA.setStyle("mouseUpEffect",theEffect); btnB.setStyle("mouseUpEffect",theEffect);} //end constructor //--------------------------------------------------//} //end class } //end package

Use the setStyle method and the effect trigger

Whereas the previous program explicitly sets the buttons as targets of the effect and calls the play method on the effect, this program uses the setStyle approach and associates the custom effect with a mouseUpEffect trigger on each button individually. As a result, when the mouse button is released while the mouse pointer is over one ofthe buttons, the effect is played on that button alone.

May not be possible to specify multiple targets

I don't know of any easy way to use this approach to cause the effect to be played on two or more components at the same time. The documentation hints thatthis may not be possible.

The end of the program

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

Run the program

I encourage you to run this program from the web. Then copy the code from Listing 18 through Listing 22. 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 canexplain why your changes behave as they do.

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 Flex applications discussed in this lesson are provided below.

Common mxml code used for both programs.

<?xml version="1.0" encoding="utf-8"?><!--CustomEffect02 11/26/09 Illustrates a custom effect, which is the parallelplaying of three standard effects: WipeRightRotate GlowThe effect is applied to two buttons each time either button is clicked.This version sets the targets on the effect and calls the play method on the effect.See the Flex 3 Cookbook, page 363 Also see http://livedocs.adobe.com/flex/3/html/help.html?content=createeffects_2.html#178126 Also see http://livedocs.adobe.com/flex/3/html/help.html?content=behaviors_04.html#275399 --><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"xmlns:cc="CustomClasses.*"><cc:Driver/></mx:Application>

Questions & Answers

what is defense mechanism
Chinaza Reply
what is defense mechanisms
Chinaza
I'm interested in biological psychology and cognitive psychology
Tanya Reply
what does preconceived mean
sammie Reply
physiological Psychology
Nwosu Reply
How can I develope my cognitive domain
Amanyire Reply
why is communication effective
Dakolo Reply
Communication is effective because it allows individuals to share ideas, thoughts, and information with others.
effective communication can lead to improved outcomes in various settings, including personal relationships, business environments, and educational settings. By communicating effectively, individuals can negotiate effectively, solve problems collaboratively, and work towards common goals.
it starts up serve and return practice/assessments.it helps find voice talking therapy also assessments through relaxed conversation.
miss
Every time someone flushes a toilet in the apartment building, the person begins to jumb back automatically after hearing the flush, before the water temperature changes. Identify the types of learning, if it is classical conditioning identify the NS, UCS, CS and CR. If it is operant conditioning, identify the type of consequence positive reinforcement, negative reinforcement or punishment
Wekolamo Reply
please i need answer
Wekolamo
because it helps many people around the world to understand how to interact with other people and understand them well, for example at work (job).
Manix Reply
Agreed 👍 There are many parts of our brains and behaviors, we really need to get to know. Blessings for everyone and happy Sunday!
ARC
A child is a member of community not society elucidate ?
JESSY Reply
Isn't practices worldwide, be it psychology, be it science. isn't much just a false belief of control over something the mind cannot truly comprehend?
Simon Reply
compare and contrast skinner's perspective on personality development on freud
namakula Reply
Skinner skipped the whole unconscious phenomenon and rather emphasized on classical conditioning
war
explain how nature and nurture affect the development and later the productivity of an individual.
Amesalu Reply
nature is an hereditary factor while nurture is an environmental factor which constitute an individual personality. so if an individual's parent has a deviant behavior and was also brought up in an deviant environment, observation of the behavior and the inborn trait we make the individual deviant.
Samuel
I am taking this course because I am hoping that I could somehow learn more about my chosen field of interest and due to the fact that being a PsyD really ignites my passion as an individual the more I hope to learn about developing and literally explore the complexity of my critical thinking skills
Zyryn Reply
good👍
Jonathan
and having a good philosophy of the world is like a sandwich and a peanut butter 👍
Jonathan
generally amnesi how long yrs memory loss
Kelu Reply
interpersonal relationships
Abdulfatai Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




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