Skip to main content
Known Participant
February 11, 2013
Question

Using TWO loaders for ONE Tree Menu

  • February 11, 2013
  • 1 reply
  • 346 views

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,this);
  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;
}
}

This topic has been closed for replies.

1 reply

Inspiring
February 11, 2013

Have a look at the Loader class

It expects only one argument (the URL you want to load) while you are feeding it 6

If you want to position it you have to do that via loader.x/loader.y

It syntax differs from the non-canonical Print2flashLoader you are using for the other loaded items