User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Existing Scripts section within the Web Development category of DaniWeb, a massive community of 427,809 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,853 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Existing Scripts advertiser: Web Code Converter
Views: 1521 | Replies: 0
Join Date: Apr 2007
Posts: 1
Reputation: samm0r is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
samm0r samm0r is offline Offline
Newbie Poster

XML Menu Help - Delaying modules?

  #1  
Apr 25th, 2007
Hi there, I'm really new to actionscript, but I've managed to put together a flash xml menu. What I know want to do is delay the loading of each item so that the menu loads in a nice 1 at a time fashion. Can anyone help me with this? I'm pretty desperate!

This is the menu as it is:

MovieClip.prototype.Increment = function(maxAlpha, speed) {
this.onEnterFrame = function() {
this._alpha += speed;
if (this._alpha>=maxAlpha) {
this._alpha = maxAlpha;
delete this.onEnterFrame;
}
};
};
GenerateMenu = function(container, name, x, y, depth, node_xml) {
 var curr_node;
 var curr_item;
 var curr_menu = container.createEmptyMovieClip(name, depth);
 for (var i=0; i<node_xml.childNodes.length; i++) {
  curr_item = curr_menu.attachMovie("menuitem","item"+i+"_mc", i);
  
  curr_item._y = y + i*curr_item._height;
  curr_item._x = x;
  curr_item.trackAsMenu = true;
  
     with (curr_item) {
         _alpha = 0;
          Increment(2000, 20);
       } 
  
 

  
  
  
  
  

  curr_node = node_xml.childNodes[i];
  curr_item.action = curr_node.attributes.action;
  curr_item.variables = curr_node.attributes.variables;
  curr_item.name.text = curr_node.attributes.name;
  
  if (node_xml.childNodes[i].nodeName == "menu"){
   curr_item.node_xml = curr_node;
   curr_item.onRollOver = curr_item.onDragOver = function(){
    var x = this._x + this._width + 3;
    var y = this._y + 0;
    GenerateMenu(curr_menu, "submenu_mc", x, y, 1000000, this.node_xml);
    
    var col = new Color(this.background);
    col.setRGB(000000);
    
   };
  }else{ 
   curr_item.arrow._visible = false;
   
   curr_item.onRollOver = curr_item.onDragOver = function(){
    curr_menu.submenu_mc.removeMovieClip();
    
    var col = new Color(this.background);
    col.setRGB(000000);
    
    
    
   };
  }
  
  curr_item.onRollOut = curr_item.onDragOut = function(){
   
   var col = new Color(this.background);
   col.setTransform({ra:100,rb:0,ga:100,gb:0,ba:100,bb:0});
  };
  
  curr_item.onRelease = function(){
   Actions[this.action](this.variables);
   CloseSubmenus();
  };
 } 
};
   
CreateMainMenu = function(x, y, depth, menu_xml){
 
 GenerateMenu(this, "mainmenu_mc", x, y, depth, menu_xml.firstChild);
 
 mainmenu_mc.onMouseUp = function(){
  if (mainmenu_mc.submenu_mc && !mainmenu_mc.hitTest(_root._xmouse, _root._ymouse, true)){
   CloseSubmenus();
  }
 };
};
CloseSubmenus = function(){
 mainmenu_mc.submenu_mc.removeMovieClip();
};
Actions = Object();
Actions.loadMov = function(loadVar){
 loadMovie(loadVar, "Loader");
 menu_xml.load("menu3.xml");
};
Actions.unloadMov = function(urlVar){
 unloadMovie("Loader");
};
Actions.message = function(msg){
 message_txt.text = msg;
};
Actions.newMenu = function(menuxml){
 menu_xml.load(menuxml);
};
menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function(ok){
 
 if (ok){
  CreateMainMenu(10, 10, 1, this);
  
 }else{
  
 }
};
menu_xml.load("menu1.xml");

Am I right in thinking I need to create a setinterval function perhaps where the loop begins? If so how would I implement.

Any thoughts and solutions on this problem will be greatly appreciated!

Many thanks
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Existing Scripts Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Existing Scripts Forum

All times are GMT -4. The time now is 2:25 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC