Not yet rated

Problem

How to create an alert dialogue box in Flash using AS3 like JavaScript or Flex's Alert.show(); command.

Solution

A few ideas as there isn't as far as I know a built in solution in the regular Flash editor.

Detailed explanation

Hack:

Call javascript to generate an alert through the flash :

ExternalInterface.call('alert','blablabla');

As all alerts do is block the clickable area behind and have some copy with a click button it's easy to recreate but unfortunately it looks like Adobe dropped that item.  From a quick search on google it does look like its an only Flex thing which is odd, but not the end of the world and someone uploaded a sample on how to:

http://www.kirupa.com/forum/showthread.php?t=267140

So to answer your question really the easiest path would be to hijack the Java alert message (if you need a quick  something) or to just skin out a visual and create a class for it so you can reuse it.

My personal fav is not having them at all. There very annoying alerts if you have a way to convey your message without using one you will do a favor to your users ;)

 

_
Ben Fhala

Flash/AS3 School  || Follow  @02geek ||  Youtube Channel || EventController  || More Recipes

In the spotlight: Learn the foundations of coding in the language you love - ActionScript 3.0 ;) With hours of videos and exams

P.S. If you want to call my attention to a request
add @02geek to the title or twitter
my nickname and a link to your post.


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes