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

x
?
Solved

Message Box in flash file

Posted on 2011-10-10
8
Medium Priority
?
1,086 Views
Last Modified: 2013-11-11
Hi,

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
0
Comment
Question by:tia_kamakshi
8 Comments
 
LVL 10

Accepted Solution

by:
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:
http://www.sitepoint.com/forums/showthread.php?558367-Do-JavaScript-alert-from-Flash-using-ActionScript

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.)
0
 
LVL 10

Assisted Solution

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

trace("error");
0
 

Author Comment

by:tia_kamakshi
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

0
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

by:Carnou
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.
0
 
LVL 10

Expert Comment

by:Carnou
ID: 36946863
0
 
LVL 37

Expert Comment

by:CyanBlue
ID: 36956876
MonsterDebugger is a great tool to have when it comes to debugging Flash content.  You should check it out.  ;)
   http://www.monsterdebugger.com/

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.

CyanBlue
0
 
LVL 10

Expert Comment

by:conagraman
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

ExternalInterface.call("javascript_function");
0
 
LVL 10

Expert Comment

by:conagraman
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
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6
0

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