Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-09-2011, 08:15 PM   #1
0motnahp0
Registered User
 
Join Date: Apr 2011
Posts: 13
Default Error creating SWF movie file?

Hello forum.

I've been working on a little character control script for the past few weeks (still learning actionscript)

it's been working fine up until I try to edit the onKeyUp section of my script and add a couple of &&s to onKeyDown.

Now, when I try to export the movie, I get an error saying:

"Error creating SWF movie file.

Be sure the destination file is not read-only or opened by another application. Also, check that the file name is not too long."'

Everything was fine until I decided to take a break and go eat lunch. when I came back, I got this error. the only thing I added to the script were a couple of &&s.

Is there an easy solution to this problem? or is my entire save file corrupt?

Here is the section of code I'm working on:

Code:
public function Spider()
		{
			init();
		}
		function init():void
		{
			//initialize variables
			vx = 0;
			vy = 0;
			rightInnerBoundary = (stage.stageWidth / 2) + (stage.stageWidth / 4);
			leftInnerBoundary = (stage.stageWidth / 2) - (stage.stageWidth / 4);
			topInnerBoundary = (stage.stageHeight / 2) - (stage.stageHeight / 4);
			bottomInnerBoundary = (stage.stageHeight / 2) + (stage.stageHeight / 4);
			var left = false
		    var down = false
		    var right = false
		    var up = false
			
			//add event listeners
			stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
			stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
			addEventListener(Event.ENTER_FRAME, onEnterFrame);
			
			spider.gotoAndStop(10)
		}
		function onKeyDown(event:KeyboardEvent):void
		{
			if(event.keyCode == Keyboard.LEFT && right != true)
			{
				vx = -10;
				left = true;
				if(event.keyCode == Keyboard.LEFT && down!= true && up!= true)
				{
					spider.gotoAndStop(7);
				}
				
			}
			else if (event.keyCode == Keyboard.RIGHT)
			{
				vx = 10;
				right = true;
				if (event.keyCode == Keyboard.RIGHT && down!= true && up!= true)
				{
					spider.gotoAndStop(3);
				}
			}
			else if (event.keyCode == Keyboard.UP)
			{
				vy = -10;
				up = true;
				if (event.keyCode == Keyboard.UP && right != true && left!= true)
				{
					spider.gotoAndStop(5)
				}
			}
			else if (event.keyCode == Keyboard.DOWN)
			{
				vy = 10;
				down = true
				if (event.keyCode == Keyboard.DOWN && right != true && left!= true)
				{
					spider.gotoAndStop(1)
				}
			}
			if(left == true && down == true)
			{
				spider.gotoAndStop(8)
			}
			else if(right == true && down == true)
			{
				spider.gotoAndStop(2)
			}
			else if(right == true && up == true)
			{
				spider.gotoAndStop(4)
			}
			else if(left == true && up == true)
			{
				spider.gotoAndStop(6)
			}
		}
		function onKeyUp(event:KeyboardEvent):void
		{
			if (event.keyCode == Keyboard.LEFT && right != false)
			{
				vx = 0;
				left = false;
				if(event.keyCode == Keyboard.LEFT && up != true && down != true) 
				{
				    spider.gotoAndStop(16)
				}
				else if(event.keyCode == Keyboard.LEFT && up == true && down != true)
				{
					spider.gotoAndStop(5)
				}
				else if(event.keyCode == Keyboard.LEFT && up != true && down == true)
				{
					spider.gotoAndStop(1)
				}
			}
			else if(event.keyCode == Keyboard.RIGHT && left != true)
			{
				vx = 0;
				right = false
				if (event.keyCode == Keyboard.RIGHT && up != true && down != true)
				{
					spider.gotoAndStop(12);
				}
				else if (event.keyCode == Keyboard.RIGHT && up == true && down != true)
				{
					spider.gotoAndStop(5);
				}
				else if (event.keyCode == Keyboard.RIGHT && up != true && down == true)
				{
					spider.gotoAndStop(1);
				}
			}
			else if (event.keyCode == Keyboard.DOWN && up != true)
			{
				vy = 0;
				down = false
				if (event.keyCode == Keyboard.DOWN && right != true && left != true)
				{
					spider.gotoAndStop(10)
				}
				else if (event.keyCode == Keyboard.DOWN && right == true && left != true)
				{
					spider.gotoAndStop(3)
				}
				else if (event.keyCode == Keyboard.DOWN && right != true && left == true)
				{
					spider.gotoAndStop(7)
				}
			}
			else if (event.keyCode == Keyboard.UP && down != true)
			{
				vy = 0;
				spider.gotoAndStop(14)
				up = false
				if (event.keyCode == Keyboard.UP && right != true && left != true)
				{
					spider.gotoAndStop(14)
				}
				else if (event.keyCode == Keyboard.UP && right == true && left != true)
				{
					spider.gotoAndStop(3)
				}
				else if (event.keyCode == Keyboard.UP && right != true && left == true)
				{
					spider.gotoAndStop(7)
				}
			}
		}
Any Help would be appreciated.

thanks.
0motnahp0 is offline   Reply With Quote
Old 04-09-2011, 08:34 PM   #2
sparX
!Senior Member
 
Join Date: Jan 2010
Posts: 1,675
Default

wow, a lot of conditions for one poor little spider...

is this code in an .as file or a framescript?

not that it fits the error, but what are these
var left = false
var down = false
var right = false
var up = false
doing there?
Do you have other properties with the same id on the object?
If you don't, you better make them as the other functions can't see them hiding in there.
sparX is offline   Reply With Quote
Old 04-09-2011, 09:38 PM   #3
0motnahp0
Registered User
 
Join Date: Apr 2011
Posts: 13
Default helloes

The variables- up, down, left, and right are boolean variables I made to become true when the appropriate key is pressed so I could use the up, down, right or left in if statements to try and get the spider to move properly.

The code is a part of my only .as file. it seemed to work up until a little while ago.
0motnahp0 is offline   Reply With Quote
Old 04-09-2011, 09:40 PM   #4
0motnahp0
Registered User
 
Join Date: Apr 2011
Posts: 13
Default ... nevermind... the error went away when i left it for a while and came back to it

... nevermind... the error went away when i left it for a while and came back to it.

thanks though.
0motnahp0 is offline   Reply With Quote
Old 04-09-2011, 09:45 PM   #5
sparX
!Senior Member
 
Join Date: Jan 2010
Posts: 1,675
Default

So is this happening right now?
Sorry, it's breakfast time here, don't know when your lunch is...

If that's the case then the error probably is valid & the file is just locked by some app, try closing whatever might be using it down or reboot or something.

But as far as those Booleans go then you will have to promote them to class members, like I said, they are only relevant to the function they are defined in where they are.

edit: ok then, well nvm...
sparX is offline   Reply With Quote
Old 07-03-2013, 06:39 PM   #6
Scripty123
Registered User
 
Join Date: Jul 2013
Posts: 1
Default error creating swf movie file

When I try and make a virtual world, it says error creating swf movie file
Scripty123 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:38 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.