htmlText Alertbox


We have a product right now that has a basic shopping cart in it… and one of the options is to save the cart and view it as a pdf… so we send the request to the server, and return a link back with a link to the pdf, and

because we may have many messages come back from this one service we just use a simple alert box to show the user the feedback and that the application has saved successfully… if we need to put a link in there, the user must copy and paste the link in order to use it… WELLL, the small challenge was to make that a clickable link, and in the least amount of time possible… (15 minutes, rather than 2 hours for styling and the component itself) (it actually took longer to write the blog post, and put up the example than it did to fix the issue)

I was asked to create a component that allows for htmlText to be added to it, and the component has to have all the functionality of an Alert box… so why not extend the alert box, and make something like a file that extends Alert…

because you still have to use in your application to use it… so rather than going to all the work of creating a way to popup the popup from anywhere in the app, and making sure it dispatches CloseEvents like the original Alert box does, I did some digging and found a forum list that gave the greatest tip EVER! I never really use mx_internal… frankly it confuses me a little bit… the syntax is a little wonkey to me… I’ve never used the whole “::” thing and don’t really understand what it does… someone care to explain?

anyway, I thought this persons simple code was absolutely great!

var"dump text"); a.mx_internal::alertForm.mx_internal::textField.htmlText = some HTMl text goes here;

here is a link to the message post

They do neglect to mention that you have to import the internal namespace though, so in my example thats included. This is a very quick and cheap solution to the problem and just provides a way to fancy up the alert box a little bit by adding the “limited” html text that the flash platform supports… maybe flash 10 will add better htmlText support…. I would assume so with all of the text changes to the platform… but I havent looked into it so don’t quote me…


4 comments on this post.
  1. aşk videoları:

    thanks its very good information for us ı like it

  2. jason olmsted:

    The :: specifies a namespace. Essentially, if for whatever reason you want to maintain specific variable names that might overlap, it allows you to specify which one you need. The example that stuck out to me is a scenario where you are keeping track of two types of objects, colors and fruits. So, if you have orange the color and orange the fruit you would normally have a collision. To avoid this, you could define a color namespace and fruit namespace and thus have color::orange and fruit::orange and the ambiguity disappears.

    Another potentially useful example showed using namespaces for supporting multiple languages.

    Check out “Essential ActionScript 3.0” by Colin Moock for a richer explanation.

  3. Nils:

    Beautiful! Thanks!

  4. Kunjal:

    Nice example. But I m facing some problem with alert box. I want to customize alert box’s button. But I already have define Default button style. So it overlaps both buttons if i apply button style for Alert in my CSS. Now if I apply buttonWidth to reduce its size the alert box also become small but I want the Alert box width to be dependent on its text size not Button size.

    Thanks in advance 🙂

Leave a comment