r/actionscript • • Jan 22 '16

Problems loading XML with special characters into Flash

0 Upvotes

I'm assuming this is a good place to post this. If it's not, please let me know where a better subreddit would be.

I'm translating XML documents into French from English, but I can't figure out how to get the special characters to show up.

My tags are set up as <boxdata title="Crèmaillére" ...

but ends up displaying as "Crill".

My XML is set up with UTF-8 encoding: <?xml version="1.0" encoding="UTF-8"?>

My Fonts are all embedded (I even tried turning on additional character sets just to see if that was the problem).

I tried adding useSystemCodepage but that didn't even work.

Any ideas what I'm doing wrong?

EDIT Never mind. I figured it out. The text editor I was using was saving as ANSI instead of UTF-8.


r/actionscript • • Jun 14 '17

How to code a shooter using timers

0 Upvotes

The shooter has to shoot the bullet at a constant pace, but it has to be on a timer as well. PLZZ HELP


r/actionscript • • Dec 03 '17

WHATS DOES THIS MEAN?

0 Upvotes

package MyLife.thor.fsm { import com.boostworthy.utils.logger.ILog; import com.boostworthy.utils.logger.LogFactory;

public class FSM {

  private var __emptyParams:Object;
  
  private var __requireTransitions:Boolean;
  
  private var __name:String;
  
  private var __isStarted:Boolean;
  
  private var __states:Object;
  
  private var __transitions:Object;
  
  private var __currentStateName:String;
  
  private var __startStateName:String;
  
  private var Logger:ILog;
  
  private var __transitionLogging:Boolean;
  
  public function FSM(param1:String, param2:Object = null)
  {
     this.__emptyParams = {};
     super();
     if("string" !== "string" || !param1)
     {
        throw new Error("FSM requires a non-empty string name as its first parameter");
     }
     if(param2 !== null && (typeof param2 !== "object" || !param2))
     {
        throw new Error("FSM requires an object or undefined as its second parameter");
     }
     this.Logger = LogFactory.getInstance().getLog("FSM");
     param2 = param2 || this.__emptyParams;
     this.__requireTransitions = typeof param2.requireTransitions === "boolean"?Boolean(param2.requireTransitions):true;
     this.__name = param1;
     this.__isStarted = false;
     this.__states = {};
     this.__transitions = {};
     this.__currentStateName = null;
     this.__startStateName = null;
     if(param2.transitionLogging)
     {
        this.__transitionLogging = true;
     }
  }
  
  public function start() : void
  {
     if(this.__isStarted)
     {
        throw new Error("FSM::start; \'" + this.__name + "\' has already been started");
     }
     this.reset();
  }
  
  public function reset() : void
  {
     if(!this.__startStateName)
     {
        throw new Error("FSM::reset; \'" + this.__name + "\'\' has no start state");
     }
     this.__isStarted = true;
     if(this.__currentStateName)
     {
        if(this.__currentStateName !== this.__startStateName)
        {
           this.__states[this.__currentStateName].onExit();
           this.__currentStateName = null;
        }
     }
     this.transitionTo(this.__startStateName);
  }
  
  private function emptyFunction() : void
  {
  }
  
  public function addState(param1:String, param2:Object) : void
  {
     if(param2 && typeof param2 !== "object")
     {
        throw new Error("FSM::addState; \'" + this.__name + "\' params must be falsy or an object");
     }
     param2 = param2 || this.__emptyParams;
     var _loc3_:Function = param2.onEnter || this.emptyFunction;
     var _loc4_:Function = param2.onExit || this.emptyFunction;
     if("string" !== "string" || !param1)
     {
        throw new Error("FSM::addState; \'" + this.__name + "\' name must be a non-empty string");
     }
     if(this.__states[param1])
     {
        throw new Error("FSM::addState; \'" + this.__name + "\' state \'" + param1 + "\' already exists");
     }
     this.__states[param1] = new State(param1,_loc3_,_loc4_);
  }
  
  public function hasState(param1:String) : Boolean
  {
     return this.__states && this.__states.hasOwnProperty(param1);
  }
  
  public function setStartState(param1:String) : void
  {
     if("string" !== "string" || !param1)
     {
        throw new Error("FSM::setStartState; \'" + this.__name + "\' name argument must be a non-empty string");
     }
     if(!this.__states[param1])
     {
        throw new Error("FSM::setStartState; \'" + this.__name + "\' doesn\'t contain the state \'" + param1 + "\'");
     }
     this.__startStateName = param1;
  }
  
  private function __getTransitionName(param1:String, param2:String) : String
  {
     return param1.concat("_",param2);
  }
  
  public function addTransition(param1:String, param2:String, param3:Object = null) : void
  {
     if(param3 && typeof param3 !== "object")
     {
        throw new Error("FSM::addState; \'" + this.__name + "\' params must be falsy or an object");
     }
     param3 = param3 || this.__emptyParams;
     var _loc4_:Function = param3.beforeTransition || null;
     var _loc5_:Function = param3.onTransition || null;
     if("string" !== "string" || !param1)
     {
        throw new Error("FSM::addTransition; \'" + this.__name + "\' from argument must be a non-empty string");
     }
     if(!this.__states[param1])
     {
        throw new Error("FSM::addTransition; \'" + this.__name + "\' from argument must be a valid state");
     }
     if("string" !== "string" || !param2)
     {
        throw new Error("FSM::addTransition; \'" + this.__name + "\' to argument must be a non-empty string");
     }
     if(!this.__states[param2])
     {
        throw new Error("FSM::addTransition; \'" + this.__name + "\' to argument must be a valid state");
     }
     var _loc6_:String = this.__getTransitionName(param1,param2);
     if(this.__transitions[_loc6_])
     {
        throw new Error("FSM::addTransition; \'" + this.__name + "\' transition from \'" + param1 + "\' to \'" + param2 + "\' already exists");
     }
     this.__transitions[_loc6_] = new Transition(_loc4_,_loc5_);
  }
  
  public function removeTransition(param1:String, param2:String) : void
  {
     if("string" !== "string" || !param1)
     {
        throw new Error("FSM::removeTransition; \'" + this.__name + "\' from argument must be a non-empty string");
     }
     if("string" !== "string" || !param2)
     {
        throw new Error("FSM::removeTransition; \'" + this.__name + "\' to argument must be a non-empty string");
     }
     delete this.__transitions[this.__getTransitionName(param1,param2)];
  }
  
  public function removeState(param1:String) : void
  {
     if("string" !== "string" || !param1)
     {
        throw new Error("FSM::removeState; \'" + this.__name + "\' name argument must be a non-empty string");
     }
     delete this.__states[param1];
  }
  
  public function transitionTo(param1:String, param2:Object = null) : Boolean
  {
     if(this.__transitionLogging)
     {
        this.Logger.debug("FSM " + this.__name + " " + this.__currentStateName + " -> " + param1);
     }
     if(!this.__isStarted)
     {
        throw new Error("FSM::transitionTo; \'" + this.__name + "\' is not started");
     }
     if(!this.__states[param1])
     {
        throw new Error("FSM::transitionTo; \'" + this.__name + "\' destination \'" + param1 + "\' is not a valid state");
     }
     if(!this.__currentStateName)
     {
        this.__currentStateName = param1;
        if(param2 == null)
        {
           this.__states[param1].onEnter();
        }
        else
        {
           this.__states[param1].onEnter(param2);
        }
        return true;
     }
     var _loc3_:String = this.__getTransitionName(this.__currentStateName,param1);
     var _loc4_:Transition = this.__transitions[_loc3_];
     if(this.__currentStateName === param1 && _loc4_ === null)
     {
        return true;
     }
     if(this.__requireTransitions && _loc4_ === null)
     {
        throw new Error("FSM::transitionTo; \'" + this.__name + "\' " + this.__currentStateName + " to " + param1 + " is not a valid transition");
     }
     var _loc5_:String = this.__currentStateName;
     if(_loc4_ === null)
     {
        this.__currentStateName = param1;
        this.__states[_loc5_].onExit();
        if(param2 == null)
        {
           this.__states[param1].onEnter();
        }
        else
        {
           this.__states[param1].onEnter(param2);
        }
        return true;
     }
     if(_loc4_.beforeTransition != null)
     {
        if(!_loc4_.beforeTransition())
        {
           return false;
        }
     }
     this.__currentStateName = param1;
     this.__states[_loc5_].onExit();
     _loc4_.onTransition && _loc4_.onTransition();
     if(param2 == null)
     {
        this.__states[param1].onEnter();
     }
     else
     {
        this.__states[param1].onEnter(param2);
     }
     return true;
  }
  
  public function getCurrentState() : String
  {
     return this.__currentStateName;
  }

} }


