Nevron BarChart with DateTimeScaleConfigurator weired series plotting? - winforms

I am using Nevron Charting Control ver.11.1.17.12 in application. I am facing problem in drawing the chart correct with the DateTimeScaleConfigurator. Here are following problem:
Series Bar overlapping each other if series count increases.
Series getting out of the Axis lines.
X Axis Scale automatically add previous year December and next year Jan in the scale which cause the chart to have blank area in case of Surface Chart.
//code snippet to draw Bar Chart Series
NBarSeries bar = new NBarSeries();
bar.UniqueId = new Guid(outputVariable.UniqueId);
bar.Name = outputVariable.LegendText;
chart.Series.Add(bar);
bar.HasBottomEdge = false;
bar.MultiBarMode = chart.Series.Count == 1 ? MultiBarMode.Series : MultiBarMode.Clustered;
// bar.InflateMargins = true;
bar.UseZValues = false;
indexOfSeries = chart.Series.IndexOf(bar);
ConfigureChartSeries(bar, indexOfSeries, outputVariable);
SetSeriesAxisInformation(bar, outputVariable.Unit);
bar.UseXValues = true;
foreach (DataRow row in seriesDataTable.Rows)
{
bar.XValues.Add(Convert.ToDateTime(row["TimeStamp"]).ToOADate());
}
code snippet to Add Surface Chart Series
chart.Enable3D = true;
chart.BoundsMode = BoundsMode.Stretch;
(chart as NCartesianChart).Fit3DAxisContent = true;
chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalTop);
chart.LightModel.EnableLighting = false;
chart.Wall(ChartWallType.Back).Visible = false;
chart.Wall(ChartWallType.Left).Visible = false;
chart.Wall(ChartWallType.Floor).Visible = false;
// setup Y axis
chart.Axis(StandardAxis.PrimaryY).Visible = false;
// setup Z axis
NAxis axisZ = chart.Axis(StandardAxis.Depth);
axisZ.Anchor = new NDockAxisAnchor(AxisDockZone.TopLeft);
NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator();
scaleZ.InnerMajorTickStyle.Visible = false;
scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[0];
scaleZ.RoundToTickMin = false;
scaleZ.RoundToTickMax = false;
axisZ.ScaleConfigurator = scaleZ;
axisZ.Visible = true;
// add a surface series
NGridSurfaceSeries surface = new NGridSurfaceSeries();
surface.UniqueId = new Guid(outputVariable.UniqueId);
surface.Name = outputVariable.LegendText;
chart.Series.Add(surface);
surface.Legend.Mode = SeriesLegendMode.SeriesLogic;
surface.ValueFormatter = new NNumericValueFormatter("0.0");
surface.FillMode = SurfaceFillMode.Zone;
surface.FrameMode = SurfaceFrameMode.Contour;
surface.ShadingMode = ShadingMode.Flat;
surface.DrawFlat = true;
// Already set this property to false and working in other chart.
surface.InflateMargins = false;
surface.FrameColorMode = SurfaceFrameColorMode.Zone;
surface.SmoothPalette = true;
surface.Legend.Format = "<zone_value>";
surface.FillMode = SurfaceFillMode.Zone;
surface.FrameMode = SurfaceFrameMode.Contour;
CreateSurfaceSeries(outputVariable, surface);
chartControl.Refresh();
And the ScaleConfigurator configuration
chartPrimaryXAxis = chart.Axis(StandardAxis.PrimaryX);
// X Axis Configuration
dateTimeScale = new NDateTimeScaleConfigurator();
dateTimeScale.Title.Text = string.Empty;
dateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90);
dateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft;
dateTimeScale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Times New Roman", 6);
dateTimeScale.LabelFitModes = new LabelFitMode[] { LabelFitMode.AutoScale };
chartPrimaryXAxis.ScaleConfigurator = dateTimeScale;
chartPrimaryXAxis.ScrollBar.ResetButton.Visible = true;
chartPrimaryXAxis.ScrollBar.ShowSliders = true;
dateTimeScale.EnableUnitSensitiveFormatting = true;
Here is the generated output:
Any idea regarding this problem will be deeply appreciated.
Thanks in advance.

Series Bar overlapping each other if series count increases.
&
Series bar getting out of the Axis lines.
Answer: When you are using categorial data then use NOrdinalScaleConfigurator rather than NDateTimeScaleConfigurator. It will not solve the problem and put the series bar in the center of the scale and auto resize them according to the chart size also.
X Axis Scale automatically add previous year December and next year
Jan in the scale which cause the chart to have blank area in case of
Surface Chart.
Answer:
Set the following properties of the DateTimeScaleConfigurator to false to avoid such behavior.
dateTimeScale.RoundToTickMax = false;
dateTimeScale.RoundToTickMin = false;

