-
var x:Number = 1; x /= 0;
load an image into the movie?
I'm trying to make a project that will take an image that the user loads into the movie and make it into puzzle pieces that can be put together.
I think I can figure out how to make the puzzle pieces and do all that stuff once the user chooses the image, but I can't figure out how to load an image file into the movie. Is it even possible?
I guess loading an image file from a website is probably the best way to go, but I'm not really sure.
Thanks
~Zippy Dee
Ted Newman
Last edited by ZippyDee; 06-19-2008 at 06:24 PM.
-
3DFA hobby scripter
You could use this php script to upload a picture and bring the filename to your swf file in variable: fname
PHP Code:
<div align="center"> <?php if($_POST["submit"] == "Upload"){ $max_byte_size = 200000; // 200 KB $allowed_types = "(jpg|jpeg)"; $path = "upload/"; mkdir($path); echo "try to upload file:".$_FILES["file"]["name"]; if(is_uploaded_file($_FILES["file"]["tmp_name"]) == false) {$err[] = "no file found to upload";} if(preg_match("/\.".$allowed_types."$/i", $_FILES["file"]["name"]) == false) {$err[] = "wrong file typ ( ".$_FILES["file"]["name"]." is not allowed)";} if($_FILES["file"]["size"] <= $max_byte_size == false) {$err[] = "file to big, max: ".($max_byte_size/1000)." KB";} if (file_exists($path.$_FILES["file"]["name"])) {$err[] = "file already exist";} if (!count($err)){ if(copy($_FILES["file"]["tmp_name"], $path.$_FILES["file"]["name"])) { $picture = $_FILES["file"]["name"]; echo "... done :)"; } else { echo "an error occured:"; echo "file can't be uploaded"; } } else { echo "some errors occured:"; echo "<ul><li>".implode("<li>",$err)."</ul>"; } } else { $picture = "picture that will be loaded if no picture is uploaded.jpg"; } ?> <form name="upload" enctype="multipart/form-data" method="post" action="<?php echo $PHP_SELF; ?>" > <input type="file" name="file" id="file"> <input type="submit" name="submit" id="submit" value="Upload"> </form> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="320" height="240" title="counter"> <param name="movie" value="file.swf?fname=<?php echo $path.$picture; ?>" /> <param name="quality" value="high" /> <embed src="file.swf?fname=<?php echo $path.$picture; ?>" width="320" height="240" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" flashvars="name=root"></embed> </object> </div>
-
var x:Number = 1; x /= 0;
I have no idea how to use php...
and how do i use the fname variable to insert the picture into the file?
Last edited by ZippyDee; 06-20-2008 at 07:07 PM.
-
3DFA hobby scripter
in flash you can use:
pic.loadMovie (fname);
to load your pictures
you can test the script here:
http://www.flash.lifestylepics.de/pic2flash/
is also possible to show a list of all uploaded files, or something like this.
Last edited by LewxX²; 06-21-2008 at 05:15 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|