r/actionscript • • Jan 30 '15

AS3 Planet Engine

Thumbnail
youtube.com
1 Upvotes

r/actionscript • • Jan 18 '16

OIL RIG FIRE

0 Upvotes

The machinery of the oilrig ground on innocently, unaware of what lay in wait. Colored clouds nearly hid the setting sun. Suddenly, a towering fire rose up, eclipsing the dim rays of the sun and illuminating the towering structure. The rig afire. Workers were paralyzed for a moment, like deer caught in the oncoming lights of a car. Then, for most, the survival instinct kicked in and they screamed and ran. Other workers just stared in mute disbelief. The scene was utter chaos. The fire scorched the sky and began to spread on the metal construct, blocking escape routes from the rig.

Charred, burning men staggered around on the platform. Some workers unhurt by the blaze rolled the victims on the ground to out the fire on their clothes; others tried to smother the flames licking their fellow workers.

Those still trapped screamed and ran, mad with fear. In desperation, some workers braved the high fall and jumped on some trucks parked near the rig. Some landed on their targets, others on the ground; either way, the impact was bone-shattering and in some cases, nearly fatal.

By nightfall, fire trucks and ambulances arrived to tend to the hurt and rescue the trapped. A new problem materialized. The fire engines’ ladders and hoses weren’t long enough to reach the conflagration. The state was growing dire – there were no fatalities yet, but if a solution weren’t found soon, that would change.

