dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: COMBO BOX

  1. #1
    Junior Member
    Join Date
    Feb 2001
    Posts
    3

    Post

    Can anyone point me in the right direction on how to use a combo box to load MC's or to "goto" a particualr scene within a swf? or even call an outside swf to load? I would like to have the combo box as a "quick link" feature, but keep getting stumped with the action scripting...

    http://www.redjetdesign.com/highwoods/

    that's where is file is that I am working on, nevermind the homepage (I only use it really to test files) I haven't even considered building my own, I work for a commerical real estate brokereage that bombards me with flash projects like this one at the URL above, 2 - 3x or more a week. Any input. Thanks!

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Posts
    687
    Here's some info. Basically what you want to do is change around the on Change Handler. This is fairly straight forward - you set the change handler when you add the items, then you also set a function that handles what the flash movie does when someone selects an item. In your case - you would have the 'Data' element as a frame or MC location - then have the changeHandler function do something (gotoAndPlay) at that part.

    Here's the example:

    http://www.flash-db.com/DropDown/

    The download has the fla and code. This is only an example of hooking a Flash MX component up to an external datasource (really easy), the example their is using the PHP array method - but the Text file, and Database example is also included (all basically the same - and all you'll have to change is the path to the file in the Flash movie to switch between them).

    If you hit the 'View Source' button - it shows the current code being used. Their is also an example of using a simple text file - or a more complex Database recordset as the datasource (they are all basically the same couple lines of code though).

    For a more complicated example and download of using a combo/Drop down menu - try this:
    http://www.flash-db.com/Poll/

    The Flash part of this is really easy (download it and open it up) - it basically uses 2 functions:

    function AddItems() {
    for (i=0; i<NumItems; i++) {
    var Name = eval("Name"+i);
    var DataRow = eval("DataRow"+i);
    dropDown.addItem(Name, DataRow);
    }
    //Set ChangeHandler
    dropDown.setChangeHandler("SelectItem");
    }

    function SelectItem(){
    Namebox = dropDown.getSelectedItem().label;
    Databox = dropDown.getSelectedItem().data;
    }

    (for your example you would have something like this for the ChangeHandler function:
    function SelectItem(){
    Frame = dropDown.getSelectedItem().data;
    _root.MC.gotoAndStop(Frame);
    }

  3. #3
    Junior Member
    Join Date
    Feb 2001
    Posts
    3

    Thanks....

    Thanks alot man, this should clear it up. I have a hard with some of the acion scripting, but I think the fog has lifted! Thanks for the link to, that flash-db site looks like its loaded with info that may be of use....

  4. #4
    Senior Member
    Join Date
    Jun 2000
    Posts
    687
    Yeah no problem.

    I was going to try to write up a tutorial for it, For Flashkit, which should go into quite a bit more detail. That little trick in their with the eval statement in the main function is actually really useful for this kind of stuff - and you can add external data sources to just about any of the components with it. - with just a tiny bit of modification you could have a complete catalogue system for example (2 drop down menu's, dependent on each other and the database, and some text field's with a loaded jpeg).




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