# Class doesn't work after published

**URL:** https://forum.kirupa.com/t/class-doesnt-work-after-published/314807
**Category:** flash
**Created:** [October 9, 2010, 6:14am UTC](https://forum.kirupa.com/t/class-doesnt-work-after-published/314807 "2010-10-09T06:14:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![silve69](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@silve69](https://forum.kirupa.com/u/silve69)
#### Post date: [October 9, 2010, 6:14am UTC](https://forum.kirupa.com/t/class-doesnt-work-after-published/314807/1 "2010-10-09T06:14:29Z")

</div>

Hello guys,

I created a class for showing a Alert Message Window, everything is working OK while I executed it from Flash, but when I published it I can’t see nothing… I tryed in differents browsers, I tryed from localhost, uploading to an internet server, creating crossdomain.xml file in the root server, turning to “Access network only” the Flash Publish preferences… and nothing yet.

Here the class

```auto

package com.nuedi.ui
{
 import flash.display.Bitmap;
 import flash.display.BitmapData;
 import flash.display.DisplayObjectContainer;
 import flash.display.Loader;
 import flash.display.Sprite;
 import flash.text.TextField;
 import flash.text.TextFieldAutoSize;
 import flash.events.MouseEvent;
 import flash.filters.BlurFilter;
 import flash.filters.BevelFilter;
 import flash.filters.DropShadowFilter;
 import flash.net.URLRequest;
 import com.bit101.components.PushButton;
 
 
 / ***************** /
 / **CLASS Alert** /
 / ***************** /
 
 public class Alert extends Sprite
 {
  private var target:DisplayObjectContainer = null;
  private var textWidth:int = 0;
  private var textHeight:int = 0;
 
  public function Alert(_target:DisplayObjectContainer) 
  {
   target = _target;
  }
 
  public function show(vars:Object)
  {
   var myAlert:Sprite = new Sprite();
   var blur:BlurFilter = new BlurFilter(4,4,2);
   var bevel:BevelFilter = new BevelFilter(2,45,0xCCCCCC,0.5,0x000000,0.6,3,3);
   var shad:DropShadowFilter = new DropShadowFilter(4,45,0x000000,0.8);
 
   // catch the stage and apply blur filter
   var bd:BitmapData = new BitmapData(target.stage.stageWidth, target.stage.stageHeight);
   bd.draw(target.stage);
   var b:Bitmap = new Bitmap(bd);
   b.filters = [blur];
   myAlert.addChild(b);
 
   // alert window
   var myAlertWindow:Sprite = new Sprite();
 
   // creating text content
   var myTextField:TextField = new TextField();
   myTextField.multiline = true;
   myTextField.selectable = false;
   myTextField.autoSize = TextFieldAutoSize.CENTER;
   myTextField.htmlText = '<font face="Verdana" size="11">' + String(vars.text) + '</font>';
 
   // getting text size
   textWidth = myTextField.width;
   textHeight = myTextField.height;
 
   // window background
   var winBackground:Sprite = new Sprite();
   winBackground.graphics.lineStyle(1,0xCCCCCC,0.8);
   winBackground.graphics.beginFill(0xFFFFFF, 0.8);
   winBackground.graphics.drawRoundRect(0,0,20+textWidth,50+textHeight+('icon' in vars?42:0),10,10);
   winBackground.graphics.endFill();
   winBackground.filters = [bevel,shad];
   myAlertWindow.addChild(winBackground);
 
   // optional icon
   if ('icon' in vars)
   {
    var myIcon:Loader = new Loader();
    myIcon.load(new URLRequest('img/icons/' + String(vars.icon) + '.png'));
    myIcon.x = (textWidth - 12) / 2;
    myIcon.y = 15;
    myAlertWindow.addChild(myIcon);
   }
 
   // adding text content
   myTextField.x = 10;
   myTextField.y = ('icon' in vars) ? 52 : 10;
   myAlertWindow.addChild(myTextField);
 
   // OK button
   var btnOK:PushButton = new PushButton(myAlertWindow, (textWidth-30)/2, myTextField.y + textHeight + 10, 'OK', okClicked);
   btnOK.width = 50;
 
   // positioning window
   myAlertWindow.x = (target.stage.stageWidth - myAlertWindow.width) / 2;
   myAlertWindow.y = (target.stage.stageHeight - myAlertWindow.height) / 2;
   myAlert.addChild(myAlertWindow);
 
   target.addChild(myAlert);
 
   function okClicked(ev:MouseEvent):void
   {
    target.removeChild(myAlert);
   }
  }
 }
}

```

In my main.as file:

```auto

...
var target:Sprite = new Sprite();
alert = new Alert(target);
if (user_f.text == '' || pass_f.text == '')
{
    alert.show({text:'ERROR: Wrong access data!', icon:'error'});
}
...

```

Some suggestion??  
Thanks in advanced,

Silver