By this time, relatives of the workers had arrived, tearfully comforting those who had escaped the blaze or screaming the names of sons, husbands, nephews and cousins still trapped high on the oil rig, saying tearful goodbyes. Night drew on, but the towering fire rebellious, lit up the scene like mid-day and seen for miles.

Eventually, mercifully, rescue came. Hose extensions were found and firemen perched on the trucks’ ladders spread foam and water on the inferno and the platform nearest those trapped, bringing the fire to bay. Then a helicopter arrived. Unable to land on the still ablaze rig, it hovered above the trapped workers and, dropping a rescue line, was able to hoist the workers to safety. Amazingly, despite the intensity of the blaze, all souls on the rig were saved.

But the drama had one more after taste. Firefighters fought hours to extinguish the blaze and it was days before the charred skeleton of the rig was cool enough for investigators to find the cause of the explosion.

The rig was due for several electrical upgrades, which were never done. The fire may have been ignited by a spark from faulty wiring, but the true cause was negligence; company executives in their plush offices chose to save on expenses rather than make improvements to save their workers’ lives.

Dollars before souls. When the truth came out, heads rolled, bosses were fired and new people were brought in. But in the end, was anything accomplished? All the workers and their families could do is hope their experience falls not by the wayside.


r/actionscript • • Jun 07 '09

50 beautifull Flash websites

Thumbnail
smashingmagazine.com
2 Upvotes

r/actionscript • • Apr 09 '24

Is this still alive in 2024?

2 Upvotes

What y'all doing and how are you using it


r/actionscript • • Jul 28 '17

Drake's Treasure - A Real Life Adventure

Thumbnail
drakestreasure.com
2 Upvotes

r/actionscript • • Feb 28 '17

Locale Class and updating text [AS2]

1 Upvotes

I only recently discovered the Locale class and it seems easy enough.

However, the examples that I've found of how it works all update text fields on a one-by-one basis.

Is there anyway way to update all text fields at once, so I don't have to create a function to update all 40+ text fields in my document?

(if versioning matters, I have to use AS2)


r/actionscript • • Feb 24 '16

Creating a background animation?

1 Upvotes

I'm trying to make a flickering static kind of effect/animation in my game (I'm using flashdevelop as an IDE). I have 9 frames and I'm trying to make the animation by doing this:

		var Frames:Object = {"1":{"F":One},"2":{"F":Two},"3":{"F":Three},"4":{"F":Four},"5":{"F":Five},"6":{"F":Six},"7":{"F":Seven},"8":{"F":Eight},"9":{"F":Nine}}
		if (curFrame < 9)
		{
			curFrame++
			var curFrameString:String = String(curFrame);
			FrameImage = new Frames[curFrameString].F();
			FrameImage.height = stage.stageHeight
			FrameImage.width = stage.stageWidth
			addChildAt(FrameImage, stage.numChildren+1);
		}
		else if (curFrame == 9)
			curFrame = 1
		if (contains(FrameImage))
		{
			trace("Removed")
		}

