# Break on scene add?

**URL:** https://forum.kirupa.com/t/break-on-scene-add/191690
**Category:** flash
**Created:** [June 22, 2006, 10:02am UTC](https://forum.kirupa.com/t/break-on-scene-add/191690 "2006-06-22T10:02:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tolk](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tolk/32/2496_2.png) [@tolk](https://forum.kirupa.com/u/tolk)
#### Post date: [June 22, 2006, 10:02am UTC](https://forum.kirupa.com/t/break-on-scene-add/191690/1 "2006-06-22T10:02:56Z")

</div>

In my FLA i’m loading and XML file into a xmlconnector --\> into a dataset --\> into a datagrid.  
At the moment I just have one scene and i want to add another scene. I added a scene before the original scene. I didn’t think this would work properly as I have imported tween class etc. on the first frame of the original scene. I tested and it didnt work- as in it just skipped loading the xml into the datagrid. Then i removed the scene and tested again, it worked as normal. I decided to add the scene after the original scene so i did this and tested. It didn’t work again and i don’t understand why. (i removed the added scene again and re-tested and it worked as normal).  
Here’s the code on the first frame of original scene (it’s probably not very neat from a coders point of view but iv’e only just started so any suggestions on improving flow of code would be appreciated):

import mx.transitions.Tween;  
import mx.transitions.easing.\*;

//Set datagrid styles  
items\_dg.setStyle(“backgroundColor”, 0xE2F2F6);  
items\_dg.setStyle(“headerColor”, 0x266FA6);  
items\_dg.setStyle(“headerColor”, 0x266FA6);

//Trigger xml load  
items\_xmlcon.trigger();

//Get table names for iTable  
function getTabNames(){  
//Get number of rows and cols from XML attributes  
var rows = items\_xmlcon.results.firstChild.attributes.rows;  
var cols = items\_xmlcon.results.firstChild.attributes.cols;  
//Defines array to store col and row names for X-tab data  
var colValues:Array = new Array();  
var rowValues:Array = new Array();  
//Array of experimental data catagory names  
var colName:Array = items\_dg.columnNames;  
//Fill the row and col names from first data set items  
for (i=0;i!=rows;i++){  
var temp = items\_dg.getItemAt(i);  
this[“iTable.row”+i] = eval(“temp.” + colName[1]);  
}  
for (i=0;i!=cols;i++){  
var temp = items\_dg.getItemAt(i);  
this[“iTable.col”+i] = eval(“temp.” + colName[2]);  
}  
}

//Function for run-time animation  
var x:Number; //x Position to tween to  
var y:Number; //y Position to tween to  
var xl:Number; //Previous x position  
var yl:Number; //Previous y position  
var tween:Number = 0;  
function popAnim(row:Number) {  
var rows = items\_xmlcon.results.firstChild.attributes.rows;  
var cols = items\_xmlcon.results.firstChild.attributes.cols;  
var tmp = eval(“iTable.itm”+yl+xl);  
tmp.text = “\r” + tempText.text + tmp.text;  
var rowItem = items\_dg.getItemAt(row);  
var colName:Array = items\_dg.columnNames;  
var cellValue:Array = new Array();  
for (i=0;i!=colName.length;i++) {  
cellValue.push(eval(“rowItem.” + colName\*));  
}  
var setValue = items\_dg.editField(row, colName[0], “”);  
tempText.\_x = \_root.items\_dg.\_x;  
tempText.\_y = \_root.items\_dg.\_y + ((row+1)_items\_dg.rowHeight);  
tempText.text = cellValue[0];  
for (i=0;i!=rows;i++){  
if (cellValue[1] == eval(“iTable.row”+i+"\_txt.text")){  
y = iTable.\_y + (i_100);  
yl = i;  
}  
else {  
}  
}  
for (i=0;i!=cols;i++){  
if (cellValue[2] == eval(“iTable.col”+i+"\_txt.text")){  
x = iTable.\_x + (i\*70);  
xl = i;  
}  
else {  
}  
}  
var tweenxObj:Tween= new Tween(tempText, “\_x”, Strong.easeIn, tempText.\_x, x, 1, true);  
var tweenyObj:Tween= new Tween(tempText, “\_y”, Strong.easeIn, tempText.\_y, y, 1, true);  
[//tweenyObj.addListener](https://tweenyObj.addListener)(listeningObject);  
[//tweenxObj.addListener](https://tweenxObj.addListener)(listeningObject);  
}

//Play and Back button functions

var tDC:Number = 0; //text Display Counter  
var tween:Number = 0;  
function Play() {  
if(\_root.\_currentframe != \_root.\_totalframes){  
dynamicText.gotoAndStop(“load”);  
tDC++  
loadVarsText.load(“recognise.txt”);  
iTable.gotoAndStop(iTable.nextFrame());  
gotoAndStop(nextFrame());  
}  
else{  
if (tween \< 15){  
popAnim(tween);  
tween++;  
}  
}

}  
function Back() {  
if(\_root.\_currentframe != 1) {  
dynamicText.gotoAndStop(“load”);  
tDC–  
loadVarsText.load(“recognise.txt”);  
iTable.gotoAndStop(iTable.prevFrame());  
gotoAndStop(prevFrame());  
}  
}

//Text loading function  
loadVarsText = new LoadVars();  
loadVarsText.load(“recognise.txt”);  
loadVarsText.onLoad = function(success) {  
if (success) {  
dynamicText.gotoAndPlay(“loaded”);  
if(this[“textDisplay”+tDC] != void(0)) {  
dynamicText.txt\_textDisplay.text = this[“textDisplay”+tDC];  
}  
} else {  
trace(“failed loading”);  
}  
}

//Stop on first frame and wait for user  
stop();
