Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 09-02-2005, 23:13   #1 (permalink)
Neuer User
 
Benutzerbild von whereisnero
 
Registriert seit: Jul 2003
Beiträge: 31
Question XML Menue anpassen (preloader)

Hi ich versuche seit geraumer zeit ein XML-Menu anzupassen.
Ich habe folgendes Problem:

Das ist der teil in dem Script um dem es geht:
Code:
onClipEvent(load){

// ||||||||||||||||||||||||||||||||||||||||||||||||||
// || Menu Properties ---------------------------- ||
// ||||||||||||||||||||||||||||||||||||||||||||||||||

// space between top level menu items
var menuSpacer = 2;
// space between sub menu elements
var subSpacer = 1;
// the speed the menu items animate. a higher value equals a slower speed
var menuSpeed = 2;
// when a menu item is within this value of it's target postion, the animation will be stopped
var menuTolerance = 1;
// the time in milliseconds that the sub menus opening animations are staggered
var subDelay = 100;

// -- Execute Action -------------------------------

function executeAction(arg){
	
// externe dateien werden geladen: _root.content.loadMovie(arg);

_root.content.loadMovie(arg); 
	 
}

// DO NOT EDIT BELOW THIS LINE (unless you know what your doing)
// ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

// contains the string of the current sub menu or null if no sub menu is open
var curItem = null;
// pointer to the menu object structure
var menuObj = _parent.menuObj;
// enterframe assignment variable
var onenterframe = null;

// ||||||||||||||||||||||||||||||||||||||||||||||||||
// || On Load Actions ---------------------------- ||
// ||||||||||||||||||||||||||||||||||||||||||||||||||

// -- Build top level menu -------------------------

d = 0;
for(i in menuObj){
	// attach menu item
	this.attachMovie('item',i,d);
	k = this[i];
	// position menu item
	k._x = 0;
	k._y = (k._height+menuSpacer)*d;
	// set the properties of the menu item
	k.name = menuObj[i].name;
	k.arg = menuObj[i].arg;
	k.sub = menuObj[i].sub;
	k.basey = k._y;
	// hide icon if there is no sub menu for this menu item
	if(k.sub == false){
		k.icon._visible = false;
	}
	d++;
}

// ||||||||||||||||||||||||||||||||||||||||||||||||||
// || Runtime Functions -------------------------- ||
// ||||||||||||||||||||||||||||||||||||||||||||||||||

// -- Top level menu function -----------------------

// selectItem() is called when a top level menu item is released
// this function will either toggle a sub menu or execute an action

function selectItem(item){
	if(this[item].arg != null && curItem != item){ // if an action is specified and this menu item isn't active
		// execute a top level action action
		executeAction(this[item].arg);
	}
	if(this[item].sub == false || curItem == item){
		// remove current sub menu
		curItem = null;
		removeSub();
	}else{
		// build selected sub menu
		curItem = item;
		buildSub(item);
	}
}

// -- Build sub level menu --------------------------

function buildSub(item){
	var i, s, j, d=0;
	// attach container for the sub menu
	this.attachMovie('subholder','subholder',100);
	var k = this.subholder;
	
	// build sub menu
	for(i in menuObj[item]){
		if(typeof( menuObj[item][i] ) == 'object'){
			k.attachMovie('sub',i,d);
			s = k[i];
			// set the properties of the sub menu element
			s.name = menuObj[item][i].name;
			s.arg = menuObj[item][i].arg;
			// position the sub menu element
			s._x = 0;
			s._y = (s._height+subSpacer)*d;
			d++;
		}
	}
	
	// move the sub menu into position below the selected menu item
	k._y = this[item].basey + this[item]._height + menuSpacer;

	// reposition the menu items to make space for the sub menu
	for(i in menuObj){
		j = this[i];
		// if this menu item is below the item selected...
		if(j._y > this[item]._y){
			// move below the sub menu
			j.target = j.basey + k._height + menuSpacer;
		}else{
			// else move to base _y position
			j.target = j.basey;
		}
	}
	onenterframe = menuAnimation;
}

// -- Delete sub level menu -------------------------

function removeSub(){
	// remove sub menu container clip
	this.subholder.removeMovieClip();
	// move menu items to their base _y position
	for(i in menuObj){
		this[i].target = this[i].basey;
	}
	onenterframe = menuAnimation;
}

// -- Animate top level menu items ------------------

function menuAnimation(){
	var i, j, k=true;
	for(i in menuObj){
		j = this[i];
		j._y += (j.target-j._y)/menuSpeed;
		if(Math.abs(j.target-j._y)>menuTolerance){
			k = false;
		}else{
			j._y = j.target;
		}
	}
	if(k){
		onenterframe = null;
		if(curItem != null){

			activateSub();
		}
	}
}

// -- Activate sub menu elements --------------------

function activateSub(){
	var d = 0;
	for(i in menuObj[curItem]){
		if(typeof( menuObj[curItem][i] ) == 'object'){
			// set properties to stagger the sub menu opening animations
			subholder[i].start = getTimer();
			subholder[i].delay = subDelay*d;
			subholder[i].gotoAndPlay(2);
			d++;
		}
	}
}

// ||||||||||||||||||||||||||||||||||||||||||||||||||
}

onClipEvent(enterFrame){
	onenterframe();
}
Um den roten Teil geht es.
Hier werden die externen Dateien "geladen"!

Nun habe ich folgendes Script was ich gerne einbauen bzw einfügen will:
http://www.tableau.com.au/tutorials/coverPreloader/

kann mir jemand vielleicht bei der einfügung helfen?

Gruß nero

Geändert von whereisnero (09-02-2005 um 23:14 Uhr)
whereisnero ist offline   Mit Zitat antworten
Alt 10-02-2005, 19:50   #2 (permalink)
Neuer User
 
Benutzerbild von whereisnero
 
Registriert seit: Jul 2003
Beiträge: 31
Question Verständnisprobleme

Hi, kann mir den keiner helfen?
Ich verstehe einfach nicht wie ich die funktion vom Preloader umbauen muß damit sie mit dem Menu zusammen arbeitet.
whereisnero ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 14:00 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele