-
Just a bit of help on this last thing
my code is
PHP Code:
stop();
stage.focus = stage;
Hammer.x = mouseX;
Hammer.y = mouseY;
Hammer.mouseEnabled = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE,redrawCursor);
stage.addEventListener(Event.ENTER_FRAME, main);
Mouse.hide();
function redrawCursor(event:MouseEvent):void
{
Hammer.x = event.stageX;
Hammer.y = event.stageY;
}
var cDepth:int = 100;
var xSpeed:Number = 4;
var stageWidth:Number = stage.stageWidth;
var stageHeight:Number = stage.stageHeight;
var thisMC:MovieClip = new Spider1_mc();
function main(event:Event):void
{
createSpider1();
}
function createSpider1():void
{
if (randRange(0, 10) == 0)
{
addChild(thisMC);
cDepth++;
thisMC.x = - thisMC.width;
thisMC.speed = xSpeed;
thisMC.y = randRange(thisMC.height,stage.stageHeight - thisMC.height);
thisMC.name = "Spider1" + cDepth;
thisMC.addEventListener(Event.ENTER_FRAME, spider1MoveHandler);
}
}
function spider1MoveHandler(event:Event):void
{
Spider1.x += 2;
Spider2.x += 2;
}
{
var Spider1MC:MovieClip = event.currentTarget as MovieClip;
if (thisMC.x > stage.stageWidth)
{
removeChild(Spider1MC);
trace("I'm here");
thisMC.removeEventListener(Event.ENTER_FRAME, spider1MoveHandler);
}
}
function randRange(minNum:Number, maxNum:Number):Number
{
return (Math.floor(Math.random()*(maxNum - minNum + 1)) +minNum);
}
The errors that i am having are:
Scene 1, Layer 'Layer 5', Frame 5 Warning: The instance name 'Spider' is declared on an object of type Spider2 but there is a conflicting use of the instance name 'Spider' on an object of type Spider1.
Scene 1, Layer 'Layer 5', Frame 5, Line 46 1119: Access of possibly undefined property x through a reference with static type Class. This error is for the line : Spider1.x += 2;
Scene 1, Layer 'Layer 5', Frame 5, Line 47 1119: Access of possibly undefined property x through a reference with static type Class. This error is for the line : Spider2.x += 2;
Scene 1, Layer 'Layer 5', Frame 5, Line 50 1120: Access of undefined property event.
This error is for the line : var Spider1MC:MovieClip = event.currentTarget as MovieClip;
I know ive asked for alot of help today.
I just need to get it done.
Thankyou
Corey
-
Senior Member
Warning: Did you give names like "Spider" on the timeline to any existing objects? The warning is not obvious from the script.
Line 46,47: You probably called movieclip classes Spider1 and Spider2, to which the errors refer. You need to use the instance names instead.
Line 50 error: You need to include "var Spider1MC:MovieClip = event.currentTarget as MovieClip; " and the rest of it inside of the spider1MoveHandler function.
- The right of the People to create Flash movies shall not be infringed. -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|