Related

Filtering an Array of Sheets on three criteria with output being the URL link to the filtered sheets

I am creating two lists of links on my opening sheet (9060DASH) in Google Sheets. It looks like this:
One list is links to all sheets that are not hidden (Active) and one to all that are hidden. Each item must meet two other criteria to be included:
The sheet name must not include the numbers "9060."
The cell GH3 in the sheet must contain "Protected."
I have a functioning script, but it is loading too slowly. Here is a sample to show how it loads during onOpen(). How can I do this more efficiently? Can it be done better using "push"? Here is the script:
function populateSheetList() {
SpreadsheetApp.getActive().getSheetByName("9060DASH").activate();
var ss = SpreadsheetApp.getActive();
var ui = SpreadsheetApp.getUi();
ss.getRange('9060DASH!D4:E100').clear();
var counter = 4;
var sheetName = "";
var cellID= "";
var richValue = "";
var sheetURL = ss.getUrl();
var sheetLink = ""
var mySheet = "";
var shouldNotContain = '9060'; //array code from stackover to build array without 9060 sheets
var sheetNames = SpreadsheetApp.getActiveSpreadsheet().getSheets().map(s => s.getName());
var filtered = sheetNames.filter(x => !x.toLowerCase().match(shouldNotContain.toLowerCase()));
/** CREATES ACTIVE SHEETS LIST */
for(var i =0;i<filtered.length;i++){
cellID = '9060DASH!D'+counter;
sheetName = filtered[i];
mySheet = ss.getSheetByName(sheetName);
sheetLink = sheetURL+'#gid='+ mySheet.getSheetId();
if(mySheet.isSheetHidden() == false){
if(ss.getRange(sheetName+"!GH3").getValue() == "Protected"){
richValue = SpreadsheetApp.newRichTextValue()
.setText(sheetName)
.setLinkUrl(sheetLink)
.build();
ss.getRange(cellID).setRichTextValue(richValue);
counter = counter+1;
}
}
}
/** GATHERING HIDDEN SHEETS */
var counter = 4;
for(var i =0;i<filtered.length;i++){
cellID = '9060DASH!E'+counter;
sheetName = filtered[i];
mySheet = ss.getSheetByName(sheetName);
sheetLink = sheetURL+'#gid='+ mySheet.getSheetId();
if(mySheet.isSheetHidden() == true){
if(ss.getRange(sheetName+"!GH3").getValue() == "Protected"){
richValue = SpreadsheetApp.newRichTextValue()
.setText(sheetName)
.setLinkUrl(sheetLink)
.build();
ss.getRange(cellID).setRichTextValue(richValue);
counter = counter+1;
}
}
}
}
I have reduced the time to load the dashboard by rearranging a number of things and by getting a final array before writing anything out to the dash. I reformatted the cells and sorted the records before the evaluation loops began. I added more status messages, to keep users engaged while the background work was going on. I put the criteria of separating active from hidden sheets last and, depending on which, wrote the values to two different arrays (actvSheets and hidnSheets). Then I processed each array out to the dashboard. I did this in for loops. I suspect I could save even more time to write them out as one command from each array, but I have not been able to figure out how to write out in vertical form. Here is the code. Any refinements are welcome!
/**
* =================
* populateSheetList
* =================
* This function builds the available sheets in the
* 9060DASH sheet--containing all with the Protected
* status.
*/
function populateSheetListNEW() {
msgDash("Clearing sheet list . . . ")
// SpreadsheetApp.getActive().getSheetByName("9060DASH").activate();
var ss = SpreadsheetApp.getActive();
var ui = SpreadsheetApp.getUi();
ss.getRange('9060DASH!D4:E100')
.clear()
.setFontSize(14)
.setHorizontalAlignment('left')
.sort({column: 4, ascending: true})
msgDash("Evaluating sheets . . . ")
var counter = 4;
var sheetName = "";
var cellID= "";
var richValue = "";
var sheetURL = ss.getUrl();
var sheetLink = ""
var mySheet = "";
var actvSheets = [];
var hidnSheets = [];
msgDash("Eliminating administrative sheets . . . ")
var shouldNotContain = '9060'; //array code from stackover to build array without 9060 sheets
var sheetNames = SpreadsheetApp.getActiveSpreadsheet().getSheets().map(s => s.getName());
var filtered = sheetNames.filter(x => !x.toLowerCase().match(shouldNotContain.toLowerCase()));
var sortFilt = filtered.sort();
/** CREATES SHEET ARRAYS */
msgDash("Gathering census worksheets . . . ")
for(var i =0;i<sortFilt.length;i++){
sheetName = sortFilt[i];
mySheet = ss.getSheetByName(sheetName);
if(ss.getRange(sheetName+"!GH3").getValue() == "Protected"){
if(mySheet.isSheetHidden() == false){
actvSheets.push(sheetName);
} else {
hidnSheets.push(sheetName);
}
}
}
msgDash("Gathering active sheets . . . ")
/** WRITING DATA FROM ACTVSHEETS ARRAY */
for(var j = 0; j < actvSheets.length; j++){
sheetName = actvSheets[j];
mySheet = ss.getSheetByName(actvSheets[j]);
sheetLink = sheetURL+'#gid='+ mySheet.getSheetId();
richValue = SpreadsheetApp.newRichTextValue()
.setText(sheetName)
.setLinkUrl(sheetLink)
.build();
cellID = '9060DASH!D' + counter;
counter = counter+1;
ss.getRange(cellID).setRichTextValue(richValue);
}
msgDash("Gathering hidden sheets . . . ");
/** WRITING DATA FROM HDDNSHEETS ARRAY */
counter = 4;
for(var k = 0; k< hidnSheets.length; k++){
sheetName = hidnSheets[k];
mySheet = ss.getSheetByName(hidnSheets[k]);
sheetLink = sheetURL+'#gid='+ mySheet.getSheetId();
richValue = SpreadsheetApp.newRichTextValue()
.setText(sheetName)
.setLinkUrl(sheetLink)
.build();
cellID = '9060DASH!E' + counter;
counter = counter+1;
ss.getRange(cellID).setRichTextValue(richValue);
}
msgDash('Dashboard ready. Enjoy your census work!');
ss.getRange('9060DASH!D2').setValue("For hidden sheets, respond to 'Unhide' instruction. Click Refresh button to rebuild list.");
Utilities.sleep(20);
msgDash(''); //clears messages
}

