flash menu met xml gebruiken voor frames

Status
Niet open voor verdere reacties.

kerse

Nieuwe gebruiker
Lid geworden
13 dec 2006
Berichten
4
Heey hallo,

Ik zou mezelf geen noop meer willen noemen in flash en andere webdesign dingen, maar hier kom ik toch echt niet uit.

Ik heb een flash menu gevonden, wat gestuurd wordt door een xml bestand. In het xml kon ik de namen aanpassen zodat het mijn persoonlijke menu werd. Toen heb ik in het flash document het menu gestyld naar mijn wensen.
Toen dacht, nu hoef ik het alleen nog maar ff te linken naar frame 2,3,4 etc. Want normaal regel ik het altijd zo met onpress, go to frame ...

Nu wil ik dus linken naar frames en niet naar een url.
Dit zal in mijn xml bestand aangepast moeten worden, maar ik heb geen idee hoe.
Wie kan mij helpen..??
Alvast eeeeeeeeerg bedankt..

Edwin

PS: Dit is de inhoud van het xml bestand..:

PHP:
<?xml version="1.0" encoding="iso-8859-1"?>
<items name="racine" >
		<item name="Home" adr="" targ="_blank" >
	</item>

<item name="Biografie" adr="" targ="_blank" >
	</item>

<item name="Vrije tijd" >
		<item name="Sport" adr="" targ="_blank" >
			
		</item>
		<item name="Uitgaan" adr="" targ="_blank" >

		</item>
		<item name="Computeren" adr="" targ="_blank" >

		</item>
		<item name="Vrienden" >

		</item>
	</item>
	<item name="CV" >
		<item name="Krantenwijk" adr="" targ="_blank" >
		
		</item>
		<item name="Studenttalent" adr="" targ="_blank" >
	
		</item>	
	</item>

	<item name="Nieuws" adr="" targ="_blank" >
		
	</item>
	<item name="Familie" adr="" targ="_blank" >

	</item>
	<item name="Kennis" adr="" targ="_blank" >

	</item>
	<item name="Contact" adr="" targ="_blank" >
	
	</item>	
	</item>
</items>

En dit is het script wat in flash staat:

