开发者

scripts that interact with flash objects on webpages

I was wonderin开发者_如何学Pythong if there was a scripting language that one could use to to interact with a flash object on a webpage? I am trying to automate some tasks but the webpage uses flash.

Thanks for the help!

Edit: I am trying to fill out a form basically click a few "check boxes" and then a submit button but I would like to know if its possible to automate this task.


Using ExternalInterface allows you to communicate between ActionScript and JavaScript.

Here are a few examples from the adobe site to get you started with ExternalInterface.

Here is the JavaScript to create and submit a form:

function createAndSubmitForm(url, formParams) {
    var newForm = document.createElement("form");
    newForm.setAttribute("action", url);
    newForm.setAttribute("method", "POST");

    for (var key in formParams) {
        var hiddenField = document.createElement("input");
        hiddenField.setAttribute("type", "hidden");
        hiddenField.setAttribute("name", key);
        hiddenField.setAttribute("value", formParams[key]);

        newForm.appendChild(hiddenField);
    }

    document.body.appendChild(newForm);
    newForm.submit();
}

To call it, add this call to your ExternalInterface (ActionScript) and add your parameters:

createAndSubmitForm('thisurl.ext', {param1: 'value1', param2: 'value2'});

If you want to access an existing form control (a checkbox, for example, and check it), then do this:

var form = document.forms[0];
document.getElementById('checkboxId').checked = true;
form.submit();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