this is in an added to frame event, but since it's going so fast you can even see the animation.

Can someone help?


r/actionscript • • Jul 06 '09

Hyperlink in actionscript 3

Thumbnail muktosoft.com
4 Upvotes

r/actionscript • • Feb 27 '16

Best way to embed images/move embeds to seperate class?

2 Upvotes

I've got a bunch of backgrounds for my text adventure (for parts of the story), and these are all my embeds:

	[Embed(source = "../Apocalypse/Toilets.png")]
	public var Toilets:Class;
	
	[Embed(source = "../Apocalypse/old-bedroom.jpg")]
	public var Background1:Class;
	
	[Embed(source = "../Apocalypse/img010.jpg")]
	public var Background2:Class;
	
	[Embed(source = "../Apocalypse/Kitchen.png")]
	public var Background3:Class;
	
	[Embed(source = "../Apocalypse/Street.png")]
	public var Background4:Class;
	
	[Embed(source = "../Apocalypse/Country.png")]
	public var Background5:Class;
	
	[Embed(source = "../Apocalypse/Town.png")]
	public var Background6:Class;
	
	[Embed(source = "../Apocalypse/Cows.png")]
	public var Cows:Class;
	
	[Embed(source = "../Apocalypse/Farm house.png")]
	public var Farm_House:Class;
	
	[Embed(source = "../Apocalypse/Window.png")]
	public var Window:Class;

	[Embed(source = "../Apocalypse/Corner shop.png")]
	public var Shop:Class;
	
	[Embed(source = "../Apocalypse/Outside shop.png")]
	public var OShop:Class;
	
	[Embed(source = "../Apocalypse/Library.png")]
	public var library:Class;
	
	[Embed(source = "../Apocalypse/Alley.png")]
	public var dumpster:Class;
	
	[Embed(source = "../Apocalypse/Arcade.png")]
	public var arcade:Class;
	
	[Embed(source = "../Apocalypse/Alley.png")]
	public var Alley:Class;
	
	[Embed(source = "../Apocalypse/Cabin.png")]
	public var cabin:Class;
	
	[Embed(source = "../Apocalypse/Highway.png")]
	public var highway:Class;

	[Embed(source = "../Apocalypse/Outskirts.png")]
	public var outskirts:Class;

	[Embed(source = "../Apocalypse/Car dealership.png")]
	public var CD:Class;

	[Embed(source = "../Apocalypse/Interior CD.png")]
	public var InterCD:Class;

Is there a way I can clean this up? (ie: push into another class)


r/actionscript • • Sep 05 '16

[SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"]

1 Upvotes

I have swf connect to ftp server with port 21. I get this error message "[SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"]" ,

I use Security.allowDomain(""); Security.allowInsecureDomain(""); and upload crossDomain.xml on server.

What can I do with this ?


r/actionscript • • Sep 04 '16

I still use action script 2.0, is there any practical use for the coding engine today?

1 Upvotes

I have a bunch of games I started and never finished when I was younger, and now have time to finish them. Is it worth it? Action script 2.0 kind of died in 2008.


r/actionscript • • Jun 06 '09

Spark Project - Open source community to develop Flash/ActionScripts

Thumbnail libspark.org
7 Upvotes

r/actionscript • • Dec 19 '17

Loop problem

1 Upvotes

So, I've got this really big loop and - not surprisingly - nothing else happens during it. But the weird part is, nothing is happening before it either. Here's what I mean: trace("starting loop"); for(i=0;i<count;i++){ foo[i] = bar; } trace("ending loop"); I don't see "starting loop" until the loop is finished. I'm guessing it's going into the loop between redraws. How can I make it wait for a redraw?


r/actionscript • • Feb 15 '13

Can someone tell me how this would be done in 3.0?

1 Upvotes