Adding a movieclip in each square of my calendar (AS3)

I've got a calendar with squares in wich each date is wrote :
var myArray:Array = new Array();
var row:Number = 0;
var moonNum:Number;
var holder_txt:MovieClip = new MovieClip;
addChild(holder_txt);
holder_txt.x = 35;
holder_txt.y = 10;
startDay -= 1;
for (var t:int = 0; t < getDays(myDate); t++) {
myArray[t] = (t+1);
var textNum:String = myArray[t];
import box;
import moonPhase;
var square:MovieClip = new box();
var moon:MovieClip = new moonPhase();
holder_txt.addChild(square);
square.name = textNum
moonNum= calculateMoonPhase(myDate.fullYear, myDate.month,t+1);
square.texter.text = textNum +" "+ moonNum;
square.x = (startDay) *75
square.y = (row+1)*65
startDay++;
if(startDay >= 7){
startDay = 0;
row++;
I've got a function that calculate the moonPhase for everyday.
moonNum= calculateMoonPhase(myDate.fullYear, myDate.month,t+1);
It results as a number (between 0 and 8).
I've got movieClip of a moon with 8 frames (new moon,full moon...etc).
I'd like to add the movieClip of the moon on each square with the corresponding frame number.
moonClip.gotoAndStop(moonNum);
I've add each moonNum to each square day :
square.texter.text = textNum +" "+ moonNum;
But I've no idea how to add movieclips to each square day...
Any help ?
It's better to add moonPhase in the class box directly. So for each box that you copied, you have an instance of moon in it to.
But, in your sample code, you can add moon to the square directly to.
square.addChild(moon);

ListView not scrolling when items added pro-grammatically

I have a listView which I add a number of buttons to in a for loop. However the listView isn't scrollable even if I set it to be scrollable. I'm not sure why this is happening. I'm simply adding a button every time I enter the for loop however once there is too many buttons to view on the listview no scroll bar appears. My code is as follows.
ListViewTemplates.HeaderStyle = ColumnHeaderStyle.None
For i As Integer = 1 To level3Cat.Count
counter = i Mod 2
If counter = 0 Then
Dim picture As Button = New Button()
picture.Location = New System.Drawing.Point(165, topForNextControl)
picture.Size = New System.Drawing.Size(90, layoutTemplateHeight)
picture.TabStop = False
picture.BackgroundImageLayout = BackgroundImageLayout.Stretch
picture.BackgroundImage = My.Resources.XButton
ListViewTemplates.Controls.Add(picture)
topForNextControl += layoutTemplateHeight + HeighScaleFactor
Else
Dim picture As Button = New Button()
picture.Location = New System.Drawing.Point(35, topForNextControl)
picture.Size = New System.Drawing.Size(90, layoutTemplateHeight)
picture.TabStop = False
picture.BackgroundImageLayout = BackgroundImageLayout.Stretch
picture.BackgroundImage = My.Resources.XButton
ListViewTemplates.Controls.Add(picture)
End If
ListViewTemplates.Scrollable = True
ListViewTemplates.View = View.Details
counter += 1
Next

How to display routes on OpenStreetMaps from richtextbox data, how create list which two value from another array?

I have this function which get back longitude and latitude from my Rtb data (first picture):
// funkcja pobierająca szerokość i długość geograficzną w formacie dziesiętnym
private Tuple<double, double>[] wsp_geograficzne(string[] lines)
{
return Array.ConvertAll(lines, line =>
{
string[] elems = line.Split(',');
return new Tuple<double, double>(0.01*double.Parse(elems[1]), 0.01*double.Parse(elems[3]));
});
}
This line calls this above function:
var data = wsp_geograficzne(richTextBox1.Lines);
This is a sample, which display routes on my OpenStreetMaps.
GMapOverlay routes = new GMapOverlay(gMapControl1, "routes");// Constructing object for Overlay
gMapControl1.Overlays.Add(routes);
List<PointLatLng> list = new List<PointLatLng>(); // The list of Coordinates to be plotted
list.Add(new PointLatLng(53.119149707703, 23.1447064876556));
list.Add(new PointLatLng(53.11963262556597, 23.1468522548676));
list.Add(new PointLatLng(53.1205276192621, 23.1460046768188));
list.Add(new PointLatLng(53.120701464779, 23.1463050842285));
list.Add(new PointLatLng(53.1200962217943, 23.1489872932434));
list.Add(new PointLatLng(53.1196970143107, 23.1489014625549));
list.Add(new PointLatLng(53.119439459128, 23.1490087509155));
GMapRoute r = new GMapRoute(list, "myroute"); // object for routing
r.Stroke.Width = 5;
r.Stroke.Color = Color.Blue;
routes.Routes.Add(r);
gMapControl1.ZoomAndCenterRoute(r);
gMapControl1.Zoom = 15;
It looks like on the picture:
I want display routes from my data "wsp_geograficzne" (wsp_geograficzne include longitude and latitude) on this map. How should I do it? Is there any method that allow me to create List which data from "wsp_geograficzne"? I trying something like this:
List<PointLatLng> nowa = new List<PointLatLng>();
foreach (var p in data)
nowa.Add(p.Item1, p.Item2);
but it dont works. I get back error: Error 2 No overload for method 'Add' takes 2 arguments.
Please help :)
Ok I find answer (new function which get back 2 value (longitude and latitude) from rtb (longitude and latitude are back in decimal notation):
// funkcja pobierająca szerokość i długość geograficzną w formacie dziesiętnym
private Tuple<double, double>[] wsp_geograficzne(string[] lines)
{
return Array.ConvertAll(lines, line =>
{
string[] elems = line.Split(',');
double we1 = 0.01 * double.Parse(elems[3], EnglishCulture);
int stopnie1 = (int)we1;
double minuty1 = ((we1 - stopnie1) * 100) / 60;
double szerokosc_dziesietna = stopnie1 + minuty1;
double we2 = 0.01 * double.Parse(elems[5], EnglishCulture);
int stopnie2 = (int)we2;
double minuty2 = ((we2 - stopnie2) * 100) / 60;
double dlugosc_dziesietna = stopnie2 + minuty2;
return new Tuple<double, double>(szerokosc_dziesietna, dlugosc_dziesietna);
});
}
And this is a part which display routes on the map.
{
var data = wsp_geograficzne(richTextBox1.Lines);
List<PointLatLng> nowa = new List<PointLatLng>();
foreach (var p in data)
nowa.Add(new PointLatLng(p.Item1, p.Item2));
GMapOverlay routes = new GMapOverlay(gMapControl1, "routes");
gMapControl1.Overlays.Add(routes);
GMapRoute r = new GMapRoute(nowa, "myroute"); // object for routing
r.Stroke.Width = 9;
r.Stroke.Color = Color.Blue;
routes.Routes.Add(r);
gMapControl1.ZoomAndCenterRoute(r);
gMapControl1.Zoom = 16;
}
If someone has another notations this part:
List<PointLatLng> nowa = new List<PointLatLng>();
foreach (var p in data)
nowa.Add(new PointLatLng(p.Item1, p.Item2));
please show me here.
Greetings from Poland :).

Actionscript 3, Flash CC: Placing Objects In An Array From The Library Onto The Stage

Hello programming gurus of stackoverflow, I am hoping that at least one of you will be able to help me with my coding problem. This is the first time I'm posting on this site, so if I miss something with the structure of my post, or anything please let me know (preferably not in a condescending matter) and I will gladly change it.
I actually had a different problem I was going to ask about, but I recently realized that some objects from my library weren't showing up on my stage. Hopefully, if this gets solved I won't have my other problem.
I am creating a learning module app using Flash CC and Actionscript 3, I like to think I am fairly proficient with Flash, but right now all my code is on the timeline because when I started I wasn't aware of the package setup. When I finish with the learning module I'll try and move everything to an AS package, so please bear with me.
This current frame of the module is a drag and drop game where the user drags the correct food, for the animal they chose in the previous frame, to the animal in the middle. The animal is dynamically placed on the stage, as well as an array of six possible food choices, all MovieClips pulled from the library. The array of food elements is actually not what I'm having problem with, they appear on my stage with no problems at all. The problem I'm having is when the user drags the correct food onto the animal, and the win condition is met, the array of balloon elements does not show up on the stage. I find it weird because I'm using near identical code for both the food and balloon array.
Here is my full code:
import flash.display.MovieClip;
import flash.events.MouseEvent;
foodPet();
function foodPet():void {
//all of my pet, food, and balloon library objects have been exported for AS
var theBird:pet_bird = new pet_bird;
var theCat:pet_cat = new pet_cat;
var theChicken:pet_chicken = new pet_chicken;
var theDog:pet_dog = new pet_dog;
var theDuck:pet_duck = new pet_duck;
var theGuinea:pet_guinea = new pet_guinea;
var theHamster:pet_hamster = new pet_hamster;
var birdSeed:food_bird_seed = new food_bird_seed;
var catFood:food_cat_food = new food_cat_food;
var chickenFeed:food_chicken_feed = new food_chicken_feed;
var chocolate:food_chocolate = new food_chocolate;
var dogFood:food_dog_food = new food_dog_food;
var duckFood:food_duck_food = new food_duck_food;
var animalList:Array = [theBird, theCat, theChicken, theDog,
theDuck, theGuinea, theHamster];
var food1Array:Array = [birdSeed, catFood, chickenFeed,
chocolate, dogFood, duckFood, 4];
var xPosFood:Array = new Array();
var yPosFood:Array = new Array();
xPosFood = [32, 71, 146, 363, 431, 512];
yPosFood = [304, 222, 123, 123, 222, 304];
var animalClip:MovieClip;
animalClip = animalList[chosenAnimal];
addChild(animalClip);
animalClip.x = 256;
animalClip.y = 287;
animalClip.name = "selectedAnimal";
for (var i:uint = 0; i < food1Array.length - 1; i++){ //Where the food gets added
var isItRight:Boolean = false;
var foodName:String = ("food" + i);
var foodClip:MovieClip;
foodClip = food1Array[i];
foodClip.x = xPosFood[i];
foodClip.y = yPosFood[i];
foodClip.name = foodName;
addChild(foodClip);
trace(foodClip.parent);
foodDragSetup(foodClip, animalClip, food1Array[food1Array.length - 1], isItRight);
}
}
function foodDragSetup(clip:MovieClip, targ:MovieClip, correctNum:uint, isItRight:Boolean) {
var beingDragged:Boolean = false;
var xPos:Number = clip.x;
var yPos:Number = clip.y;
clip.addEventListener(MouseEvent.MOUSE_DOWN, beginDrag);
function beginDrag(event:MouseEvent):void
{
clip.startDrag();
if (int(clip.name.substr(4)) == correctNum){
isItRight = true;
}
this.beingDragged = true;
setChildIndex(clip, numChildren - 1);
clip.addEventListener(MouseEvent.MOUSE_UP, endDrag);
}
function endDrag(event:MouseEvent):void
{
if (this.beingDragged) {
this.beingDragged = false;
clip.stopDrag();
if ((isItRight) && (clip.hitTestPoint(targ.x, targ.y, true))){
trace(targ.name + " has been hit.");
clip.x = targ.x;
clip.y = targ.y;
win_animal_food();
} else {
isItRight = false;
clip.x = xPos;
clip.y = yPos;
}
}
}
}
function win_animal_food():void {
const BALLOON_ROW:int = 4;
var count:uint = 0;
var altX:uint = 0;
var bBalloon:blue_balloon = new blue_balloon;
var gBalloon:green_balloon = new green_balloon;
var oBalloon:orange_balloon = new orange_balloon;
var pBalloon:purple_balloon = new purple_balloon;
var rBalloon:red_balloon = new red_balloon;
var yBalloon:yellow_balloon = new yellow_balloon;
var balloonList:Array = [bBalloon, gBalloon, oBalloon,
pBalloon, rBalloon, yBalloon, bBalloon, gBalloon,
oBalloon, pBalloon, rBalloon, yBalloon, bBalloon,
gBalloon, oBalloon, pBalloon];
var balloonY:Array = [144, -205, -265, -325];
var balloonX:Array = [0, 140, 284, 428, 68, 212, 356, 500];
for (var ballY:uint = 0; ballY < balloonY.length; ballY++){ //Where balloons
for (var ballX:uint = altX; ballX < altX + BALLOON_ROW; ballX++){ //get added
var balloonName:String = ("balloon" + count);
var balloonClip:MovieClip;
balloonClip = balloonList[count];
balloonClip.x = balloonX[ballX];
balloonClip.y = balloonY[ballY];
balloonClip.name = balloonName;
addChild(balloonClip);
trace(balloonClip.parent);
trace(balloonClip + " has been added!");
balloonClip.addEventListener(MouseEvent.CLICK, balloonPop);
count++;
}
if (altX == 0) {
altX = BALLOON_ROW;
} else {
altX = 0;
}
}
function balloonPop(event:MouseEvent):void {
event.target.play();
event.target.removeEventListener(MouseEvent.CLICK, balloonPop);
}
}
I thought there might have been a problem with my balloon MovieClips, so I subbed them in the food array:
var birdSeed:blue_balloon = new blue_balloon;
var catFood:green_balloon = new green_balloon;
var chickenFeed:orange_balloon = new orange_balloon;
var chocolate:purple_balloon = new purple_balloon;
var dogFood:red_balloon = new red_balloon;
var duckFood:yellow_balloon = new yellow_balloon;
They all showed up on the stage, so there's nothing wrong with the MovieClips.
Added: The first values of balloonXArray and balloonYArray were originally -4 and -145 respectively, but when I started having problems I wanted to make sure the balloons were showing up so I set the first values to 0 and 144 the balloon height and width are both 144 and their cross (not sure on it's name) is in the top left corner.
Added: The reason why there are multiple instances of the same balloon in the balloonList is because I need four rows of four balloons, but only have six different balloons.
I know the balloons are on the stage because the debug display shows their x and y values on the viewable stage. Using trace(foodClip.parent) and trace(balloonClip.parent) shows that the balloons and food all have the same parent, MainTimeline, so I know the balloons aren't getting added to some different space.
I have searched online, but have not come across anyone with a similar problem. Thus, I am asking on this forum if anyone can tell me why my balloons will not show up on the stage.
Please and thank you.
One thing I see straight off in the baloonList is that you have the same object instances listed multiple times. Each instance can only exist on stage exactly once. If you addChild() an instance that is already on stage, the instance is first removed, then re-added at the top of the display list.
You should change:
var bBalloon:blue_balloon = new blue_balloon;
var gBalloon:green_balloon = new green_balloon;
var oBalloon:orange_balloon = new orange_balloon;
var pBalloon:purple_balloon = new purple_balloon;
var rBalloon:red_balloon = new red_balloon;
var yBalloon:yellow_balloon = new yellow_balloon;
var balloonList:Array = [bBalloon, gBalloon, oBalloon,
pBalloon, rBalloon, yBalloon, bBalloon, gBalloon,
oBalloon, pBalloon, rBalloon, yBalloon, bBalloon,
gBalloon, oBalloon, pBalloon];
to:
var balloonList:Array = [
new blue_balloon,
new green_balloon,
new orange_balloon,
new purple_balloon,
new red_balloon,
new yellow_balloon,
new blue_balloon,
new green_balloon,
new orange_balloon,
new purple_balloon,
new red_balloon,
new yellow_balloon,
new blue_balloon,
new blue_balloon,
new green_balloon,
new orange_balloon,
new purple_balloon
];

Resources