Tutorial :Is there something like alert() of js in flash world?


I want some text to be displayed(visible for web browser), so it's not trace..

I'm new to this language,what's the easiest solution?


import flash.text.TextField;    var label:TextField = new TextField();  label.text = "Hello World";  addChild(label);  


The easiest and probably most user friendly would to call the Javascript alert with actionscripts external interface

**AS3:**  ExternalInterface.call("test();");    **Javascript:**  function test() { alert('hello world'); }  

UPDATE: Actually come to think of it you might be able to just do

ExternalInterface.call("alert('Hello World');");  

If you are using Flex builder you can use mx.controls.Alert http://livedocs.adobe.com/flex/3/langref/mx/controls/Alert.html if not then I'm afraid you will probably have to roll your own.


Your best bet is just to create a sprite or MovieClip that holds whatever content you want popping up. Add it to the top of the display list and set visible=false. Then when you want to show it, just say mySprite.visible = true.

There are other ways to handle this, and you can get pretty fancy with what exactly goes into your sprite - but generally speaking, this should handle it. If you want to prevent people from clicking behind it, put a big rectangle the size of your app as the bottom layer in your sprite, and set the alpha to 0. That'll intercept clicks and keep them from drilling down.

Hope that helps.


Look at the Alert control:



Or you can use the sepiroth firefox extension who permit to see the flash trace directly in firefox. http://www.sephiroth.it/weblog/archives/2006/10/flashtracer_firefox_extensionphp.php

To use it, you need to download the Windows Flash Player 10 Plugin content debugger http://www.adobe.com/support/flashplayer/downloads.html

Enjoy :)

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »