无法在 Flash Player 5 中发布
Posted
技术标签:
【中文标题】无法在 Flash Player 5 中发布【英文标题】:Unable to publish in flash player 5 【发布时间】:2015-06-27 15:23:56 【问题描述】:我从网上下载了这段代码。我需要将 .swf 文件导入 Director 8.5,因此需要使用支持 ActionScript 2 的 Flash Player 5 发布 Flash 文件。
动画在测试时运行流畅,但是一旦我尝试在 flash player 5 设置中发布它,它会给出一些错误,我尝试了很长时间后无法更正。
代码:
var speed:Number = 0;
var speedMax:Number = 5;
var speedMaxReverse:Number = -2;
var speedAcceleration:Number = .15;
var speedDeceleration:Number = .90;
var groundFriction:Number = .95;
var startingRotation:Number = 180;
var steering:Number = 0;
var steeringMax:Number = 8;
var steeringAcceleration:Number = .10;
var steeringFriction:Number = .98;
var velocityX:Number = 0;
var velocityY:Number = 0;
/**
* Main game loop
*/
function runGame():Void
// UP Arrow or W (accelerate)
if (Key.isDown(Key.UP) || Key.isDown(87))
//check if below speedMax
if (speed < speedMax)
//speed up
speed += speedAcceleration;
//check if above speedMax
if (speed > speedMax)
//reset to speedMax
speed = speedMax;
// DOWN Arrow or S (reverse)
if (Key.isDown(Key.DOWN) || Key.isDown(83))
//check if below speedMaxReverse
if (speed > speedMaxReverse)
//speed up (in reverse)
speed -= speedAcceleration;
//check if above speedMaxReverse
if (speed < speedMaxReverse)
//reset to speedMaxReverse
speed = speedMaxReverse;
// LEFT Arrow or A (turn left)
if (Key.isDown(Key.LEFT) || Key.isDown(65))
//turn left
steering -= steeringAcceleration;
//check if above steeringMax
if (steering > steeringMax)
//reset to steeringMax
steering = steeringMax;
// RIGHT Arrow or D (turn right)
if (Key.isDown(Key.RIGHT) || Key.isDown(68))
//turn right
steering += steeringAcceleration;
//check if above steeringMax
if (steering < -steeringMax)
//reset to steeringMax
steering = -steeringMax;
// SPACE (brake)
if (Key.isDown (Key.SPACE))
speed = speed * speedDeceleration;
// friction
speed *= groundFriction;
// prevent drift
if(speed > 0 && speed < 0.05)
speed = 0
// calculate velocity based on speed
velocityX = Math.sin (player_mc._rotation * Math.PI / 180) * speed;
velocityY = Math.cos (player_mc._rotation * Math.PI / 180) * -speed;
// update position
player_mc._x += velocityX;
player_mc._y += velocityY;
// prevent steering drift (right)
if(steering > 0)
// check if steering value is really low, set to 0
if(steering < 0.05)
steering = 0;
// prevent steering drift (left)
else if(steering < 0)
// check if steering value is really low, set to 0
if(steering > -0.05)
steering = 0;
// apply steering friction
steering = steering * steeringFriction;
// make car go straight after driver stops turning
steering -= (steering * 0.1);
// rotate
player_mc._rotation += steering * speed;
/**
* onEnterFrame function to repeat runGame() over and over
*/
player_mc.onEnterFrame = function()
runGame()
错误
场景=场景 1,层=AS,帧=1:第 21 行:预期为“” 函数runGame():Void
【问题讨论】:
我认为语法错误,“runGame();” 【参考方案1】:Flash player 5 是 Actionscript 1。它不支持 AS2。这意味着没有数据输入。我什至不确定是否有触发功能。在 AS1 上很难找到资源,但我记得使用它并使用影片剪辑时间线结构只是为了实现分支逻辑。祝你好运!
【讨论】:
以上是关于无法在 Flash Player 5 中发布的主要内容,如果未能解决你的问题,请参考以下文章
无法注册Flash player 的ActiveX控件啥意思 怎么解决?
Flash Player信任文件无法与Linux上的嵌入式浏览器一起使用
无法运行 SWF 文件。请卡在“右键单击以运行 adobe flash player”