A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] accessing combobox in child swf?

  1. #1
    Junior Member
    Join Date
    Jan 2007
    Posts
    2

    [F8] accessing combobox in child swf?

    I am loading a child swf into a Window component. The child swf contains textfield and combobox components. I am creating the window with a call to PopUpManager.createPopUp(...), whidh is in turn called from a menu in a menubar.

    For some reason, when the window loads, the other swf file is displayed perfectly, and I can edit text in the textfield components, but I cannot interact with the combobox components (they do not drop down). I suspect this is because the click event that would normally trigger the action of the combobox isn't making it to the child swf.

    I have posted the code for the main swf below:

    CODE STARTS:

    import mx.controls.Menu;
    import mx.controls.MenuBar;

    var main_mb:MenuBar;

    var file_menu:Menu = main_mb.addMenu("File");
    var prod_menu:Menu = main_mb.addMenu("Products");

    file_menu.addMenuItem({label:"Administative", instanceName:"f_admin"});
    file_menu.addMenuItem({label:"Exit", instanceName:"f_exit"});

    prod_menu.addMenuItem({label:"Add Products", instanceName:"p_addedit"});
    prod_menu.addMenuItem({label:"View Products", instanceName:"p_view"});

    function makeWin(hasClose:Boolean, Title:String, conPath:String,
    w:Number, h:Number, top:Number, left:Number)
    {
    //trace("in the makeWin function");
    var win = mx.managers.PopUpManager.createPopUp(this,mx.conta iners.Window, false);
    win.closeButton = hasClose;
    win.title=Title;
    win.contentPath=conPath;
    win.setSize(w, h);
    win.move(left, top);
    function click(evt)
    {
    evt.target.deletePopUp();
    }
    win.addEventListener("click", click);
    }

    //listen for menu events -
    var mbListener:Object = new Object();
    mbListener.change = function(evt_obj:Object)
    {
    var menuItem_obj:Object = evt_obj.menuItem;
    switch (menuItem_obj.attributes.instanceName)
    {
    case "f_admin":
    //trace("admin clicked");
    makeWin(true, "Administrative Tools", "", 550, 400, 100, 100);
    break;
    case "f_exit":
    //trace("exit clicked");

    break;
    case "p_addedit":
    //trace("addedit clicked");
    makeWin(true, "Add Products", "productadd.swf", 550, 400, 150, 150);
    break;
    case "p_view":
    //trace("view clicked");
    makeWin(true, "View Products", "", 550, 400, 200, 200);
    break;
    }
    };

    file_menu.addEventListener("change", mbListener);
    prod_menu.addEventListener("change", mbListener);

    CODE ENDS.

    There is currently no code in the child swf, but when I run the child swf, all controls function normally.

    Thanks in advance for any help or pointers you can provide.

  2. #2
    Junior Member
    Join Date
    Jan 2007
    Posts
    2
    ...sorry about the code formatting, by the way... it didn't take my tabs...

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