1 Reply Latest reply on Sep 14, 2010 12:48 AM by BhaskerChari

    Alert not correct to CSS file with <mx:Canvas>

    quoc_thai Level 1

      Hi all,

       

           I want apply CSS file to Alert. So, I have:

       

           1. CSS file called CommonStyle.css:

          

      Alert{

      color : #0f3177;

      title-style-name : "alertTitle";

      header-height:19;

      border-thickness: 1;

      drop-shadow-enabled: true;

      drop-shadow-color :#d1ddf7;

      background-color: #ffffff;

      corner-radius :6;

      border-style :solid;

      header-colors : #90a4d1, #5970a0;

      footer-colors : #9db6d9, #ffffff;

      border-color : #5970a0;

      }

      .alertTitle{

      font-family :Verdana;

      font-size :10;

      font-weight :bold;

      text-align :left;

      color :#ffffff;

      }

      2. alert class custom:

      package

       

      component

      {

       

      import mx.controls.Alert;

       

       

      public class alert extends Alert

      {

      [

      Embed(source="images/alert_error.gif")]

       

      private static var iconError:Class;

       

      [

      Embed(source="images/alert_info.gif")]

       

      private static var iconInfo:Class;

       

      [

      Embed(source="images/alert_confirm.gif")]

       

      private static var iconConfirm:Class;

       

       

      public static function info(message:String, closehandler:Function=null):void{

      show(message,

      "Information", Alert.OK, null, closehandler, iconInfo);

      }

       

       

      public static function error(message:String, closehandler:Function=null):void{

      show(message,

      "Error", Alert.OK, null, closehandler, iconError);

      }

       

       

      public static function confirm(message:String, closehandler:Function=null):void{

      show(message,

      "Confirmation", Alert.YES | Alert.NO, null, closehandler, iconConfirm);

      }

       

      }

      }

      3. My mxml component:

      <mx:Canvas

      xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" creationComplete="init()">

       

      <mx:Style source="styles/CommonStyle.css" />

                             

      <mx:Script>

      private

       

      function test():void{

      alert.error(

      "alert test...");

      }

      </mx:Script>

      </mx: Canvas>

       

      But at the line:  <mx:Style source="styles/CommonStyle.css" />, I received a warning: CSS type selectors are not supported in components: 'Alert' and my alert dialog not correct to CSS file !.

       

      There is a problem is: When I replace <mx:Canvas > by <mx:Application>, my alert dialog is ok.

       

      Pls, help me.

      Thanks.