I’m a huge beginner at flash and I’m trying to get the example to work before I can even begin making my own, but am having huge troubles.
Below is the error I’m getting when trying to test the movie. It compiles correctly but when I click on the first button I am smacked with this.
ArgumentError: Error #2108: Scene test was not found.
at flash.display::MovieClip/gotoAndStop()
at Marbles_fla::MainTimeline/nextscene()
Heres the code in the mainTimeline
package Marbles_fla
{
import flash.display.*;
import flash.events.*;
dynamic public class MainTimeline extends MovieClip
{
public var gameover:MovieClip;
public var startbutton:SimpleButton;
public var greenmarble:MovieClip;
public var redmarble:MovieClip;
public var green_xvelocity:Number;
public var green_yvelocity:Number;
public var red_xvelocity:Number;
public var red_yvelocity:Number;
public var collided:Boolean;
public function MainTimeline()
{
addFrameScript(0, this.frame1, 1, this.frame2);
return;
}// end function
public function nextscene(event:MouseEvent) : void
{
this.gotoAndStop(1, "Scene 9");
return;
}// end function
public function setgreenrandomcoordinates() : void
{
var _loc_1:* = Math.random() * this.stage.stageWidth;
var _loc_2:* = Math.random() * this.stage.stageHeight;
if (_loc_1 > 225 && _loc_1 <= 275)
{
_loc_1 = 225;
}
if (_loc_1 > 275 && _loc_1 < 325)
{
_loc_1 = 325;
}
if (_loc_2 > 150 && _loc_1 <= 200)
{
_loc_2 = 150;
}
if (_loc_2 > 200 && _loc_2 < 250)
{
_loc_2 = 250;
}
this.greenmarble.x = _loc_1;
this.greenmarble.y = _loc_2;
return;
}// end function
public function set_green_xyvelocities() : void
{
if (this.greenmarble.y == this.redmarble.y && this.greenmarble.x > this.redmarble.x)
{
this.green_yvelocity = 0;
this.green_xvelocity = -2;
}
if (this.greenmarble.y == this.redmarble.y && this.greenmarble.x < this.redmarble.x)
{
this.green_yvelocity = 0;
this.green_xvelocity = 2;
}
if (this.greenmarble.x == this.redmarble.x && this.greenmarble.y > this.redmarble.y)
{
this.green_xvelocity = 0;
this.green_yvelocity = -2;
}
if (this.greenmarble.x == this.redmarble.x && this.greenmarble.y < this.redmarble.y)
{
this.green_xvelocity = 0;
this.green_yvelocity = 2;
}
var _loc_1:* = Math.atan2(this.redmarble.y - this.greenmarble.y, this.redmarble.x - this.greenmarble.x);
this.green_xvelocity = Math.cos(_loc_1) * 2;
this.green_yvelocity = Math.sin(_loc_1) * 2;
return;
}// end function
public function startmotion(event:MouseEvent) : void
{
this.addEventListener(Event.ENTER_FRAME, this.updatemotion);
return;
}// end function
public function updatemotion(event:Event) : void
{
trace("red marble coordinates: " + this.redmarble.x + "," + this.redmarble.y);
trace("green marble coordinates: " + this.greenmarble.x + "," + this.greenmarble.y);
if (!this.collided)
{
if (this.greenmarble.hitTestObject(this.redmarble))
{
this.collided = true;
}
else
{
this.greenmarble.x = this.greenmarble.x + this.green_xvelocity;
this.greenmarble.y = this.greenmarble.y + this.green_yvelocity;
}
}
else
{
this.redmarble.x = this.redmarble.x + this.green_xvelocity;
this.redmarble.y = this.redmarble.y + this.green_yvelocity;
}
if (this.redmarble.x > this.stage.stageWidth || this.redmarble.x < 0 || this.redmarble.y > this.stage.stageHeight || this.redmarble.y < 0)
{
this.gameover.visible = true;
}
return;
}// end function
function frame1()
{
this.stop();
this.startbutton.addEventListener(MouseEvent.MOUSE_DOWN, this.nextscene);
return;
}// end function
function frame2()
{
this.collided = false;
this.gameover.visible = false;
this.redmarble.x = this.stage.stageWidth / 2;
this.redmarble.y = this.stage.stageHeight / 2;
this.setgreenrandomcoordinates();
this.set_green_xyvelocities();
this.greenmarble.addEventListener(MouseEvent.MOUSE_DOWN, this.startmotion);
return;
}// end function
}
}
Like I said I am a huge beginner so its probably something really stupid and small I’m overlooking. I upload the files if someone could take a look, would be very thankful!