List Effect Custom and Default Effects : Effect « Effects « Flex






List Effect Custom and Default Effects

List Effect Custom and Default Effects
   

<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->



    <!-- dataEffects\ListEffectCustomDefaultEffect.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark">
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <fx:Script> 
         
        import mx.effects.DefaultListEffect; 
        import mx.collections.ArrayCollection; 
        [Bindable] 
        private var myDP:ArrayCollection = new ArrayCollection( 
        ['A','B','C','D','E']); 
        private function deleteItem():void { 
            // As each item is removed, the index of the other items changes. 
            // So first get the items to delete, and then determine their indices 
            // as you remove them. 
            var toRemove:Array = []; 
            for (var i:int = 0; i < list0.selectedItems.length; i++) 
                toRemove.push(list0.selectedItems[i]); 
            for (i = 0; i < toRemove.length; i++) 
                myDP.removeItemAt(myDP.getItemIndex(toRemove[i])); 
        } 
            private var zcount:int = 0; 
        private function addItem():void { 
            // Always add the new item after the third item, 
            // or after the last item if the length is less than 3. 
            myDP.addItemAt("Z"+zcount++,Math.min(3,myDP.length)); 
        } 
      
    </fx:Script>
    <fx:Declarations>
        <!--
            Define an instance of the DefaultListEffect effect, and set its
            fadeOutDuration and color properties.
        -->
        <mx:DefaultListEffect id="myDLE" fadeOutDuration="1000" />
    </fx:Declarations>
    <mx:List id="list0" width="150" dataProvider="{myDP}"
        variableRowHeight="true" fontSize="24" allowMultipleSelection="true"
        itemsChangeEffect="{myDLE}" />
    <mx:Button label="Delete Item" click="deleteItem();" />
    <mx:Button label="Add Item" click="addItem();" />
</s:Application>

   
    
    
  








Related examples in the same category

1.Creating an instance of an effect using pure ActionScriptCreating an instance of an effect using pure ActionScript
2.Creating a reusable effect in ActionScript with Move classCreating a reusable effect in ActionScript with Move class
3.Define effect in MXML, use ActionScript to apply itDefine effect in MXML, use ActionScript to apply it
4.Effect With ActionScript
5.Use ActionScript to play EffectUse ActionScript to play Effect
6.Grouping effects and playing them one after anotherGrouping effects and playing them one after another
7.Playing multiple effects at the same timePlaying multiple effects at the same time
8.Use a class selector to apply effectsUse a class selector to apply effects
9.Using MXML to define the effectUsing MXML to define the effect
10.Applying behaviors using the Effect.target and Effect.targets propertiesApplying behaviors using the Effect.target and Effect.targets properties
11.Setting effect durationsSetting effect durations
12.Add show effect to a controlAdd show effect to a control
13.Play effect for more than one controlsPlay effect for more than one controls
14.Set effect targetSet effect target
15.Reverse an EffectReverse an Effect
16.Pause an EffectPause an Effect
17.Composite EffectsComposite Effects
18.Enable Composite EffectsEnable Composite Effects
19.Using the Pause effect to pause between two other effectsUsing the Pause effect to pause between two other effects
20.Using easing functions with the Move effect to make motion less linearUsing easing functions with the Move effect to make motion less linear
21.rollOverEffect and rollOutEffectrollOverEffect and rollOutEffect
22.Create, configure, and apply effects to Flex componentsCreate, configure, and apply effects to Flex components
23.Mouse down effect for an Image controlMouse down effect for an Image control
24.specify the mx.effects.easing.Bounce.easeOut() method to the Accordionspecify the mx.effects.easing.Bounce.easeOut() method to the Accordion
25.Chart show data effectChart show data effect
26.Check property in effect filer functionCheck property in effect filer function
27.SeriesInterpolate effectSeriesInterpolate effect
28.Apply Shadow effectApply Shadow effect
29.Insertion's effect on the Array and the ArrayCollection representation of the ArrayInsertion's effect on the Array and the ArrayCollection representation of the Array
30.Applying MX effects in MXMLApplying MX effects in MXML
31.Easing function that creates a bounce motion when combined with the Flex Move effectEasing function that creates a bounce motion when combined with the Flex Move effect
32.Repeat EffectsRepeat Effects
33.Applying transform effectsApplying transform effects