Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Message Box in flash file

Posted on 2011-10-10
Medium Priority
Last Modified: 2013-11-11

How do we show messagebox or alert in flash action scripting 3.0 likewise in javascript alert("hi");

Message box will help me debugging my code when checking my code on website , if there is any issue else it is hard to debug my .swf file where error is coming

Please suggest

Many Thanks
Question by:tia_kamakshi
LVL 10

Accepted Solution

Carnou earned 1000 total points
ID: 36944170
You can use the javascript alert within your flash AS code.  Here is one website among many that provides examples:

Alternatively, you can use the trace statement, and it will output to the Flash IDE window.  You can also set breakpoints within the IDE.  Both of these will be much more powerful than kludging in a messagebox.

Finally, one alternative I found works quite nicely is just to toss a textbox on the stage.  Whenever you want to "send an alert", simply add to the textbox: my_textbox.text += "Here is my alert message";  (Obviously, when you're done debugging, delete the textbox.)
LVL 10

Assisted Solution

conagraman earned 1000 total points
ID: 36945346
why not just use a trace statement for debugging


Author Comment

ID: 36946614
trace will work only when I am running my swf file within flash debugging mode. I can see trace results in output window

But trace will not work when I copy my .swf file to my website, then identifying the problem is real tuff.

so, I wanted to place alert one by one to see where my code is failing when moved to server.

Please suggest better way of debugging to the server

Many Thanks

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 10

Expert Comment

ID: 36946753
My suggestions still hold. Just google "as3 alert" and you'll see lots of ways to do what you want. From experience, I can tell you that the easiest thing is to put a text box on the stage and write to that. It can look ugly. Just take it out when you're done debugging.

Also, if you search enough, you will find there is a way, using the Flag debug plug-in, to actually get IE to log all trace statements that a swf emit.
LVL 10

Expert Comment

ID: 36946863
LVL 37

Expert Comment

ID: 36956876
MonsterDebugger is a great tool to have when it comes to debugging Flash content.  You should check it out.  ;)

The simplest but less obtrusive way would be calling JavaScript's console.log(msg) from ActionScript via ExternalInterface and check it in Firebug or something.

LVL 10

Expert Comment

ID: 36962433
if you just want to call a javascript function with an alert you can call the function from as3 with
an external interface call

LVL 10

Expert Comment

ID: 36962495
»also if you use an external interface call make sure you have the import - forgot to mention that

import flash.external.ExternalInterface;

here is the adobe link on external interface

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question