-
1. Re: html to as3
kglad May 21, 2011 10:16 AM (in response to joshww)create an input textfield (eg, tf) for the file name and use:
submit.addEventListener(MouseEvent.CLICK,f);
function f(e:MouseEvent):void{
var urlLDR:URLLoader=new URLLoader();
var urlReq:URLRequest=new URLRequest();
var urlVar:URLVariables=new URLVariables();
urlVar.name=tf.text;
urlReq.url="upload_file.php";
urlReq.method="POST";
urlReq.data=urlVar;
urlLDR.load(urlReq);
}
-
2. Re: html to as3
Andrei1 May 21, 2011 10:16 AM (in response to joshww)AS3 has a very limited support for HTML tags. This support doesn't include form objects. So, the answer is "no".
-
-
-
5. Re: html to as3
Peter Blazejewicz May 21, 2011 3:03 PM (in response to joshww)Hi Josh,
there is no direct translation from html form input of type "file" into single line code in ActionScript. But the same feature is wrapped into flash.net.FileReference object:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference .html
- on user mouse click (required due to security restrictions in Flash runtime) create instance of FileReference
- call "browse" method to let user choose what file to upload
- if "browse" call returns true you could create upload URLRequest, set data (as in previous sample) and call upload(...) method
- wait for Event.COMPLETE to clear variables created for upload feature,
Similiary to HTML/JavaScript you won't have access to full path of selected file if movie is played within Flash runtime (security feature). If you require more information about file, its location, ect you would need to built AIR runtime based application.
do i make a broswe button?
yes, in Flash runtime you would require button action to be wired to start file upload - so you need e.g. Button with MouseEvent.CLICK wired to it to start entire process (unless I'm missing something changed in player )
regards,
Peter
-
6. Re: html to as3
kglad May 21, 2011 4:25 PM (in response to joshww)you'll need to use the filerefrence class if you want to open a browse-for-file system dialogue box so users can navigate to a file.




