Problema al cargar swf con variables dentro de un Contenedor
Hola muy buenas, tengo un problema, que cargo un swf con variables dentro de un contenedor pero no me las lee, cada campo que tiene variables, me sale "undefined", lo ejecuto aparte y me las lee correctamente, no se porque puede ser si alguien me hecha una mano se lo agradezco, os paso el codigo para que lo veais, la peli tiene 5 fotogramas, os voy diciendo uno a uno:
________________________________________________
1º.
if (_root.getBytesTotal() == _root.getBytesLoaded()) {
gotoAndPlay(4);
}
2º.
byteloaded = _root.getBytesLoaded();
bytetotal = _root.getBytesTotal();
textlload = int(byteloaded/bytetotal*100)+"%";
3º.
if (_root.getBytesTotal()>_root.getBytesLoaded()) {
gotoAndPlay (2);
} else {
gotoAndPlay(4);
}
4º.
stop();
function getData(){
preloadingInterface._visible = true;
loadVariables(_root.domainURL+"notices.php", _root);
function checkParamsLoaded() {
if (_root.dataLoaded=="1") {
preloadingInterface._visible = false;
balls._visible = false;
_root.gotoAndStop(5);
clearInterval(param_interval);
}
}
var param_interval = setInterval(checkParamsLoaded, 100);
}
_root.domainURL = "";
_root.dataLoaded = "0";
getData();
5º.
function replacer(str,ch1,ch2){
var cuvinte = Array();
cuvinte = str.split(ch1);
str = cuvinte.join(ch2);
return str;
}
function setLoadPage() {
var i, j, itemsOnPage = 0;
clearInterval(smalleffectinterval);
clearInterval(_root.interval);
_root.bigPictureLoaded = undefined;
itemsOnPage = (_root.page<_root.totalpages _root.lbl_totalpictures for i _root true false j function loadsmallpage if _root.loader.onenterframe="function()" smalleffect :="">=_root["windowSmall"+i].image.getBytesTotal() && _root["windowSmall"+i].image.getBytesTotal()>0 && _root["windowSmall"+i].image._width>0) {
_root["windowSmall"+i].prel.prel.removeMovieClip();
_root["windowSmall"+i].image._width = 81;
_root["windowSmall"+i].image._height = 61;
_root["windowSmall"+i].image._x = 6;
_root["windowSmall"+i].image._y = 6;
_root["windowSmall"+i].image.val = i;
var smallcolorTransform:Object = {ra:100, rb:255, ga:100, gb:255, ba:100, bb:255, aa:100, ab:-255};
var smallcolor:Color = new Color(_root["windowSmall"+i].image);
smallcolor.setTransform(smallcolorTransform);
smallstep = 0;
smalleffectinterval = setInterval(smalleffect, 7);
_root["windowSmall"+i].image.onPress = function() {
putBigImage(this.val);
};
_root["windowSmall"+i].image.onRollOver = function() {
_root["windowSmall"+this.val].frame2._visible = true;
var colorTransform:Object = {ra:100, rb:-30, ga:100, gb:-30, ba:100, bb:-30, aa:100, ab:0};
var my_color:Color = new Color(_root["windowSmall"+this.val].image);
my_color.setTransform(colorTransform);
};
_root["windowSmall"+i].image.onRollOut = function() {
_root["windowSmall"+this.val].frame2._visible = false;
var colorTransform:Object = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};
var my_color:Color = new Color(_root["windowSmall"+this.val].image);
my_color.setTransform(colorTransform);
};
delete this.onEnterFrame;
}
};
}
} else {
clearInterval(_root.pageinterval);
if (_root.bigPictureLoaded == undefined) {
putBigImage(0);
}
}
}
function NextPage() {
hidePrevious(1);
if (_root.page == _root.totalpages-1) {
hideNext(0);
}
_root.page++;
if (pageinterval) {
clearInterval(pageinterval);
}
setLoadPage();
i = -1;
_root.pageinterval = setInterval(loadSmallPage, 50);
}
function PreviousPage() {
hideNext(1);
if (_root.page == 2) {
hidePrevious(0);
}
_root.page--;
putSmallPage();
if (pageinterval) {
clearInterval(pageinterval);
}
setLoadPage();
i = -1;
_root.pageinterval = setInterval(loadSmallPage, 50);
}
function hidePrevious(v) {
lblPrevious._visible = v;
btnPrevious._visible = v;
but_Previous.enabled = v;
}
function hideNext(v) {
lblNext._visible = v;
btnNext._visible = v;
but_Next.enabled = v;
}
function init() {
var objects = new Array(_root.lblPrevious, _root.lblNext, _root.lblGalleryMessage, _root.lblGalleryText, _root.lblTotalPictures, _root.lblImageTitle, _root.overBigPicture.lblDescription, _root.lblDate);
var objectsValues = new Array(_root.lbl_Previous, _root.lbl_Next, _root.lbl_GalleryMessage, _root.lbl_GalleryText, _root.lbl_TotalPictures, "", "", "");
_root.mainColor = "0x"+_root.mainColor;
_root.secondColor = "0x"+_root.secondColor;
_root.thirdColor = "0x"+_root.thirdColor;
_root.fourthColor = "0x"+_root.fourthColor;
var format = new TextFormat();
format.color = _root.mainColor;
var secondformat = new TextFormat();
secondformat.color = _root.secondColor;
for (x in objects) {
if (x != 4) {
objects[x].text = objectsValues[x];
} else {
objects[x].text = objectsValues[x]+" "+_root.lbl_Picture;
}
objects[x].setTextFormat(format);
}
var my_color = new Color(btnNext);
my_color.setRGB(_root.secondColor);
my_color = new Color(btnPrevious);
my_color.setRGB(_root.secondColor);
my_color = new Color(lblDate);
my_color.setRGB(_root.secondColor);
my_color = new Color(lblImageTitle);
my_color.setRGB(_root.secondColor);
//fill the windowBig with maincolor
windowBig.createEmptyMovieClip("bigImageBack", windowBig.getNextHighestDepth());
windowBig.createEmptyMovieClip("bigImage1", windowBig.getNextHighestDepth());
windowBig.createEmptyMovieClip("bigImage2", windowBig.getNextHighestDepth());
windowBig.createEmptyMovieClip("prel", windowBig.getNextHighestDepth());
windowBig.prel._x = windowBig._width/2;
windowBig.prel._y = windowBig._height/2;
windowBig.prel.attachMovie("prel", "prel", 1);
windowBig.prel._visible = false;
windowBig.bigImageBack.beginFill(_root.thirdColor);
windowBig.bigImageBack.moveTo(6, 6);
windowBig.bigImageBack.lineTo(361, 6);
windowBig.bigImageBack.lineTo(361, 281);
windowBig.bigImageBack.lineTo(6, 281);
windowBig.bigImageBack.lineTo(6, 6);
windowBig.bigImageBack.endFill();
windowBig.bigImageBack.swapDepths(windowBig.frame);
windowBig.bigImage1.swapDepths(windowBig.frame);
windowBig.bigImage2.swapDepths(windowBig.frame);
//check if number of picture is less than maxPictures
_root.page = 1;
_root.totalpages = Math.ceil(_root.lbl_TotalPictures/_root.maxPictures);
if (_root.totalpages == 1) {
hidePrevious(0);
hideNext(0);
} else {
hidePrevious(0);
}
_root.overBigPicture.lblDescription._visible = false;
_root.overBigPicture.gotoAndStop(1);
//create maxPictures places to load small images
function putSmall() {
if (i<parseint>_root.maxPictures ? _root.maxPictures : _root.lbl_TotalPictures)) {
duplicateMovieClip("windowSmall", "windowSmall"+i, _root.getNextHighestDepth());
_root["windowSmall"+i]._x = 20+(i%3)*(_root["windowSmall"+i]._width-1);
_root["windowSmall"+i]._y = 95+Math.floor(i/3)*(_root["windowSmall"+i]._height-2)+(i>maxPictures/2-1 ? 1 : 0);
_root["windowSmall"+i].createEmptyMovieClip("back", _root["windowSmall"+i].getNextHighestDepth());
_root["windowSmall"+i].createEmptyMovieClip("image", _root["windowSmall"+i].getNextHighestDepth());
_root["windowSmall"+i].createEmptyMovieClip("prel", _root["windowSmall"+i].getNextHighestDepth());
_root["windowSmall"+i].prel._x = _root["windowSmall"+i]._width/2;
_root["windowSmall"+i].prel._y = _root["windowSmall"+i]._height/2;
_root["windowSmall"+i].back.beginFill(_root.thirdColor);
_root["windowSmall"+i].back.moveTo(6, 6);
_root["windowSmall"+i].back.lineTo(87, 6);
_root["windowSmall"+i].back.lineTo(87, 67);
_root["windowSmall"+i].back.lineTo(6, 67);
_root["windowSmall"+i].back.lineTo(6, 6);
_root["windowSmall"+i].back.endFill();
_root["windowSmall"+i].back.swapDepths(_root["windowSmall"+i].frame);
_root["windowSmall"+i].image.swapDepths(_root["windowSmall"+i].frame);
i++;
} else {
clearInterval(pinterval);
i = -1;
_root.createEmptyMovieClip("loader", _root.getNextHighestDepth());
//create button for previous
lblPrevious.autoSize = "left";
_root.createEmptyMovieClip("but_Previous", _root.getNextHighestDepth());
but_Previous.beginFill(_root.mainColor, 0);
but_Previous.moveTo(btnPrevious._x, btnPrevious._y);
but_Previous.lineTo(btnPrevious._x+lblPrevious._width+btnPrevious._width, btnPrevious._y);
but_Previous.lineTo(btnPrevious._x+lblPrevious._width+btnPrevious._width, btnPrevious._y+lblPrevious._height);
but_Previous.lineTo(btnPrevious._x, btnPrevious._y+lblPrevious._height);
but_Previous.lineTo(btnPrevious._x, btnPrevious._y);
but_Previous.endFill();
but_Previous.onPress = function() {
PreviousPage();
};
but_Previous.onRollOver = function() {
_root.lblPrevious.setTextFormat(secondformat);
var my_color = new Color(btnPrevious);
my_color.setRGB(_root.mainColor);
};
but_Previous.onRollOut = function() {
_root.lblPrevious.setTextFormat(format);
var my_color = new Color(btnPrevious);
my_color.setRGB(_root.secondColor);
};
//create button for next
lblNext.autoSize = "right";
_root.createEmptyMovieClip("but_Next", _root.getNextHighestDepth());
but_Next.beginFill(_root.mainColor, 0);
but_Next.moveTo(lblNext._x, lblNext._y);
but_Next.lineTo(lblNext._x+lblNext._width+btnNext._width, lblNext._y);
but_Next.lineTo(lblNext._x+lblNext._width+btnNext._width, lblNext._y+lblNext._height);
but_Next.lineTo(lblNext._x, lblNext._y+lblNext._height);
but_Next.lineTo(lblNext._x, lblNext._y);
but_Next.endFill();
but_Next.onPress = function() {
NextPage();
};
but_Next.onRollOver = function() {
_root.lblNext.setTextFormat(secondformat);
var my_color = new Color(btnNext);
my_color.setRGB(_root.mainColor);
};
but_Next.onRollOut = function() {
_root.lblNext.setTextFormat(format);
var my_color = new Color(btnNext);
my_color.setRGB(_root.secondColor);
};
_root.interval = setInterval(loadSmall, 50);
}
}
function loadSmall() {
if (i<parseint>_root.maxPictures ? _root.maxPictures : _root.lbl_TotalPictures)-1) {
if (i == -1 || _root["windowSmall"+i].image.isLoaded != undefined) {
i++;
//_root["windowSmall"+i].image.loadMovie("images/"+_root["image"+i]+".jpg");
_root["windowSmall"+i].image.loadMovie(_root.domainURL+"bfm_smallimage.php?picture="+_root["image"+i]+".jpg&w=81&h=61");
_root["windowSmall"+i].prel.attachMovie("prel", "prel", _root["windowSmall"+i].getNextHighestDepth());
_root.loader.onEnterFrame = function() {
function smalleffect() {
if (smallstep=_root["windowSmall"+i].image.getBytesTotal() && _root["windowSmall"+i].image.getBytesTotal()>0 && _root["windowSmall"+i].image._width>0) {
_root["windowSmall"+i].prel.prel.removeMovieClip();
_root["windowSmall"+i].image._width = 81;
_root["windowSmall"+i].image._height = 61;
_root["windowSmall"+i].image._x = 6;
_root["windowSmall"+i].image._y = 6;
_root["windowSmall"+i].image.val = i;
var smallcolorTransform:Object = {ra:100, rb:255, ga:100, gb:255, ba:100, bb:255, aa:100, ab:-255};
var smallcolor:Color = new Color(_root["windowSmall"+i].image);
smallcolor.setTransform(smallcolorTransform);
smallstep = 0;
smalleffectinterval = setInterval(smalleffect, 7);
_root["windowSmall"+i].image.onPress = function() {
putBigImage(this.val);
};
_root["windowSmall"+i].image.onRollOver = function() {
_root["windowSmall"+this.val].frame2._visible = true;
var colorTransform:Object = {ra:100, rb:-30, ga:100, gb:-30, ba:100, bb:-30, aa:100, ab:0};
var my_color:Color = new Color(_root["windowSmall"+this.val].image);
my_color.setTransform(colorTransform);
};
_root["windowSmall"+i].image.onRollOut = function() {
_root["windowSmall"+this.val].frame2._visible = false;
var colorTransform:Object = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};
var my_color:Color = new Color(_root["windowSmall"+this.val].image);
my_color.setTransform(colorTransform);
};
delete this.onEnterFrame;
}
};
}
} else {
clearInterval(_root.interval);
if (_root.bigPictureLoaded == undefined) {
putBigImage(0);
}
}
}
var i = 0;
var pinterval = setInterval(putSmall, 70);
}
function putBigImage(x) {
if (_root.bigPictureLoaded != x) {
if (effectinterval) {
clearInterval(effectinterval);
}
_root.bigPictureLoaded = x;
thisBigImage = 1+thisBigImage%2;
_root.windowBig["bigImage"+thisBigImage].swapDepths(_root.windowBig.bigImage2);
_root.windowBig["bigImage"+thisBigImage].swapDepths(_root.windowBig.bigImage1);
_root.windowBig.prel.prel.loadText.text = '';
_root.windowBig.prel.prel.white._alpha = 100;
dots = '';
_root.windowBig.prel._visible = true;
lblDate.text = "Date: "+_root["imageData"+((_root.page-1)*_root.maxPictures+x)];
lblImageTitle.text = _root["imageTitle"+((_root.page-1)*_root.maxPictures+x)];
// getURL("javascript:window.status='"+_root["imageDescription"+((_root.page-1)*_root.maxPictures+x)]+"'");
_root["imageDescription"+((_root.page-1)*_root.maxPictures+x)] = replacer(_root["imageDescription"+((_root.page-1)*_root.maxPictures+x)],"<br>","\n");
_root["imageDescription"+((_root.page-1)*_root.maxPictures+x)] = replacer(_root["imageDescription"+((_root.page-1)*_root.maxPictures+x)],"\\","");
if (_root["imageDescription"+((_root.page-1)*_root.maxPictures+x)].length>0){
overBigPicture.lblDescription.text = _root["imageDescription"+((_root.page-1)*_root.maxPictures+x)];
} else {
overBigPicture.lblDescription.text = _root["lbl_txDescrs"];
}
var format4 = new TextFormat();
format4.color = _root.fourthColor;
overBigPicture.lblDescription.setTextFormat(format4);
_root.windowBig["bigImage"+thisBigImage].loadMovie(_root.domainURL+"images/"+_root["image"+((_root.page-1)*_root.maxPictures+x)]+".jpg");
//_root.windowBig.bigImage.loadMovie("images/"+_root["image"+((_root.page-1)*_root.maxPictures+x)]+".jpg");
_root.windowBig.onEnterFrame = function() {
function effect() {
if (step=_root.windowBig["bigImage"+thisBigImage].getBytesTotal() && _root.windowBig["bigImage"+thisBigImage].getBytesTotal()>0 && _root.windowBig["bigImage"+thisBigImage]._width>0) {
var colorTransform:Object = {ra:100, rb:255, ga:100, gb:255, ba:100, bb:255, aa:100, ab:-255};
var my_color:Color = new Color(_root.windowBig["bigImage"+thisBigImage]);
my_color.setTransform(colorTransform);
step = 0;
effectinterval = setInterval(effect, 3);
_root.windowBig.prel._visible = false;
_root.windowBig["bigImage"+thisBigImage]._width = 355;
_root.windowBig["bigImage"+thisBigImage]._height = 275;
_root.windowBig["bigImage"+thisBigImage]._x = 6;
_root.windowBig["bigImage"+thisBigImage]._y = 6;
_root.overBigPicture.lblDescription._visible = true;
delete this.onEnterFrame;
}
};
}
}
maxPictures = 12;
thisBigImage = 0;
init();
stop();
Muchas Gracias , si alguien puede ayudarme.
Eternamente Agradecida</parseint></parseint></_root.totalpages>
maryland
Buenas Noches Sanyaissues, Muchas Gracias, por tu gran ayuda, ahora me va perfecto. Ha sido oner ese codigo y listo. Wuala.
Muchas Gracias,Muchas gracias.
Mary.
Usuario desconocido
Ojeando por encima el código veo que tienes muchas referencias absolutas (llamados usando: _root) por lo cual puede que cuando ejecutes "tupelicula.swf" todo funcione correctamente pero cuando la película es leída a través de "contenedor.swf" no encuentre algunas cosas (variables, funciones, etc...), esto sucede porque dentro del contenedor el _root es el de "contenedor.swf" y no el de "tupelicula.swf".
Si es es el caso puedes hacer una de dos cosas:
1. Cambiar las referencias absolutas por relativas (dejar de hacer llamados directos a _root).
2. En "tupelicula.swf" bloquear el _root con la propiedad _lockroot. Basta que agregues este código: this._lockroot = true;
Si esto no ayuda con tu problema o no tiene nada que ver con el problema que tienes, sería bueno que anexaras un link para descargar los .FLA que estás usando. Eso facilitaría el entendimiento del problema.