Inserting opt-in form on swf file

Hi,

I have a .swf file with an email field and I want to add my opt-in code to that email field so that when visitors enter their email they will be subscribed to my list on Mailchimp. I never worked with .swf files before and I have no idea where to start.

How can I edit a .swf file? Which tool do I need?

You need the source fla to edit.
Adding code for mail chimp is pretty easy.


var apiKey = "YOUR API KEY HERE";
var listID = "YOUR LIST ID";

function subscribeToEmailList(e:String,n:String,s:String){

    var result_xml:XML = new XML();
    result_xml.ignoreWhite = true;
    result_xml.onLoad = function(success){
        trace("Result:"+result_xml)
        if(result_xml.firstChild.firstChild.toString() == "1"){
               trace("added to list")
        }
    }
    var send_xml:XML = new XML();
    send_xml.ignoreWhite = true;
    var send_url:String = "http://us2.api.mailchimp.com/1.1/?output=xml&method=listSubscribe&apikey=" + apiKey + "&id=" + listID + "&email_address=" + e + "&merge_vars[FNAME]=" + n + "&merge_vars[LNAME]=" + s;
    send_xml.sendAndLoad(send_url, result_xml);
}
butSubmit.onRelease=function(){
    subscribeToEmailList(txEmail.text,txName.text,txLast.text)
}

See attached fla for basic example.

Paul,

Thanks for the reply and the sample file, I will be checking it. But I don’t have the source file, just the .swf file and I don’t know how to edit it.

You can’t edit the swf without the source. You might be able to decompile the swf and rebuild an fla from that but that can also cause problems of its own.