A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: How can I submit HTML form with flash button?

  1. #1
    Confounded Flash User
    Join Date
    Apr 2001
    Location
    Chicago
    Posts
    39

    How can I submit HTML form with flash button?

    Hi,

    I'm striking out figuring this out on my own, I have an HTML form but I want to use a flash button to submit it. (the button needs to show a 'hit's state, it's for a kiosk).

    I assume it's some simple actionscript but I can't figure out how to do it. An explanation or an example would be greatly appreciated. I am using Flash 8.

    Thanks

    Tom

  2. #2
    Member
    Join Date
    Feb 2006
    Posts
    77
    Since Flash can invoke javascript.You can add actionscript to your button to invoke the javascript function to submit your form

    <script language="javascript">
    var myForm=getElementById("youformID");
    myForm.submit() ;
    </script>

    Sorry friend I've never tried this before but I know the way to do.You can find tut about Flash and javascript in the tutorial section

  3. #3
    Junior Member scudsucker's Avatar
    Join Date
    Feb 2003
    Location
    Cape Town, RSA
    Posts
    1,509
    To call Khoma's method from flash, it needs light rewriting:
    Code:
    var fSubmit=function(){
    var myForm=getElementById("youformID");
    myForm.submit() ;
    }
    in flash:
    code:

    on(release) {
    getURL("javascript:fSubmit();");
    }

    Hariyemadzisawira nhaka yedu! Down the SCUD and win!
    I'm too lazy to read Private Messages.

  4. #4
    Confounded Flash User
    Join Date
    Apr 2001
    Location
    Chicago
    Posts
    39
    Ok, seems I'm putting the actionscript in the wrong place. I just put it in a layer on its own in the scene. I got this error:

    **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 1: Mouse events are permitted only for button instances
    on(release) {

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Clip events are permitted only for movie clip instances
    onClipEvent (mouseUp) {

    Total ActionScript Errors: 2 Reported Errors: 2

    My button is a symbol - where do I actually put this script so it will work?

    Thanks for the help.

    Tom

  5. #5
    -_-
    Join Date
    Oct 2005
    Location
    US
    Posts
    1,694
    You have to put it on the button symbol it self. Th code On Release means that when you release the button, it does blah,blah,blah.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center