ApplicationSource

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 BaseAlert.as file that extends Alert…

because you still have to use Alert.show 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 a:Alert=Alert.show("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…

ApplicationSource