Clicky

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

asked 10/10/2011 01:15

tia_kamakshi's gravatar image

tia_kamakshi ♦♦


8 Answers:
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.)
link

answered

Carnou's gravatar image

Carnou

why not just use a trace statement for debugging

trace("error");
link

answered 2011-10-10 at 11:33:13

conagraman's gravatar image

conagraman

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

link

answered 2011-10-10 at 14:21:43

tia_kamakshi's gravatar image

tia_kamakshi

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.
link

answered 2011-10-10 at 21:03:01

Carnou's gravatar image

Carnou

link

answered 2011-10-10 at 21:53:22

Carnou's gravatar image

Carnou

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
link

answered 2011-10-10 at 22:45:30

CyanBlue's gravatar image

CyanBlue

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");
link

answered 2011-10-12 at 09:02:30

conagraman's gravatar image

conagraman

»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
link

answered 2011-10-13 at 07:24:34

conagraman's gravatar image

conagraman

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: 10/10/2011 01:15

Seen: 385 times

Last updated: 10/14/2011 12:05