A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Apr 2010
    Posts
    5

    Using two Loaders for one Tree Menu

    I am using a tree menu that I am loading in Print2Flash documents. There is one node on the menu I want to load a regular SWF file that will have links to animations. Because my loader is customized to load Print2Flash documents, is there a way to use a new loader to load a standard SWF on one of the Tree Menu Nodes?

    I tried to put in a new loader but so far no luck, I am getting 'Incorrect number of argument. Expected no more than 1' on the case line for the new loader.

    Code is below...my attempt to put in a new loader is bolded...any help?

    stop();
    import com.microwebber.tree.*;
    import Print2Flash.*
    import flash.display.Loader;
    import flash.events.Event;
    import flash.net.URLRequest;
    import fl.events.*;

    stage.align=StageAlign.TOP_LEFT

    mytree.setSize(315,417);
    var usingFolderIcons = false;
    function switchIcons(e){
    usingFolderIcons = !usingFolderIcons;
    mytree.setDefaultFolderStyle(usingFolderIcons);
    mytree.invalidate();

    }

    //mytree.setHorizontalPolicy(true,true);

    var dp:XML =
    <node>
    <node label="LS-15 Liner Hanger Packer Overview ">
    </node>
    <node label="Module Course Content ">
    <node label="Pre-Operational Procedures "/>
    <node label="Running Procedures: Quick Glance "/>
    <node label="Detailed Running Procedures "/>
    <node label="Post Operational Procedures "/>
    <node label="Animations "/>
    </node>
    <node label="Testing Your Knowledge of this Module ">
    </node>
    </node>;

    mytree.setRendererStyle("nodeIndent", 20);

    mytree.addXML(dp);

    btnClose2.addEventListener(MouseEvent.CLICK, bigborecontent);
    function bigborecontent(myevent:MouseEvent):void {
    MovieClip(parent.parent).removeF();
    }

    var P2FDocLoader:Print2FlashDoc3;

    mytree.addEventListener(ListEvent.ITEM_CLICK, handleClick);
    function handleClick (ev:ListEvent) : void {
    switch(ev.item.label) {
    case "LS-15 Liner Hanger Packer Overview ":
    P2FDocLoader=new Print2FlashDoc3("modules/overview.swf",375,115,575,550,this);
    break;
    case "Pre-Operational Procedures ":
    P2FDocLoader=new Print2FlashDoc3("modules/LSpreoperational.swf",375,115,575,550,this);
    break;
    case "Running Procedures: Quick Glance ":
    P2FDocLoader=new Print2FlashDoc3("modules/LSrunningproceduresquickglace.swf",375,115,575,550 ,this);
    break;
    case "Detailed Running Procedures ":
    P2FDocLoader=new Print2FlashDoc3("modules/LSrunningproceduresdetailed.swf",375,115,575,550,t his);
    break;
    case "Post Operational Procedures ":
    P2FDocLoader=new Print2FlashDoc3("modules/LSpostoperational.swf",375,115,575,550,this);
    break;
    case "Testing Your Knowledge of this Module ":
    P2FDocLoader=new Print2FlashDoc3("modules/testing.swf",375,115,575,550,this);
    break;
    }
    }

    var loader:Loader = new Loader();
    addChild(loader);

    mytree.addEventListener(ListEvent.ITEM_CLICK, handleClick1);
    function handleClick1 (ev:ListEvent) : void {
    switch(ev.item.label) {
    case "Animations ":
    loader.load(new URLRequest("modules/LSpostoperational.swf",375,115,575,550,this));
    break;
    }
    }

  2. #2
    Member
    Join Date
    Nov 2012
    Posts
    79
    Your error is due to the URLRequest. I believe that is is only expecting one argument... the URL

    When you put in the commas inside that method, Flash doesn't know what to do. Are those other numbers the height,width, and x y positions?

    if so you may need to handle this differently.
    loader.load(new URLRequest("../your/path/to/the/file.type"))
    loader.x=
    loader.y=
    etc.

    Hope that helps!

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