Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings
Accepted Solution

FileFilter still not working?



I remember from the previous SDK that a FileFilter didn't work when calling BrowseForOpen(). Is my code incorrect or does it still not work in the current SDK?



private function onAddClicked(event:MouseEvent):void{
	var fileDir:File = File.applicationDirectory;
	var comicFilter:FileFilter = new FileFilter("Comic books (*.cbz)", "*.cbz");
	var c:Array = fileDir.getDirectoryListing();
	for(var i:int = 0; i < c.length; i++){
		var file:File = c[i];
		fileDir.browseForOpen("Select Comic Files", [comicFilter]);
		fileDir.addEventListener(Event.COMPLETE, fileSelected);
		trace("Addition failed:	", error.message);



BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Posts: 153
Registered: ‎10-26-2010
My Device: Bold 9900
My Carrier: AT&T

Re: FileFilter still not working?



    Yes, it's still broken.  Just less broken than before.  It doesn't even follow their own guidelines.  I've given up on it for the time being and am using a custom one that JRab helped me create (he did all the hard work).



Accepted PlayBook Applications: Marmi-doos, BASIC, Run and Hide, SuperClip
Accepted OS4-7 SmartPhone App: KeepLightOn
Posts: 327
Registered: ‎12-13-2010
My Device: Bold 9900/Z10 Special Edition
My Carrier: Rogers

Re: FileFilter still not working?

[ Edited ]

Hey guys, I've managed to get fileFilter working with the following code (for Images):


fileLoad=new FileReference();
var swfTypeFilter:FileFilter = new FileFilter("SWF/JPG/PNG Files","*.jpeg; *.jpg;*.gif;*.png"); var allTypeFilter:FileFilter = new FileFilter("All Files (*.*)","*.*"); fileLoad.browse([swfTypeFilter, allTypeFilter]);

 Hope this works for you!

CEO/Lead Developer - Tensioncore™ Design Studios
http://tncr.ws/ - ShortenThis!™ for Blackberry Playbook | ShortenThis!™ for BlackBerry® 10
The Periodical Toe A highly informative Table of Elements
DrawThis! A fun drawing app for the BlackBerry® PlayBook™!
http://www.tensioncore.com/ - Tensioncore™ Web Hosting
Posts: 249
Registered: ‎11-02-2010
My Device: PlayBook
My Carrier: -

Re: FileFilter still not working?


  yes, the File.open stuff is still not working as expected. I keep having the empty result in tab "Documents".

I *think* (not sure) that only registered extensions on the PlayBook system itself are visible. (ex: images, pdf)

To quote myself: "Ca m'énerve !" Smiley Happy

So I'm back to the self-made file browser...


Posts: 185
Registered: ‎04-05-2011
My Device: PlayBook
My Carrier: Bouygues Telecom

Re: FileFilter still not working?

Yes @Acenet, this is also the behavior I observed, only registered extensions are working, in AIR for desktop it is possible to associate a filetype with an app, but unfortunately, this is not yet possible on the PlayBook, I didn't manage to register a file extension on it.

Web: smugrik.org Follow: @Smugrik
PlayBook apps: