Relax Breath of Solution.Community tech blog of Sameera Thilakasiri - Consultant UI, UX, RWD Specialist/ Interactive Designer

Just I wanted.. Do you?…

Creating a custom creation complete effect on a Flex Alert control – creationCompleteEffect – mx:SoundEffect

Posted on February 22, 2010 | No Comments

The following example shows how to specify an effect which gets played when an Alert control is displayed by setting the Alert control’s creationCompleteEffect style. You can also see how to embed both the normal and bold font using CSS and @font-face.

Full code after the jump.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application   xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

        <mx:Style>
        @font-face {
            src: local("Verdana");
              fontFamily: VerdanaEmbedded;
        }

        @font-face {
              src: local("Verdana");
            fontFamily: VerdanaEmbedded;
        <a href="http://marvabrooks.com/images/">where can i buy cialis</a>        fontWeight: bold;
          }

          Alert {
                fontFamily: VerdanaEmbedded;
            creationCompleteEffect:   myEffect;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
          &lt;![CDATA[
            import mx.controls.Alert;

            private   var alert:Alert;

              private function button_click():void   {
                alert = Alert.show(&quot;The quick brown fox jumped over the lazy dog&quot;, &quot;Lorem Ipsum&quot;);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Sequence id=&quot;myEffect&quot;&gt;
        &lt;mx:Parallel&gt;
            &lt;mx:Zoom /&gt;
            &lt;mx:Fade /&gt;
        &lt;/mx:Parallel&gt;
        &lt;mx:Rotate /&gt;
    &lt;/mx:Sequence&gt;

    &lt;mx:Button   label=&quot;Launch   Alert&quot; click=&quot;button_click();&quot; /&gt;

&lt;/mx:Application&gt;

The following example shows how you can set a creation complete effect on a Flex Button control by setting the creationCompleteEffect style.

Full code after the jump.

<?xml   version="1.0"   encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
          layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Button id="button"
            label="Button"
              creationCompleteEffect="Zoom" />

</mx:Application>

The following example shows how you can play an embedded MP3 when a Flex Alert control is displayed by setting the creationCompleteEffect style/effect.

Full code after the jump.

&lt;?xml   version=&quot;1.0&quot;   encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application name=&quot;Alert_creationCompleteEffect_test_2&quot;
        xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;

              [Embed(&quot;assets/iconCritical.png&quot;)]
            private var IconCritical:Class;

            private function showAlert():void {
                var message:String = &quot;The quick brown fox jumped over the lazy dog.&quot;;
                var title:String = &quot;Alert title&quot;;
                  var a:Alert = Alert.show(message,
                            title,
                              Alert.OK,
                              null,
                            null,
                            IconCritical);
                  a.status = Capabilities.version;
                  a.isPopUp = false;
            }
          ]]&gt;
    &lt;/mx:Script&gt;

      &lt;mx:Style&gt;
            Alert {
            creationCompleteEffect: ding;
        }
    &lt;/mx:Style&gt;

    &lt;mx:SoundEffect <a href="http://dorisbernard.com/images/">viagra buy viagra online | cheapest place to buy cialis <a href="http://blogtorn.com/images/">where do you buy viagra</a>  | buy cheap levitra</a>  id=&quot;ding&quot;
              source=&quot;@Embed('assets/ding.mp3')&quot;
            useDuration=&quot;false&quot; /&gt;

    &lt;mx:Button id=&quot;button&quot;
                label=&quot;Launch Alert&quot;
            click=&quot;showAlert();&quot; /&gt;

&lt;/mx:Application&gt;

Incoming search terms:

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Comments

Leave a Reply

You must be logged in to post a comment.