Why embed video streams are not visible in my c++ program? I added WebBrowser into the program and the page that Browser should show is embed video stream. When I compile and run program, and when I press connect (button that should load web browser) it just loads black screen. That's when I use just embed video stream (valid one), when I use whole site where stream is, program loads whole site, expect stream which is black. What might be problem?
I tagged html and css in this post since they might know something about it too.
void__fastcall TForm1::Button1Click(TObject *Sender)
{
UnicodeString code, key;
int br;
code = Edit1->Text;
if (code=="C577F") br=1;
if (code=="A9967") br=2;
if (code=="G02C1") br=3;
if (code=="TB4FA") br=4;
if (code=="U3E4B") br=5;
if (code=="KR11V") br=6;
if (code=="DFF9D") br=7;
if (code=="L738D") br=8;
if (code=="AA46C") br=9;
if (code=="EC6E7") br=10;
if (code=="T7BCE") br=11;
if (code=="JT429") br=12;
if (code=="R5F2C") br=13;
if (code=="O582B") br=14;
if (code=="A1FB4") br=15;
switch(br)
{
case 1:
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=1";
break;
case 2:
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=2";
break;
case 3:
key="3";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=3";
break;
case 4:
key="4";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=4";
break;
case 5:
key="5";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=5";
break;
case 6:
key="6";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=6";
break;
case 7:
key="7";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=7";
break;
case 8:
key="8";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=8";
break;
case 9:
key="9";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=9";
break;
case 10:
key="10";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=10";
break;
case 11:
key="11";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=11";
break;
case 12:
key="12";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=12";
break;
case 13:
key="13";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=13";
break;
case 14:
key="14";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=14";
break;
case 15:
key="15";
WebBrowser1->URL = "https://live-sports-stream.net/embed/video.php?channel=15";
break;
default:
ShowMessage("Code not valid. Contact #account on instagram for a new one.");
}
}
Related
I am taking in a text file with hex like this
the point of the program is to convert these values to mips instructions. Is there a better way to rewrite or improve my code? I am fairly new to c# and would like to see if I can improve this program.
Return an IEnumerable<T> and yield
public static IEnumerable<string> GetCode(IEnumerable<string> lines)
{
foreach (var line in Lines)
{
var binary = Convert.ToUInt32(line, 16);
var opCode = binary >> 26;
var funCode = binary & 0x3f;
var rs = (binary >> 21) & 31;
var rt = (binary >> 16) & 31;
var rd = (binary >> 11) & 31;
int nImm = (short)(binary & 0xffff);
var jImm = (binary & 0x03ffffff) << 2;
switch (opCode)
{
case 0x00:
switch (funCode)
{
case 0x0c: yield return "syscall"; break;
case 0x20: yield return $"add\t{_reg[rd]}, {_reg[rs]}, {_reg[rt]}"; break;
} break;
case 0x02: yield return $"j\t0x00{jImm:x04}"; break;
case 0x04: yield return $"beq\t{_reg[rs]}, {_reg[rt]}, 0x{nImm:x04}"; break;
case 0x08: yield return $"addi\t{_reg[rt]}, {_reg[rs]}, {nImm}"; break;
case 0x0d: yield return $"ori\t{_reg[rt]}, {_reg[rs]}, 0x{nImm:x04}"; break;
case 0x0f: yield return $"lui\t{_reg[rt]}, 0x{nImm:x04}"; break;
case 0x23: yield return $"lw\t{_reg[rt]}, {nImm}({_reg[rs]})"; break;
case 0x2b: yield return $"sw\t{_reg[rt]}, {nImm}({_reg[rs]})"; break;
}
}
}
I have this small project. Frames that change every time I click button, and a simulation of progress bar inside arrows.
stop();
/** initializtios **/
var trans:ColorTransform = next_arrow.transform.colorTransform;
var p:int = 1;
var myColorTransform = new ColorTransform();
myColorTransform.color = 0x42f498;
var trans1:ColorTransform = back_arrow.transform.colorTransform;
/** actual code **/
btn_next_arrow.addEventListener(MouseEvent.CLICK, function goNextLectFrame(e:MouseEvent):void {
if (p==1) {
fill_1.transform.colorTransform = myColorTransform;
fill_22.alpha = 0.00001;
fill_3.alpha = 0.00001;
fill_33.alpha = 0.00001;
fill_5.alpha = 0.00001;
fill_6.alpha = 0.00001;
fill_7.alpha = 0.00001;
fill_8.alpha = 0.00001;
fill_9.alpha = 0.00001;
fill_10.alpha = 0.00001;
fill_11.alpha = 0.00001;
fill_12.alpha = 0.00001;
fill_13.alpha = 0.00001;
fill_14.alpha = 0.00001;
fill_151.alpha = 0.00001;
++p;
}
switch (currentFrame) {
case 1:
gotoAndStop(2);
break;
case 2:
fill_22.transform.colorTransform = myColorTransform;
gotoAndStop(3);
break;
case 3:
fill_3.transform.colorTransform = myColorTransform;
gotoAndStop(4);
break;
case 4:
fill_33.transform.colorTransform = myColorTransform;
gotoAndStop(5);
break;
case 5:
fill_5.transform.colorTransform = myColorTransform;
gotoAndStop(6);
break;
case 6:
fill_6.transform.colorTransform = myColorTransform;
gotoAndStop(7);
break;
case 7:
fill_7.transform.colorTransform = myColorTransform;
gotoAndStop(8);
break;
case 8:
fill_8.transform.colorTransform = myColorTransform;
gotoAndStop(9);
break;
case 9:
fill_9.transform.colorTransform = myColorTransform;
gotoAndStop(10);
break;
case 10:
fill_10.transform.colorTransform = myColorTransform;
gotoAndStop(11);
break;
case 11:
fill_11.transform.colorTransform = myColorTransform;
gotoAndStop(12);
break;
case 12:
fill_12.transform.colorTransform = myColorTransform;
gotoAndStop(13);
break;
case 13:
fill_13.transform.colorTransform = myColorTransform;
gotoAndStop(14);
break;
case 14:
fill_14.transform.colorTransform = myColorTransform;
gotoAndStop(15);
break;
case 15:
fill_151.transform.colorTransform = myColorTransform;
gotoAndStop(16);
break;
case 16:
gotoAndStop(17);
break;
}
});
btn_next_arrow.addEventListener(MouseEvent.MOUSE_OVER, function hovering(e:MouseEvent):void {
trans.color = uint(0x606266);
next_arrow.transform.colorTransform = trans;
});
btn_back_arrow.addEventListener(MouseEvent.MOUSE_OVER, function hovering1(e:MouseEvent):void {
trans1.color = uint(0x606266);
back_arrow.transform.colorTransform = trans1;
});
btn_next_arrow.addEventListener (MouseEvent.MOUSE_OUT, function hideShadow(event:MouseEvent):void {
trans.color = uint(0x999999);
next_arrow.transform.colorTransform = trans;
});
btn_back_arrow.addEventListener (MouseEvent.MOUSE_OUT, function hideShadow1(event:MouseEvent):void {
trans1.color = uint(0x999999);
back_arrow.transform.colorTransform = trans1;
});
btn_back_arrow.addEventListener(MouseEvent.CLICK, function goPrevLectFrame(e:MouseEvent):void {
switch(currentFrame){
case 2:
gotoAndStop(1);
break;
case 3:
gotoAndStop(2);
break;
case 4:
gotoAndStop(3);
break;
case 5:
gotoAndStop(4);
break;
case 6:
gotoAndStop(5);
break;
case 7:
gotoAndStop(6);
break;
case 8:
gotoAndStop(7);
break;
case 9:
gotoAndStop(8);
break;
case 10:
gotoAndStop(9);
break;
case 11:
gotoAndStop(10);
break;
case 12:
gotoAndStop(11);
break;
case 13:
gotoAndStop(12);
break;
case 14:
gotoAndStop(13);
break;
case 15:
gotoAndStop(14);
break;
case 16:
gotoAndStop(15);
break;
}
});
btn_main_menu.addEventListener(MouseEvent.CLICK, function goPrevLectFrame1(e:MouseEvent):void {
gotoAndStop(17);
});
The problem is when I get to the last frame and click the next button, it says:
TypeError: Error #1009: ... "null". at
Function/()[RECOVER_shitty_fla.MainTimeline::frame1:114]
That's a problem causing function:
btn_next_arrow.addEventListener (MouseEvent.MOUSE_OUT, function hideShadow(event:MouseEvent):void {
trans.color = uint(0x999999);
next_arrow.transform.colorTransform = trans; // LINE 114
});
I'm really struggling here, will appreciate any help, thank in advance.
You need to remove the event listeners before entering the final frame. Your program is still listening for MouseEvents on objects that do not exist on that frame.
Additionally, I'd heed #BadFeelingAboutThis's advice. Inline functions are bad practice and should generally be avoided.
There are other problems with this code (mostly minor). I've tweaked your code from the FLA document to get the program working. See the changes below.
Frames 1-16
stop();
import flash.events.MouseEvent;
import flash.system.fscommand;
import flash.display.StageScaleMode;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.geom.ColorTransform;
/** initializtios **/
var trans:ColorTransform = next_arrow.transform.colorTransform;
var p:int = 1;
var myColorTransform = new ColorTransform();
myColorTransform.color = 0x42f498;
var trans1:ColorTransform = back_arrow.transform.colorTransform;
/** actual code **/
btn_next_arrow.addEventListener(MouseEvent.CLICK, goNextLectFrame);
function goNextLectFrame(e:MouseEvent):void {
if (p==1) {
fill_1.transform.colorTransform = myColorTransform;
fill_22.alpha = 0.00001;
fill_3.alpha = 0.00001;
fill_33.alpha = 0.00001;
fill_5.alpha = 0.00001;
fill_6.alpha = 0.00001;
fill_7.alpha = 0.00001;
fill_8.alpha = 0.00001;
fill_9.alpha = 0.00001;
fill_10.alpha = 0.00001;
fill_11.alpha = 0.00001;
fill_12.alpha = 0.00001;
fill_13.alpha = 0.00001;
fill_14.alpha = 0.00001;
fill_151.alpha = 0.00001;
++p;
}
switch (currentFrame) {
case 1:
gotoAndStop(2);
break;
case 2:
fill_22.transform.colorTransform = myColorTransform;
gotoAndStop(3);
break;
case 3:
fill_3.transform.colorTransform = myColorTransform;
gotoAndStop(4);
break;
case 4:
fill_33.transform.colorTransform = myColorTransform;
gotoAndStop(5);
break;
case 5:
fill_5.transform.colorTransform = myColorTransform;
gotoAndStop(6);
break;
case 6:
fill_6.transform.colorTransform = myColorTransform;
gotoAndStop(7);
break;
case 7:
fill_7.transform.colorTransform = myColorTransform;
gotoAndStop(8);
break;
case 8:
fill_8.transform.colorTransform = myColorTransform;
gotoAndStop(9);
break;
case 9:
fill_9.transform.colorTransform = myColorTransform;
gotoAndStop(10);
break;
case 10:
fill_10.transform.colorTransform = myColorTransform;
gotoAndStop(11);
break;
case 11:
fill_11.transform.colorTransform = myColorTransform;
gotoAndStop(12);
break;
case 12:
fill_12.transform.colorTransform = myColorTransform;
gotoAndStop(13);
break;
case 13:
fill_13.transform.colorTransform = myColorTransform;
gotoAndStop(14);
break;
case 14:
fill_14.transform.colorTransform = myColorTransform;
gotoAndStop(15);
break;
case 15:
fill_151.transform.colorTransform = myColorTransform;
btn_next_arrow.removeEventListener(MouseEvent.MOUSE_OVER, hovering);
btn_next_arrow.removeEventListener(MouseEvent.MOUSE_OUT, hideShadow);
btn_back_arrow.removeEventListener(MouseEvent.MOUSE_OVER, hovering1);
btn_back_arrow.removeEventListener(MouseEvent.MOUSE_OUT, hideShadow1);
gotoAndStop(16);
break;
case 16:
gotoAndStop(17);
break;
}
}
btn_next_arrow.addEventListener(MouseEvent.MOUSE_OVER, hovering);
function hovering(e:MouseEvent):void {
trans.color = uint(0x606266);
next_arrow.transform.colorTransform = trans;
}
btn_back_arrow.addEventListener(MouseEvent.MOUSE_OVER, hovering1);
function hovering1(e:MouseEvent):void {
trans1.color = uint(0x606266);
back_arrow.transform.colorTransform = trans1;
}
btn_next_arrow.addEventListener (MouseEvent.MOUSE_OUT, hideShadow);
function hideShadow(event:MouseEvent):void {
trans.color = uint(0x999999);
next_arrow.transform.colorTransform = trans;
}
btn_back_arrow.addEventListener (MouseEvent.MOUSE_OUT, hideShadow1);
function hideShadow1(event:MouseEvent):void {
trans1.color = uint(0x999999);
back_arrow.transform.colorTransform = trans1;
}
btn_back_arrow.addEventListener(MouseEvent.CLICK, goPrevLectFrame);
function goPrevLectFrame(e:MouseEvent):void {
switch(currentFrame){
case 2:
gotoAndStop(1);
break;
case 3:
gotoAndStop(2);
break;
case 4:
gotoAndStop(3);
break;
case 5:
gotoAndStop(4);
break;
case 6:
gotoAndStop(5);
break;
case 7:
gotoAndStop(6);
break;
case 8:
gotoAndStop(7);
break;
case 9:
gotoAndStop(8);
break;
case 10:
gotoAndStop(9);
break;
case 11:
gotoAndStop(10);
break;
case 12:
gotoAndStop(11);
break;
case 13:
gotoAndStop(12);
break;
case 14:
gotoAndStop(13);
break;
case 15:
gotoAndStop(14);
break;
case 16:
gotoAndStop(15);
break;
}
}
btn_main_menu.addEventListener(MouseEvent.CLICK, goPrevLectFrame1);
function goPrevLectFrame1(e:MouseEvent):void {
gotoAndStop(17);
}
Frame 17
stop();
import flash.events.MouseEvent;
btn_goto_lect1.alpha = 0.00001;
btn_goto_pract.alpha = 0.00001;
btn_goto_lect1.addEventListener (MouseEvent.MOUSE_OVER, showShadow);
function showShadow(event:MouseEvent):void {
btn_goto_lect1.alpha = 1;
}
btn_goto_lect1.addEventListener (MouseEvent.MOUSE_OUT, hideShadow_);
function hideShadow_(event:MouseEvent):void {
btn_goto_lect1.alpha = 0.00001;
}
btn_goto_pract.addEventListener (MouseEvent.MOUSE_OVER, showShadow1);
function showShadow1(event:MouseEvent):void {
btn_goto_pract.alpha = 1;
}
btn_goto_pract.addEventListener (MouseEvent.MOUSE_OUT, hideShadow2);
function hideShadow2(event:MouseEvent):void {
btn_goto_pract.alpha = 0.00001;
}
btn_goto_lect1.addEventListener (MouseEvent.CLICK, showShadow3);
function showShadow3(event:MouseEvent):void {
btn_goto_lect1.removeEventListener (MouseEvent.MOUSE_OVER, showShadow);
btn_goto_lect1.removeEventListener (MouseEvent.MOUSE_OUT, hideShadow_);
btn_goto_pract.removeEventListener (MouseEvent.MOUSE_OVER, showShadow1);
btn_goto_pract.removeEventListener (MouseEvent.MOUSE_OUT, hideShadow2);
gotoAndStop(1);
}
I'm making a top-down RPG style game, very much a throwback to zelda. This is my code for the movement controls based on keyboard controls. The movement itself is pretty solid, no stutter-key syndrome, all animations are triggered correctly.
However, when the attack button (SPACE in this case) is pressed it triggers the appropriate frame but when the key is released the corresponding frame is still visible, until another direction key is pressed. So, when you attack it looks like he keeps his sword extended until another movement is made, and so on. This should only happen when the key is held down not when simply pressed. This is not the expected result. The result I'm looking for is an attack that triggers every time the key is pressed, creating the normal buttondown=attacking, buttonup = not attacking.
The attacks and movement now are based on a variable moving:int = 4; That way I can switch the attack position to the corresponding movement direction.
Any ideas on how to correct this issue?
import flash.events.Event;
import flash.events.KeyboardEvent;
character.stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPress);// when key is pressed
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyRelease);//when key is released
stage.addEventListener(Event.ENTER_FRAME, MainLoop);
var moving:int = 4;
var movingDown:Boolean = false;
var movingUp:Boolean = false;
var movingRight:Boolean = false;
var movingLeft:Boolean = false;
function onKeyPress(e:KeyboardEvent):void
{
switch (e.keyCode)
{
case Keyboard.DOWN : movingDown = true; moving = 1; break;
case Keyboard.UP : movingUp = true; moving = 2; break;
case Keyboard.RIGHT : movingRight = true; moving = 3; break;
case Keyboard.LEFT : movingLeft = true; moving = 4; break;
case Keyboard.SPACE : handleAttack(); break;
}
}
function onKeyRelease(e:KeyboardEvent):void
{
switch (e.keyCode)
{
case Keyboard.DOWN: character.gotoAndStop(1); movingDown=false; moving = 1; break;
case Keyboard.UP: character.gotoAndStop(3);movingUp=false; moving = 2; break;
case Keyboard.LEFT: character.gotoAndStop(5);movingLeft=false; moving = 3; break;
case Keyboard.RIGHT: character.gotoAndStop(7);movingRight=false; moving = 4; break;
case Keyboard.SPACE: handleAttack(); break;
}
}
function handleAttack():void
{
switch (moving)
{
case 1: character.gotoAndStop(9); movingDown = false; break; //down
case 2: character.gotoAndStop(10); movingUp = false; break; //up
case 3: character.gotoAndStop(11); movingLeft = false; break; //left attacks
case 4: character.gotoAndStop(12); movingRight = false; break; //right
}
}
function MainLoop(e:Event):void
{
switch (true)
{
case movingDown: character.gotoAndStop(2); character.y+=4.5; break;
case movingUp: character.gotoAndStop(4); character.y-=4.5; break;
case movingLeft: character.gotoAndStop(6); character.x-=4.5; break;
case movingRight: character.gotoAndStop(8); character.x+=4.5; break;
}
}
I am kinda new myself but i think it's because both onKeyPress() and onKeyRelease() point to the same function handleAttack() and as such point to the same frame even when you release. Try making two seperate attack functions for each one.
e.g
attackPressed() for onKeyPress()
function attackPressed():void
{
switch (moving)
{
case 1: character.gotoAndStop(9); movingDown = false; break;
case 2: character.gotoAndStop(10); movingUp = false; break;
case 3: character.gotoAndStop(11); movingLeft = false; break;
case 4: character.gotoAndStop(12); movingRight = false; break;
}
}
and attackRelease() for onKeyRelease()
function attackRelease():void
{
switch (moving)
{
case 1:character.gotoAndStop(1); movingDown = false; break;
case 2:character.gotoAndStop(3); movingUp = false; break;
case 3: character.gotoAndStop(5); movingLeft = false; break;
case 4: character.gotoAndStop(7); movingRight = false; break;
}
}
Hope this helps.
I want to make a wrap around game effect where an object would go off the screen from the x-axis one side and reappear in a new y-axis position on the other side of the screen. The width is 250 pixels, so basically it would pass (0, y1) and would reappear at (300, y2).
a.applyForceToCenter(aMovement, true);
a.applyTorque(3000, true);
FixtureDef fDef = new FixtureDef();
BodyDef ballD = new BodyDef();
ballD.type = BodyType.DynamicBody;
//random location for asteroid
int aLoc = (int) (aLocation * 15);
float x = 300;
switch(aLoc)
{
case 0:
ballD.position.set(x, -105);
break;
case 1:
ballD.position.set(x, -95);
break;
case 2:
ballD.position.set(x, -80);
break;
case 3:
ballD.position.set(x, -65);
break;
case 4:
ballD.position.set(x, -50);
break;
case 5:
ballD.position.set(x, -35);
break;
case 6:
ballD.position.set(x, -20);
break;
case 7:
ballD.position.set(x, -5);
break;
case 8:
ballD.position.set(x, 10);
break;
case 9:
ballD.position.set(x, 25);
break;
case 10:
ballD.position.set(x, 40);
break;
case 11:
ballD.position.set(x, 55);
break;
case 12:
ballD.position.set(x, 70);
break;
case 13:
ballD.position.set(x, 85);
break;
default:
ballD.position.set(x, 0);
}
PolygonShape asteroid = new PolygonShape();
asteroid.setAsBox(12.5f, 12.5f);
//asteroid definition
fDef.shape = asteroid;
fDef.density = .5f;
fDef.friction = .25f;
fDef.restitution = .75f;
a = world.createBody(ballD);
a.createFixture(fDef);
a.setFixedRotation(false);
//asteroid image
aSprite = new Sprite(new Texture("img/asteroid-icon.png"));
aSprite.setSize(12.5f * 4, 12.5f * 4);
aSprite.setOrigin(aSprite.getWidth() / 2, aSprite.getHeight() / 2);
a.setUserData(aSprite);
asteroid.dispose();
It might be possible to use a mod operator on your x and y positions. The idea being that you could mod whatever your x position and y position are with the pixel value of your box. That way when your x value = maxWidth, it becomes zero, and same for the y value.
You could use the setTransform() method on the ball if it leaves the screen on one side.
Basically, after each simulation step you'd check if the ball has been moved out on one side, then setTransform() with the new position and rotation.
I'm trying to setup keyboard control for my game and ran into an interesting obstacle: When the player presses a key to move in a specific direction a delay in the physical movement occurs similar to the delay that happens when editing text.
For instance, When you hold down the "a" key (just as an example, of course it could be any key) and there is a second delay before the cursor will then register "aaaaaaa". The same problem is happening here, so when a direction key is pressed the frame animations begin before the physical movement starts. Which results in an animation that looks like the character is running in place and then finally starts moving after about a 1 or 2 seconds.
Any thoughts, ideas, or advice on a fix would be much appreciated. Thanks in advance, all.
import flash.events.Event;
import flash.events.KeyboardEvent;
character.stop();
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPress);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyRelease);
stage.addEventListener(Event.ENTER_FRAME, onEnterThisFrame);
var moving:int = 4;
var animate:Boolean = false;
function onKeyPress(e:KeyboardEvent):void
{
switch(e.keyCode)
{
case 37: moving = 1; character.gotoAndStop(6); character.x-=5; break; //left
case 38: moving = 2; character.gotoAndStop(4); character.y-=5; break; //up
case 39: moving = 3; character.gotoAndStop(8); character.x+=5; break; //right
case 40: moving = 4; character.gotoAndStop(2); character.y+=5; break; //down
case 32: handleAttack();
}
animate = false;
}
function onKeyRelease(e:KeyboardEvent):void
{
switch(moving)
{
case 1: character.gotoAndStop(6); break; //left
case 2: character.gotoAndStop(4); break; //up
case 3: character.gotoAndStop(8); break; //right
case 4: character.gotoAndStop(2); break; //down
}
animate = true;
}
function handleAttack():void
{
switch (moving)
{
case 1: character.gotoAndStop(11); break; //left
case 2: character.gotoAndStop(10); break; //up
case 3: character.gotoAndStop(12); break; //right
case 4: character.gotoAndStop(9); break; //down
}
}
function onEnterThisFrame(e:Event):void
{
if (animate == true)
{
switch (moving)
{
case 1: if(character.currentFrame == 6) character.gotoAndStop(5); break;
case 2: if(character.currentFrame == 4) character.gotoAndStop(3); break;
case 3: if(character.currentFrame == 8) character.gotoAndStop(7); break;
case 4: if(character.currentFrame == 2) character.gotoAndStop(1); break;
}
}
}
Have bools for each direction and change your onKeyPress and onKeyRelease to set these, then check them and move your character in your onEnterThisFrame function.