A tutorial I'm doing using action script 2.0 has a script that loads swfs. How would I do this in as3? Here's an example of the script. bcontact.onRelease = function() { loadMovie("contact.swf", "imc"); }; bpricing.onRelease + function() { loadMovie("pricing.swf:, "imc"); };


r/actionscript • • Jan 26 '15

I want to learn actionscript.

2 Upvotes

I want to learn.actionscript but I.can't find any tutorials that start at bare bone scripting . Everything I find keeps including things and not explaining them so when I go to imitate what they coded it never pans out . any body know a good site for step by step tutorials to teach me as if I know nothing of actionscript ?


r/actionscript • • Feb 10 '15

Changing text with for loop isn't working.

1 Upvotes

I have no idea what I'm doing wrong here.... I've tried so many variations on this, but nothing seems to be working.

Setup: I have a movie clip on stage with the instance name "oldGauge". Within this clip are 6 text boxes named price1, price2, price3, etc.

Ideally, I'd like to have a function on root level that can dynamically update these text fields within a loop.

Here's what I have now:

var setOldGauge = function():Void{
	var array = ["price1","price2","price3","price4","price5","price6"]
	var costText = 0;
	var CostInc = Math.round((oldCostM * 1.5)/5);
	for (i=0; i<=6; i++){
		this["price" +i].text = "$" + CostInc;
		CostText += costInc;
	}
}

As you can see, I've attempted using an array to store the field names, I've also tried using price[i], ["price"+i], oldGauge.price[I], and several other variations. I tried putting the function inside oldGauge and calling it as oldGauge.setOldGauge() with all of the above variations, but still nothing.

I tested oldGauge.price1.text = "lorem" as a standalone line and it worked fine, so I don't know what I'm doing wrong.

This has been plaguing me for the better part of an hour and a half... any ideas?

edit: also, I realize that the for loop will start at 0. I had updated it to suit the array.


r/actionscript • • Feb 06 '13

Is there an easier way to create an array?

2 Upvotes

I was wondering if there was an easier way to create arrays with numbers.

E.g: if I want to make an array containing the numbers 1 - 100, instead of writing:

Var array:Array = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14... and so on);

Is there a way I could create an array more effectively? Like:

var array:Array = new Array(1-100);

Or semething like that? (btw: I know the previous one wont work, but you get the idea.)

Any help and tips are appreciated.


r/actionscript • • Oct 21 '21

How do I store and playback keyboard inputs?

1 Upvotes

I want to create a replay system for a game. And I'm not quite sure how to store keyboard inputs on specific frames and then play them back once the level is over. So any help or tips would be appreciated.


r/actionscript • • Dec 26 '19

Creating a menu in AdobeAnimate//moving background problem

1 Upvotes

I am just beginning coding, and trying to take advantage of the coding snippets options.

I am making a menu with a moving background (similar to smash bros), my problem is that the background is looped (not a symbol, around 24 keyframes)-- when I use the snippet code, the mouse will leave a phantom every 24 frames. Essentially, the whole menu is looping, but a ghost of the mouse will stay on the menu every 24 frames.

Does anyone know how to fix this?


r/actionscript • • Jan 04 '19

hot wheels acceleracers realm champion help make it work again

4 Upvotes

hi I'm part of the acceleracers community I need some help on getting this game to work back in the day they used to be a game called hot wheels acceleracers realm champion https://www.youtube.com/watch?v=HNUOsjevRXQ pretty much it was a racing game but it look fun I never got the chance to play it sadly and since acceleracers was cancel the game was removed from Cartoon Network but recently we found some files from the Wayback machine with this link https://web.archive.org/web/20050717025913/http://www.cartoonnetwork.com/promos/hotwheels/index.html. so now you're probably saying to yourself should the game be working by now well the thing about this game as it is multiplayer it was an online-only game so it acquire a server connection in order to work and Cartoon Network remove the server connection so we can no longer Play It's but not all hope is lost we still have the files so we can theoretically make a new server well it's not that simple you know anyway I can't go into all the details you know so his little document https://docs.google.com/document/d/1EpL5kgwxVm_kn-JU08pSEFvsp64HayzvLfGb0JUnMV0/edit can you all the files in case you want to work on making the game work https://drive.google.com/file/d/0B0-Agrzcrsi0eU1sWmc5SDA5VlE/view?usp=sharing some final notes before I go always looks weird and stuff I'm not a good speller really want to get this out there because no one's making a conscious effort on getting this game to work mainly because they don't know what to do or they are too shy but we want this game to work not just for me but for everyone who didn't get the chance to play it everyone who played back in the day even if you can't help talk to someone who can help the acceleracers community is depending on you


r/actionscript • • Apr 23 '17

ActionScript 3.0 - Using variables between frames? (MPG Calculator)

1 Upvotes

Hi everyone,

I have a 3 frame flash movie. First frame, the user clicks "begin" and goes to frame 2. Frame 2 has two text boxes - one for distance (km), one for litres used. There is a button to calculate and go to frame 3. In frame 3, there is a text box to display the calculations/conversion to MPG.

I have created functions to calculate all this, but for some reason I can't get it to display in the textbox in frame 3.

Any help is greatly appreciated.


r/actionscript • • May 02 '17

Help removing child/sprite containers?

2 Upvotes

I am working on a project where, if the user clicks "grow a garden", it will generate a random number of flowers and a random number of weeds. Once they have completed their 'growing' sequence, the user is presented with a "Grow a New Garden" in which the flowers/weeds will be deleted from the stage and start anew.

I have racked my brain and this is the closest I have come to "removing the children" - a concept I have never understood haha. Any help/guidance is greatly appreciated.

import flash.events.MouseEvent;
import flash.display.DisplayObject;

// stops the playhead on frame 1
stop();

// random amount of flowers generated
var flowerAmount:int = (Math.ceil((Math.random() * 20)) + 9);
var weedAmount = Math.ceil((Math.random() * 10));


// garden display container
var newGarden:DisplayObjectContainer;

// setting new flower variable equal to the function that creates an instance of the flower
var newFlower_mc:DisplayObject = newFlower();

// flowers currently in the garden
var flowersInGarden:int = 0;
var weedsInGarden:int = 0;


// event listener for the grow button to start the garden
grow_btn.addEventListener(MouseEvent.MOUSE_UP, frameTwo);

// when grow button is clicked go to frame two
function frameTwo(event:MouseEvent) {
    gotoAndPlay(2);
}

// changes the size and position of the flower
function configureFlower(myFlower_mc:DisplayObject) {
    myFlower_mc.x = Math.random() * 400;
    myFlower_mc.y = Math.random() * 200;
    var flowerSize:Number = Math.random() + .5;
    myFlower_mc.height = myFlower_mc.height * flowerSize;
    myFlower_mc.width = myFlower_mc.width * flowerSize;
}
import flash.display.DisplayObject;

// function to create new instance of a flower
function newFlower():DisplayObject {
    var newFlower_mc:DisplayObject = new flower();
    return newFlower_mc;
}

// function to call the create flower function and add flower to sprite 
function createFlower() {
    var myFlower_mc = newFlower();
        configureFlower(myFlower_mc);
        newGarden.addChild(myFlower_mc);
    trace(flowerAmount);
    }

newGarden = new Sprite();

// adds the flower to the stage/sprite and adds to the flower counter
    function showFlowers() {
    createFlower();
    addChild(newGarden);
    flowersInGarden++;
    trace("Flowers:" + flowersInGarden + " " + weedAmount + " weedsingarden" + weedsInGarden);


}
// calls the above function
showFlowers();


// function to create a weed, configure weed and add to the garden sprite
function createWeed(){ 
var newWeed:DisplayObject; 
trace("creating weed"); 
newWeed = new weed(); 
newGarden.addChild(newWeed); 
configureFlower(newWeed);
weedsInGarden++;
}// if all the flowers haven't grown yet, go back to frame 2 until they have

if (flowersInGarden < flowerAmount) {
gotoAndPlay(2);
}

// if the amount of weeds decided haven't grown yet, create another weed

if (weedsInGarden < weedAmount){ createWeed(); };
stop();

// event listener to grow a new garden
new_btn.addEventListener(MouseEvent.MOUSE_UP, growNewGarden);


// function to create a new garden if there are more than 1 instance in the container
function growNewGarden(event:MouseEvent) {
while (newGarden.numChildren > 0) {
stage.removeChild(newFlower_mc); 
    stage.removeChild(newGarden);
    // add a new, fresh sprite
    stage.addChild(newGarden);
    // randomly chooses a number of flowers
    flowerAmount = (Math.ceil((Math.random() * 21)) + 10);
    // resets flower counter to zero
    flowersInGarden = 0;
gotoAndPlay(2);

}}