| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Are we there yet...
Join Date: Jan 2003
Location: USA
Posts: 201
|
I have an html page with both a flash movie and an html form included. Is there any possible way to automate pressing a button on the html form when the user clicks a button in the flash movie? Thanks!
__________________
God is Good. |
|
|
|
|
|
#2 |
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
|
Howdy...
![]() I know pretty much zippo about the HTML but here is an idea... When you create the HTML form, have the submit button execute some JavaScript function as you do with the form validation stuff, and remember what that JavaScript function name is... And, when you have to emulate the clicking on the button, maybe you could run that JavaScript function via getURL() call from the Flash???
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...
|
|
|
|
|
|
|
|
|
#3 |
|
Are we there yet...
Join Date: Jan 2003
Location: USA
Posts: 201
|
Sounds like that just might work. You mean have it setup something like this...
Code:
<SCRIPT language="JavaScript">
function submitform()
{
document.myform.submit();
}
</SCRIPT>
__________________
God is Good. |
|
|
|
|
|
#4 |
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
|
Hm... Sounds like I might actually have said something useful... Let me know how it goes and what the exact command was...
![]()
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...
|
|
|
|
|
|
#5 |
|
done
Join Date: Jun 2001
Location: portland, or
Posts: 8,048
|
what???!!! you mean to say that outta 8973+ posts, this is the first usefull thing you've said??? i'm gonna havfta add you to my ignore list now.
__________________
tg --- what the hell was i thinking? |
|
|
|
|
|
#6 |
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
|
Shhhhhh... That's supposed to be one of the secrets in the AS.org...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...
|
|
|
|
|
|
#7 |
|
Are we there yet...
Join Date: Jan 2003
Location: USA
Posts: 201
|
Ok, evidently I have to use a specific way to upload a file for security reasons. So now I am simply try to detect when the upload button has been pressed. There has to be a simple way to do this. I know when the button is pressed that it is given the value "Upload", so if I can check for this value somehow then I can do it. I found something about
Code:
If Request.Form("submit") = "Upload" then
Code:
<form method=POST action=do_upload.php enctype=multipart/form-data>
<p>Upload Picture:<br>
<input type=file name=img1 size=30><br>
<input type="submit" name="submit" value="Upload">
<p><font color=red>(This could take a couple minutes depending on the size of your picture)</font>
<input type=hidden name=VehicleID value="<?php echo $VehicleID ?>">
</form>
I guess I need to know how to refer to the button on the form so i can check for it's value.
If Request.Form("submit") = "Upload" then
echo "testing";
end if
__________________
God is Good. Last edited by holtzy; 05-13-2004 at 08:14 PM.. |
|
|
|
|
|
#8 |
|
Fried Onions
|
I've developed a WYSIWYG flash backend for a client's flash site, and what you're doing is possible certainly : )
Is this a file upload? If so, you're going to be restricted to internet explorer only. Mozilla/Netscape, and presumably other browsers (not tested) consider using the javascript element click() method to trigger an upload "Browse" button a security problem. Here's the script from that site: index.html: HTML Code:
<html> <head> <title>MyClient Admin</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <frameset cols="100%,0" frameborder="NO" border="0" framespacing="0"> <frame name="main" scrolling="AUTO" noresize src="flash.php"> <frame name="controller" scrolling="NO" noresize src="upload.php"> </frameset> <noframes><body bgcolor="#FFFFFF" text="#000000"> </body></noframes> </html> PHP Code:
PHP Code:
HTML Code:
<html> <head> <SCRIPT LANGUAGE=JavaScript> <!-- function upit(fld) { var upObj = eval("parent.controller.document.forms.upload."+fld); upObj.click() while(upObj.value == "") { setTimeout(100) } parent.controller.upControl() } function submitIt(){ parent.controller.document.upload.submit() } //--> </SCRIPT> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#0d155e"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="800" height="650" id="admin" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="admin.swf?<?php echo time(); ?>" /> <param name="quality" value="high" /> <param name="bgcolor" value="#0d155e" /> <embed src="admin.swf?<?php echo time(); ?>" quality="high" bgcolor="#0d155e" width="800" height="650" name="admin" align="middle" swliveconnect=true allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </embed> </object> </body> </html> A) nag them with the 're-post form data' confirmation B) re-post the form data! If you have any problems slimming that code down, or have problems with the flash side, let me know : ) I may be a while, I just got busy and I'm going to be away for the weekend, but that's the general idea! |
|
|
|
|
|
#9 |
|
Are we there yet...
Join Date: Jan 2003
Location: USA
Posts: 201
|
Thanks for the info and the sample code, but I'm afraid I can't limit myself to just IE. There has to be a way to detect simply when the button is pressed...doesn't there?
__________________
God is Good. |
|
|
|
|
|
#10 |
|
Fried Onions
|
you can submit the form in any browser, but you cannot click the 'browse' button. mozilla/netscape consider that a security issue so it isn't supported. I'm thinking of trying to write a div layer with document.write and have that div layer positioned on top of the flash file, then you can actually click the button, but I'm not sure the div layer will display over the flash object -- has anybody tried this?
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|