|
From: jclegs on 14 Apr 2008 10:05 Hi I'm trying to create a photo album in director and am having a problem finding a way to let users import pictures into the movie. I would like the user to click an add button and a browse window open to allow them to select the picture and then add it to an album possibly by using an array to store it. Have searched Google for an answer but have not found anything similiar to my problem. Thanks
From: Mike Blaustein on 14 Apr 2008 10:23 As far as getting the dialog box to choose the file, you could use an xtra like BuddyAPI www.mods.com.au/budapi It has a command baGetFilename() that will give you the dialog box and let the user choose a file. Once you have the filename that you want, you can make a new #bitmap member and set the filename of it to the new one. If you want the file to be imported into the cast instead of linked, you would then make another bitmap and copy the image of the linked one into it. Here is the basics. You will need to adjust things to work however you want them to. You may want to copy the .image into another member. on getNewImage newFile= baGetFilename( "open", the moviePath, "", "", 0, "Choose a file", false, -1, -1 ) importedFile=new(#bitmap) importedFile.filename=newFile localFile=new(#bitmap) localFile.image=importedFile.image localFile.name=importedFile.name importedFile.erase() end --- There are other xtras that can do it as well. DirectImage may be easier with it's imageLoadFromFile() and imageSaveToMember() methods. www.directXtras.com
From: jclegs on 14 Apr 2008 18:25 Thanks for the reply much appreciated. The only way to do this is to add in an xtra to director there is no built-in method?
From: Sean Wilson on 14 Apr 2008 18:41 There is no "built-in" method, though you can use the FileIO xtra and its displayOpen() method, though Buddy API offers far more control.
From: Lukewig on 14 Apr 2008 20:00
Hi FileIO Xtra is practically 'built in'. You can use it to get a filePath like this: filePath =(xtra("FileIO").new()).DisplaySave("Save", "foo.txt") -- Luke |