PHP:
// format van de text qua font en grootte
this.unDeployedFormat = new TextFormat();
this.unDeployedFormat.font = "Verdana";
this.unDeployedFormat.size = 12;
this.unDeployedFormat.bold = false;
this.unDeployedFormat.color = 0x000000;
// format van de text qua dont en grootte hoofditem
this.deployedFormat = new TextFormat();
this.deployedFormat.font = "Verdana";
this.deployedFormat.size = 12;
this.deployedFormat.bold = true;
this.deployedFormat.color = 0xFFFFFF;
// Object item
function Item(name, parent, pos, page, trgt) {
	// Naam van menu
	this.name = name;
	this.deployed = false;
	// URL van knop
	this.page = page;
	// target van link
	this.trgt = trgt;
	// subitems?
	this.arSubItems = new Array();
	if (typeof parent == 'object') {
		this.parent = parent;
		this.root = this.parent.root;
		this.level = parent.level + 1;
		this.id = parent.id + "_" + pos;
	} else if (typeof parent == 'movieclip') {
		this.parent = parent;
		this.root = this;
		this.level = 0;
		this.id = "0";
	}
	// positie van het item
	if (pos != undefined) {
		this.pos = pos;
	} else {
		this.pos = null;
	}
	//knop krijgt een unieke diepte
	this.getDepth = function() {
		if (this.level > 0) {
			return (this.pos + 1) * Math.pow(10, this.level) + this.parent.getDepth();
		} else {
			return 0;
		}
	};
	this.addSubItem = function(name, page, trgt) {
		var newLg = this.arSubItems.push(new Item(name, this, this.arSubItems.length, page, trgt));
		return this.arSubItems[newLg - 1];
	};
	// laat het item zien
	this.display = function() {
		if (this.level > 0) {
			// creeer het item en de diepte erbij
			this.root.parent.createEmptyMovieClip("item_" + this.id, 100 + Number(this.getDepth()));
			this.clip = this.root.parent["item_" + this.id];
			this.clip._visible = false;
			this.clip._x = 0;
			this.clip._y = this.root.parent.viewHeight + 20;
			// item wordt geasocieerd met this
			this.clip.item = this;
			//dit script zorgt voor de elasticiteit
			this.clip.elasticTo = function(y) {
				this.backy = y;
				this.onEnterFrame = function() {
					this.speedy = Number(this.speedy * this.item.root.parent.ralenti) + Number((this.backy - this._y) * this.item.root.parent.cool);
					if (this.item.root.parent.viewHeight != null) {
						this._visible = (this._y < this.item.root.parent.viewHeight - this.item.root.parent.itemSpacing);
					}
					this._y += Number(this.speedy);
					if (Math.abs(this.speedy) < 0.1) {
						this._y = this.backy;
						this.onEnterFrame = null;
					}
				};
			};
			this.clip.createEmptyMovieClip("bg", 1);
			this.clip.bg.beginFill(this.root.parent.itemColor, this.root.parent.itemAlpha);
			this.clip.bg.moveTo(0, 0);
			this.clip.bg.lineTo(this.root.parent.viewWidth, 0);
			this.clip.bg.lineTo(this.root.parent.viewWidth, 20);
			this.clip.bg.lineTo(0, 20);
			this.clip.bg.endFill();
			// text veld creeren
			this.clip.createTextField("labelZone", 2, 5 + 15 * this.level, 0, this.root.parent.viewWidth - (5 + 15 * this.level), 20);
			// initialiseren van parameter van het zojuist gemaakt textveld
			this.clip.label = this.name;
			this.clip.labelZone.selectable = false;
			this.clip.labelZone.variable = "label";
			this.clip.labelZone.setTextFormat(this.root.parent.unDeployedFormat);
			var btParams = new Object();
			btParams._alpha = 0;
			this.clip.bg.duplicateMovieClip("bt", 6, btParams);
			this.clip.bt._width = this.root.parent.viewWidth;
			this.clip.bt._height = 20;
			this.clip.bt.enabled = true;
			// acties voor de knop van het item
			if (this.arSubItems.length == 0) {
				if (this.page != undefined && this.page != null) {
					if (this.trgt == undefined || this.trgt == null) {
						this.clip.bt.onRelease = function() {
							getURL(this._parent.item.page);
						};
					} else {
						this.clip.bt.onRelease = function() {
							getURL(this._parent.item.page, this._parent.item.trgt);
						};
					}
				}
			} else {
				this.clip.bt.onRelease = function() {
					this._parent.item.switchStatus();
				};
			}
		}
		// Laat alle items zijn + subitems
		for (var i = 0; i < this.arSubItems.length; i++) {
			this.arSubItems[i].display();
		}
	};
	// methode voor het laten zijn van de subitems
	this.unDeploy = function() {
		// aanvang
		if (this.deployed) {
			for (var i = 0; i < this.arSubItems.length; i++) {
				// 
				this.arSubItems[i].unDeploy();
				this.arSubItems[i].clip.elasticTo(this.root.parent.viewHeight + 20);
			}
			this.clip.stClip.gotoAndPlay("undeployed");
			// style voor de textformaat
			this.clip.labelZone.setTextFormat(unDeployedFormat);
			this.deployed = false;
			this.moveAfter(-1 * this.arSubItems.length);
		}
	};
	this.unDeployExcept = function() {
		if (this.level > 0) {
			for (var i = 0; i < this.parent.arSubItems.length; i++) {
				if (i != this.pos) {
					this.parent.arSubItems[i].unDeploy();
				}
				this.parent.unDeployExcept();
			}
		}
	};
	this.deploy = function() {
		if (!this.deployed) {
			var supPos = 0;
			//items op juiste volgorde zetten
			this.moveAfter(this.arSubItems.length);
			this.unDeployExcept();
			// bereken de positie van het subitem
			// namelijk het hoofditem + 1 sub
			if (this.level > 0) {
				supPos = this.clip.backy + this.root.parent.itemSpacing;
			}
			for (var i = 0; i < this.arSubItems.length; i++) {
				this.arSubItems[i].clip.elasticTo(supPos + i * this.root.parent.itemSpacing);
			}
			this.clip.labelZone.setTextFormat(this.root.parent.deployedFormat);
			this.deployed = true;
		}
	};
	//methode voor het rangschikken van de items
	this.moveAfter = function(nb) {
		// hoofditems eerst
		if (this.level > 0) {
			// 1pixel verschil met volgende
			for (var i = this.pos + 1; i < this.parent.arSubItems.length; i++) {
				this.parent.arSubItems[i].clip.elasticTo(this.parent.arSubItems[i].clip.backy + nb * this.root.parent.itemSpacing);
			}
			this.parent.moveAfter(nb);
		}
	};
	this.switchStatus = function() {
		if (this.deployed) {
			this.unDeploy();
		} else {
			this.deploy();
		}
	};
}
// nieuw menu
menu = new Item("Menu", this);
// laden van XML bestand
var myMenu = new XML();
// negeren van lege plekken
myMenu.ignoreWhite = true;
// gebruik van unicode
System.usecodepage = !this.unicode;
myMenu.itemObject = menu;
// functie die wordt uitgevoerd, nadat de XML wordt geladen
myMenu.onLoad = function(succes) {
	// We zoeken naar menu items (<items> ... </items>) 
	this.setXMLMenu(this.firstChild, this.itemObject);
	// Beginnen met behangen
	this.itemObject.display();
	this.itemObject.deploy();
};
XML.prototype.setXMLMenu = function(xmlObject, menuObject) {
	for (var i = 0; i < xmlObject.childNodes.length; i++) {
		var curItem = xmlObject.childNodes[i];
		var itName = curItem.attributes.name;
		var itUrl = curItem.attributes.adr;
		var itTarget = curItem.attributes.targ;
		if (itUrl == undefined) {
			var curSubMenu = menuObject.addSubItem(itName);
			this.setXMLMenu(curItem, curSubMenu);
		} else {
			menuObject.addSubItem(itName, itUrl, itTarget);
		}
	}
};
// het laden van xml
myMenu.load(this.xmlFile);



[Moderator-Edit] Php-code-tags geplaatst. [/Edit]
 
Laatst bewerkt door een moderator:
hey

ik gebruik hetzelfde flashmenu dat gestuurd wordt met een xml bestand en wil ook linken naar frames i.p.v. naar een url.

Heb jij de oplossing hiervoor gekregen of gevonden?

Kan jij me hiermee helpen a.u.b. of me in de goede richting aansturen?

Alvast bedankt.

Mvg,

mario.
 
nee helaas

mariob, ik heb helaas nooit een antwoord of een oplossing gevonden..

laat het me weten als jij erachter komt..!!
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan