PDA

Volledige versie bekijken : Tekst uit XML naar voren laten komen bij een overlay


evilchocobeertje
%Europe/Berlin %459 %2008, 12:00
Ik heb fotoboek gemaakt in flash. Alle info staat in een XML pagina. ook de foto`s etc.
Hij staat op het moment online maar ik wil er nog iets aan aanpassen, misschien dat iemand me hier kan helpen want ik krijg het niet voor elkaar.

als je over de foto`s gaat komen ze naar voren, en worden ze wat groter. De bedoeling is dat als je er over heen gaat met je muis dat het tekstvlak wat ik aan heb gemaakt op een layer die op de achtergrond zit, naar voren komt en boven of onder de foto komt te staan.

kan iemand mij vertellen wat de code is om hem naar voren te halen en hoe ik de tekst kan positioneren?

Dit is mijn code tot nu toe:


function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
}

_root.aantalFotos = 6;
_root.iRows = 4;
_root.mHeight = 80;
_root.mWidth = 116;
_root.FrameX = 641;
_root.FrameY = 350;
_root.aFotos = new Array();
var myXML:XML = new XML();


/* XML */
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
var fotos = myXML.firstChild.childNodes;
for(var i=0;i<fotos.length;i++){
_root.aFotos[i] = new Array(
'http://www.tsapper.nl/' + fotos[i].firstChild.firstChild.nodeValue,
fotos[i].childNodes[1].firstChild.nodeValue,
fotos[i].childNodes[3].firstChild.nodeValue,
'http://www.tsapper.nl/' + fotos[i].childNodes[5].firstChild.nodeValue
);
}
initMe();
}
myXML.load("fotoxml.xml");


var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);

var mclListener:Object = new Object();
mclListener.onLoadInit = function(mcPhoto:MovieClip) {
mcPhoto.dHeight = 140;
mcPhoto.dWidth = 206;
mcPhoto._height = _root.mHeight;
mcPhoto._width = _root.mWidth;
mcPhoto._alpha = 100;
//trace(image_mcl.vartest);
mcPhoto.loadURL = _root.aFotos[mcPhoto._name.substr(7)][3];
//trace(mcPhoto.loadURL);
mcPhoto.myText = _root.aFotos[mcPhoto._name.substr(7)][2];
mcPhoto.Pos = new Array(mcPhoto._x,mcPhoto._y);
mcPhoto._rotation = randRange(-5,5);
//trace('LOAD ' + mcPhoto + " X: " + mcPhoto._x +" - Y: "+ mcPhoto._y);
mcPhoto.onRollOver = function () {
this.iFrames = 0;
this.swapDepths(1000);
moveDirection(this,100);
showText(this);
}
mcPhoto.onPress = function(){
getURL(this.loadURL);
}
mcPhoto.onRollOut = function () {
mcPhoto.onEnterFrame = null;
FadeOut(this);
}
}
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);

function initMe(){
_root.iCurFoto = 0;
for(i:Number=0;i<_root.iRows;i++){
var thisX = 0;
var thisY = (i*_root.mHeight);
for(j:Number=0;j<_root.aantalFotos;j++){
thisX = thisX + ((thisX) ? (_root.mWidth + randRange(-30,-15)) : randRange(20,30))
thisY = i * 70 + randRange(20,30);
var mcPhoto = _root.attachMovie("Photoframe","mcPhoto" + iCurFoto,getNextHighestDepth(),{_x:thisX,_y:thisY} );

image_mcl.loadClip(_root.aFotos[_root.iCurFoto][0], mcPhoto);
_root.iCurFoto++;
}
}
}



function showText(mcTarget:MovieClip){
mcTarget._x;
mcTarget._y;
var thisY = 0;
if (mcTarget._y < 200){
//LAAT TEXT BOVEN ZIEN
//this.PhotoText(this.getNextHighestDepth);
this.myTekst.onRollOver = function(){
this.swapDepths(_root.highest)
}
thisY = mcTarget._y
}
else
thisY = mcTarget._y + 200
//PhotoText._y = mcTarget._y;
PhotoText.text = mcTarget.myText
this.myTekst.onRollOver = function(){
this.swapDepths(_root.highest)
}
//this.PhotoText(this.getNextHighestDepth);
//LAAT TEXT ONDER ZIEN

}

function moveDirection(mcTarget:MovieClip,opacity){
mcTarget.aGo = new Array(_root.aDi[randRange(0,1)],_root.aDi[randRange(0,1)]);
if(mcTarget._x > (_root.FrameX - 202)){
mcTarget.aGo[0] = -3;
}
if(mcTarget._y > (_root.FrameY - 150)){
mcTarget.aGo[1] = -3;
}
if(mcTarget._x < 0){
mcTarget.aGo[0] = 5;
}
if(mcTarget._y < 0){
mcTarget.aGo[1] = 5;
}
mcTarget.onEnterFrame = function () {
this.iFrames += 1;
this._x = this._x + this.aGo[0];
this._y = this._y + this.aGo[1];
if (this._alpha<150)
this._alpha = this._alpha + 5;
if (this._height<140)
this._height = this._height + 4;
if (this._width<206)
this._width = this._width + 5.8;
if (this._rotation > 0 )
this._rotation = this._rotation - 1;
else if (this._rotation < 0 )
this._rotation = this._rotation + 1;
if (this.iFrames>4){
moveDirection(mcTarget);
this.iFrames = 0;
}
}
}
function FadeOut(mcTarget:MovieClip){
mcTarget.rotetateTo = randRange(-5,5);
mcTarget.onEnterFrame = function () {

if (this._alpha>100)
this._alpha = mcTarget._alpha - 5;
if (this._x!=this.Pos[0]){
this._x = this._x - ((this._x - this.Pos[0]) / 8);
}
if (this._y!=this.Pos[1]){
this._y = this._y - ((this._y - this.Pos[1]) / 8);
}
if (this._height>=_root.mHeight)
this._height = this._height - 4;
if (this._rotation > mcTarget.rotetateTo )
this._rotation = this._rotation - 1;
else if (this._rotation < mcTarget.rotetateTo )
this._rotation = this._rotation + 1;
if (this._width>=_root.mWidth)
this._width = this._width - 5.8;
if ((this._width<=root.mWidth) && (this._height<=_root.mHeight) && (this._alpha<50)
&& (((this._x - this.Pos[0]) / 8)<1)
&& (((this._y - this.Pos[1]) / 8)<1)
)
this.onEnterFrame = null;

}
}

MSLourens
%Europe/Berlin %661 %2008, 16:52
naar voren halen, dus de diepte veranderen, kan door middel van swapDepths(mc1, mc2) of als je de mx.managers.DepthManager hebt geimporteerd kan het ook met mc.setDepthTo(DepthManager.kTop/kBottom)

evilchocobeertje
%Europe/Berlin %461 %2008, 12:05
ik zal het eens gaan proberen bedankt voor de tip ^^