A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: what's best for searchable database on CD?

  1. #1
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991

    what's best for searchable database on CD?

    Im making a product catalogue on CD and i need to be somehow make the items in the catalogue searcheable.. this would've been easy if i could use PHP and MySQL.. but it's a different ball game for CDs.

    this as you know is pretty darn hard with standalone CD presentations..

    so what's best to achieve this? XML? stand alone SQL database coupled with one of em 3rd party programs like SWF STudio and ZInc?

    i dont need any advanced searching.. just need to search by few categories only.. like Name, Product Type, PRice..

    please help..

    thanks

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    XML would be a natural fit, but the limiting factor will be how many items you need to search. That is, how big is your database. There will be a point where XML becomes unusable for this simply because of the size of the XML file you have to load and parse. I don't know what that point is, you'll have to determine it experimentally.

    I think you already have a copy of SWF Studio (at least the trial version) so the SWF Studio solution is a plugin for reading "catalogs", which are just tab delimited text files. The Catalog Plugin handles loading the catalog file and giving you methods to search and get results back. The searches are lightning fast because they happen in memory. No database required. Here's an example of the catalog plugin in use... http://www.northcode.com/v3/exampleitem.php?link=7.

    Other third party swf2exe tools (see list at the end of this post) offer local database solutions as well so you can use Access, MySQL, etc. One SWF Studio user/developer has also created a plugin for SWF Studio that talks to SQLite (a standalone SQL compatible database engine). You can find the SQLite Connector on his site.

    SWF Studio http://www.northcode.com
    Zinc http://www.multidmedia.com
    mProjector http://www.screentime.com
    SWFKit http://www.swfkit.com
    SWiSH Studio http://www.swishzone.com
    Jugglor http://www.jugglor.com

  3. #3
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991
    hi north. thanks for that enlightening reply.. i will check up on stand alone sql stuffs..however i just thought about compatibility with other OS's.. and i think it'll just complicate things more..

    regarding the XML option.. lets say i have 500 products with short text data only for each such as name, brand, size, price, .. then for the long text data i'd have a separate file for each .. and just link to them via each product's ID.

    products.xml
    Code:
    <product id='1'>
       <name>Soap</name>
       <brand>NorthCode</brand>
       <price>$200</price>
       <size>L</size>
    </product>
    
    //and i'll have about 500-600 of these declared

    the text and the images will have filenames based on the ID that way i dont need to have the link in xml.. instead just standardize a method of doing things.

    so for product id=1 its other resources are..
    1.txt
    1a.jpg
    1b.jpg
    1c.jpg

    I also thought about doing the same method in PLAIN TEXT and just set variables and do delimitted style parsing..

    products.txt
    Code:
    Soap-x-NorthCode-x-$200-xx-
    Chainsaw-x-Gerbie-x-$866-xx-
    //...500-600 of the above entries
    i'd simply loadVars the txt file, split it using the delimiters and set them creating the variables s1, s2, s3, to s600 ...

    variable would be like this:
    s1=Soap-x-Northcode-x-$200


    then if i need to search anything i'd simply loop through do the following.

    Code:
    for(i=1;i<=numberOfProducts;i++){
      if(eval("s" + 1).indexOf(searchString) >= 0){
    	 //and if the searchString was found, parse/split it and add em to the list
      }
     }

    what do you guys think about this strategy?

  4. #4
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991
    PS
    Does MS Access database require anything out of the standard? and will it work in Mac? i'd be distributing this CD to hundreds of people and i'd hate to hear any of them come back and say it doesnt work on their computers

  5. #5
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    The LoadVars trick will work on Windows and Mac machines. There's also a neat LoadVars trick you can use to load data stored in whatever format you like. The example below shows how to load HTML into a LoadVars object. The trick can be extended to let you load any type of data

    Code:
    foo = new LoadVars();
    foo.onLoad = function()	{ trace(foo.$pureloadvars); }
    foo.load("http://www.weather.com");
    
    LoadVars.prototype.decode = function(str) 
    {
    	
    	this.$pureloadvars = str;
    	var path = this.$pureloadvars;
    	path = path.split("&");
    
    	for (var i = 0; i<path.length; i++) {
    		path[i] = path[i].split("=");
    		this[path[i][0]] = {};
    		this[path[i][0]] = path[i][1];
    	}
    
    };

  6. #6
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991
    though answers my questions partially thanks for the example.. but more imporantly, regarding the search technique im trying to do here. can you "forsee" any major problems and such??

  7. #7
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    As long as you don't have "&" characters in the text you could store them like...

    s1=Soap-x-Northcode-x-$200&
    s2=Chainsaw-x-Gerbie-x-$866&
    etc.

    Then you can use loadVariables to load the entire chunk into variables directly without doing any splitting. That might speed up the load process.

    The only problems that you might run into then are:

    1. How many variables can you load this way & how much data? I don't know if Flash has any limits in this area.

    2. Using eval may slow things down, I'd fake up a pile of data to load and do some tests to make sure the search speed is going to be acceptable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center