Hola, necesito ayuda. No se como solucionar este error. Es de una plantilla de un banner en as3. Tengo la versión CS4 y no tengo mucha idea.
Gracias de antemano
ERROR 1119: Acceso a una propiedad imageBox posiblemente no definida mediante una referencia con tipo estático flash.display:DisplayObjectContainer.
El error me lo da en la línea 49: var imageBox = this.parent.imageBox;
Este es el código entero del fotograma:
// double click the thumbnailsMenu Movie Clip if you want to adjust the roll over color intensity
import fl.transitions.Tween;
import fl.transitions.easing.*;
// autoPlay PARAMETERS //
//use menu roll over scroll
//var useMenuRollOverScroll = 1;
//use auto play selection
var useAutoPlay = 1;
var autoPlayDelay = 2.5; //auto play checking interval - in seconds
// hide or not the thumb menu scroll bar
//var hideScrollBar = 0;
this.parent.alpha = 0;
//auxiliary variables used in autoPlay calculation
var endCurrVideo = 0; // shows if current video ends and next video can start playing
//aux variables used in focus clip calculation
var scrollerIntId;
//aux variables used in autoPlay calculation
var autoPlayIntId;
var totalCells;
var rowsNo;
var pct;
var currPct;
var cellIdx;
var curCell;
var timer;
//aux variables used in rollOver scroll calculation
var menuX = mc1.x;
var menuY = mc1.y;
var firstYOut = 0;
var firstXOut = 0;
// END PARAMETERS //
[B]var imageBox = this.parent.imageBox;[/B]
// INIT AUTOPLAY METHOD //
function initAutoPlayEngine() {
//check mouse scroll percentage
/*if (useMenuRollOverScroll) {
sb1.useMouseWheel = "false";
startCheckMouseScroll();
}*/
//check auto play
initAutoPlayParams(); //init auto play param values used in calculation
if (useAutoPlay) {
startAutoPlay();
}
else {
setPauseState(autoPlayBtn);
}
//BY DEFAULT REVEAL FIRST IMAGE //
//trace("One: "+imageBox["p0"]._name+" "+imageBox["p0"]._alpha+" "+imageBox["p0"]._visible+" "+imageBox._alpha+" "+imageBox._visible);
var p0Ref = imageBox.getChildByName("p0");
p0Ref.visible = true;
p0Ref.contentDescriptionBox.alpha = 0;
//imageBox["p0"].fadeIn();
//reveal content
fade(this.parent,1,1,0.5);
}
// AUTO PLAY HANDLER //
//called only once after the table is rendered if autoPlay is set to true
function startAutoPlay() {
clearInterval(autoPlayIntId);
autoPlayIntId = setInterval(autoPlay,timer);
endCurrVideo = 1;
}
function stopAutoPlay() {
clearInterval(autoPlayIntId);
}
function autoPlay() {
//trace("auto play: "+endCurrVideo);
if (endCurrVideo==1) { //play/load next video/image only when current video/image ends
var prevCell = curCell; //previous cell mc reference
if (cellIdx == (totalCells - 1)) {
cellIdx = 0;
currPct = 0;
}
else {
cellIdx += 1;
if (cellIdx == (totalCells - 1)) { currPct = 100; }
else {
//currPct += pct;
currPct = cellIdx*pct;
currPct = Math.round(currPct);
}
}
//trace("Next cell: "+cellIdx+" "+currPct);
var curCellName = "p"+cellIdx;
var curCell1 = mc1.getChildByName(curCellName);
//rollOutHandler(prevCell); //roll out previous row
//rollOverHandler(curCell); //roll over the current row
initContent(curCell1); //start playing the current video
//startSetScrollBar(); //adjust the scroller position
}
}
function initAutoPlayParams() { //it executes once after the table is rendered
totalCells = mc1.nodes.length;
rowsNo = mc1.nodes.length - 1;
pct = 100 / rowsNo;
curCell = mc1.getChildByName("p0");
cellIdx = 0;
currPct = 0;
timer = autoPlayDelay * 1000;
//if (hideScrollBar==1) sb1._alpha = 0;
//trace(curCell+" "+pct+" "+rowsNo);
}
//restart autoPlay from the current cell position
function restartAutoPlay() {
cellIdx = Number(curCell.name.substr(1,curCell.name.length-1));
//if (!(cellIdx%2)) cellIdx -= 1; //get current selected row index (given by the first cell in the row index)
clearInterval(autoPlayIntId);
autoPlayIntId = setInterval(autoPlay,timer); ;
}
//autoplay button handlers //
function setPlayState(mc) {
mc.gotoAndStop(1);
restartAutoPlay();
useAutoPlay = 1;
endCurrVideo = 1; //set this to 1 so it can starts playing the next video
}
function setPauseState(mc) {
//trace("set pause");
mc.gotoAndStop(2);
stopAutoPlay();
useAutoPlay = 0;
endCurrVideo = 0;
}
autoPlayBtn.buttonMode = true;
autoPlayBtn.useHandCursor = true;
autoPlayBtn.mouseChildren = false;
autoPlayBtn.addEventListener("mouseDown",pressHand ler1);
function pressHandler1(e:Event) {
//trace("state: "+useAutoPlay);
//0 -> pause state 1 -> play state
if (useAutoPlay == 0) {setPlayState(e.target);}
else
{setPauseState(e.target);}
}
prevVideoBtn.buttonMode = true;
prevVideoBtn.useHandCursor = true;
prevVideoBtn.mouseChildren = false;
prevVideoBtn.addEventListener("mouseDown",pressHan dler2);
function pressHandler2(e:Event) {
//prevVideoBtn.onPress = function() {
var cellRef;
//get current selected row index (given by the first cell in the row index)
cellIdx = Number(curCell.name.substr(1,curCell.name.length-1));
//if (!(cellIdx%2)) cellIdx -= 1;
//determine previous cell index
if (cellIdx==0) { cellIdx = totalCells - 1; }
else { cellIdx = cellIdx - 1; }
cellRef = mc1.getChildByName("p"+cellIdx);
//call the press handler with the respective cell mc as parameter
mc1.pressHandler(cellRef);
//set scroll percentage
currPct = Math.round(cellIdx*pct);
//trace(curCell+" "+cellIdx+" "+cellRef+" "+currPct);
//startSetScrollBar(); //adjust the scroller position
}
nextVideoBtn.buttonMode = true;
nextVideoBtn.useHandCursor = true;
nextVideoBtn.mouseChildren = false;
nextVideoBtn.addEventListener("mouseDown",pressHan dler3);
function pressHandler3(e:Event) {
var cellRef;
//get current selected row index (given by the first cell in the row index)
cellIdx = Number(curCell.name.substr(1,curCell.name.length-1));
//if (!(cellIdx%2)) cellIdx -= 1;
//determine previous row index -> determined by the first cell index in the row
if (cellIdx==(totalCells - 1)) { cellIdx = 0; }
else { cellIdx = cellIdx + 1; }
cellRef = mc1.getChildByName("p"+cellIdx);
//call the press handler with the respective cell mc as parameter
//trace(cellIdx+" "+cellRef);
mc1.pressHandler(cellRef);
//set scroll percentage
currPct = Math.round(cellIdx*pct);
//startSetScrollBar(); //adjust the scroller position
}
// END AUTOPLAY HANDLER //
//SET FOCUS RECT AND SCROLL PERCENTAGE METHODS //
function getRowXY(mc) {
var rowX = mc.x;
var rowY = mc.y;
var resArray = new Array();
resArray.push(rowX);
resArray.push(rowY);
return resArray
}
/*function setScrollPercentage() {
sb1.scrollPercentage = currPct; //adjust the scroll position
clearInterval(scrollerIntId);
//trace("set scroller2: "+currPct);
}
function startSetScrollBar() {
//trace("set scroller1");
clearInterval(scrollerIntId);
scrollerIntId = setInterval(this,"setScrollPercentage",50);
}*/
//END SET FOCUS RECT AND SCROLL PERCENTAGE METHODS //
//used by the startPress method when user clicks on a row
function initContent(mc) {
var nextBigImageRef = imageBox.getChildByName(mc.name);
var currBigImageRef = imageBox.getChildByName(curCell.name);
currBigImageRef.contentDescriptionBox.alpha = 0;
nextBigImageRef.contentDescriptionBox.alpha = 0;
currBigImageRef.visible = false;
//imageBox[curCell._name]._alpha = 0;
nextBigImageRef.fadeIn();
//hide previous focus rect and show current focus
var currFocus = mc.getChildByName("focusRect1");
var prevFocus = curCell.getChildByName("focusRect1");
currFocus.visible = true;
prevFocus.visible = false;
//curCell becomes mc
curCell = mc;
}
// CHECK MOUSE SCROLL ROLL OVER //
/*function startCheckMouseScroll() {
this.onEnterFrame = checkMouseScroll;
}
function checkMouseScroll(){
var isOverTarget = 1;
var maskH = sb1.viewAreaHeight;
var maskW = sb1.viewAreaWidth;
if (_xmouse > (menuX + maskW)) {
isOverTarget = 0;
if (firstXOut==0) { //fix for rollOver scroll & autoPlay used in the same time
sb1.scrollPercentage = 100;
firstXOut = 1;
}
}
if (_xmouse < menuX) {
isOverTarget = 0;
if (firstXOut==0) { //fix for rollOver scroll & autoPlay used in the same time
sb1.scrollPercentage = 0;
firstXOut = 1;
}
}
if (_ymouse > (menuY + maskH)) isOverTarget = 0;
if (_ymouse < menuY) isOverTarget = 0;
//if ((_ymouse > menuY) && (_ymouse < (menuY + maskH))) {if (firstYOut==1) firstYOut=0;}
if ((_xmouse > menuX) && (_xmouse < (menuX + maskW))) {if (firstXOut==1) firstXOut=0;}
if (isOverTarget) { //this is for vertical orientation
var mouseOffset = (_xmouse - menuX);
var pct = mouseOffset / maskW * 100;
sb1.scrollPercentage = Math.round(pct);
//sb1.scrollPercentage = pct;
}
}
*/
// END CHECK MOUSE SCROLL ROLL OVER //
function fade(mc,xs,xf,duration) {
var func1 = Regular.easeOut;
var tw1 = new Tween(mc, "alpha", func1, xs, xf, duration, true);
//tw1.onMotionFinished = fadeTitle;
}
//initAutoPlay(); //=> called from within the menu mc1 movie clip after the xml is parssed