ActionScript 2.0 :: A Mouse-focus Based Pause Function For A Game?

Mar 4, 2008

So your playing a flash game that's fast paced and mouse-based (hey that rhymes somewhat)... And then you accidentally move your mouse outside of the area of the swf... And then it pauses automatically with a "Continue" button, instead of you just dying or whatever. I've thought you could have a huge button the size of the stage and make it do something when the frame isn't 'mouseover' or whatever, but there's gotta be a better way. Also setting limits on the _xmouse and _ymouse wouldn't work cos sometimes the mouse moves too fast for them to accurately get the last mouseposition...

View 8 Replies


Similar Posts:


ActionScript 3.0 :: Implementing Pause Function In Game?

Jun 8, 2011

I'm implementing a pause function in a game, it stops the main game timer and then dispatches an event ("Game_Paused") to stop a second timer. Both timers stop (and start) correctly but the second one throws a null object reference error.

Here's the ActionScript Code:
private function onAddedToStage(e:Event):void{
_timerD = new Timer(100);
_timerD.start();
_timerD.addEventListener(TimerEvent.TIMER, onUpdateTime);
stage.addEventListener("Game_Paused", onPauseGame);
[Code] .....

And this is the output:
Code:
Paused Timer=null
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.rtr.game.UI::timer_display/onPauseGame()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.display::Stage/dispatchEvent()
at com.rtr.game::Game_Timer/onKeyDown()
Paused Timer=[object Timer]

What's really confusing me is that the timer is still getting paused correctly, and the trace is showing up in the output before and after the error with two different objects.

View 2 Replies

ActionScript 3.0 :: Tile Based Game - Creating Multiple Sprites Based On Frames

Nov 17, 2009

I'm relatively new to AS3. There's one thing that I don't quite understand about Sprites. I'm making a tile based game, and all the tile graphics for a level are inside one movie clip in each frame. Would I be able to go about creating multiple sprites based on the frames in said movieclip's timeline I would I have to go through and make a separate library graphic for each.

View 2 Replies

ActionScript 1/2 :: Focus On Mouse Position When Zooming Movie Clip Using Mouse Wheel?

Oct 29, 2009

I have a map application that when I use the mouse wheel the map will scale up or scale down. The next thing I want to do is to focus on the mouse pointer while zooming on the part of the map.

I have this code...

function focusMousePosition(){    onMouseMove = function (){        Stage.width = _root._xmouse;        Stage.height = _root._ymouse;        updateAfterEvent();    }}
var mouseWheelListener = new Object();var wheelNum:Number;
mouseWheelListener.onMouseWheel = function(wheelNum){    focusMousePosition();    if (wheelNum > 0){        map._xscale *= 0.9;        map._yscale *= 0.9;    }else{        map._xscale *= 1.1;        map._yscale *= 1.1;    }}Mouse.addListener(mouseWheelListener);

View 3 Replies

ActionScript 3.0 :: Pause Stage/swf With Audio When A New Tab Is Opened/ Out Of Focus In Browser

May 16, 2011

I have created a container in Flash Professional CS5 for my project's CBT.  I've been able to script many of the features we require using AS3, but there are a couple of things I'm still trying to work out. I would like the swf presently playing in one tab to pause and go silent when another swf is opened in a new tab (the sound is inside this externally loaded swf which is loaded inside a movie clip from buttons nested a movie clip down).  I've tried :

var originalFrameRate:uint = stage.frameRate;
var standbyFrameRate:uint = 0;
addEventListener(Event.ACTIVATE, onActivate);
addEventListener(Event.DEACTIVATE, onDeactivate);

[Code].....

This function is present when I publish the CBT with Captivate, so obviously there must be code available. You can set the Captivate button to open url in new window and pause movie. Is there something I can add to the html file that is similar to the "has Priority" for mobile devices or is there javascript that can be added to the flash itself?

View 1 Replies

Flash :: Pause The Game ?

Aug 1, 2011

I have written the game. It starts at once, when running the program. EVERYTHING works in one Document Class. Now, I want to do some basic intro, for example, animated countdown before the game starts. How can I kinda pause the game? there is only one frame on the main timeline which contains the background.

View 2 Replies

ActionScript 3.0 :: How To Pause/resume A Game

Mar 29, 2009

I'm making a game, and I'm at the point where I want to add pause and resume functionality. The main onEnterFrame is no problem, but I have a bunch of objects that have their own onEnterFrame functions. These objects also have different functions, for example one for moving, the other for exploding. So each object is in a different state. I can't use hasEventListener, because it only checks for the type of event and not which function is part of the event. Is there a way I can check which functions the ENTER_FRAME event has? If a particular object doesn't have a particular function in its ENTER_FRAME event, I don't want to put it back when I resume the game. I suppose I could have a global variable that tells each function whether or not it's paused, but that feels messy since I would need an if in every single function I have.

View 2 Replies

Pause Flash Game Using Javascript

Feb 17, 2010

I'm working on a flash gaming site, BeardedGames.com. I just recently implemented a "Panic" button that makes the entire site display: none and display: block's a iframe with a allowed in school website of the user's choice.It works well so far, but the user's flash game still runs in the background while hidden. Is there a way to pause (not reset) the game, that will work on most, if not all, flash games? It needs to be accessible from javascript (possibly just javascript, or a flash wrapper?), and it has to work in IE 6 and greater (I know... I know. Can't help it.).Failed to make it clear that the user must be able to "un-pause" their game after the unpanic button is pressed.I haven't made these games, these are already made games like linerider.

View 3 Replies

ActionScript 2.0 :: Pause A Game When Switching Windows?

Oct 20, 2010

I've noticed since the last few version of flash player that when your main view isn't focused on the flash game, it tends to mess the game up.How do I make it so the game automatically pauses when I switch to a new window or lose focus.

View 6 Replies

ActionScript 2.0 :: Virtual Shooter - Pause The Game?

Mar 14, 2008

I am playing around with the Vertical Shooter by Ernesto Quezada aka _Bruno

link on kirupa: http:[url]....

how can I pause the game.I added a button, but I need the right coding in AS2

View 1 Replies

ActionScript 3.0 :: Pause Game Using Stage.framerate?

Dec 28, 2010

So mys question is this, I want to have a hidden button on a flash game where I press the 'P' key and it pauses and unpauses my flash game. To do this I want to use the stage.framerate command.... where I would pause the game by hitting the P key and setting the stage.frameRate = 0.01; and then unpause the game hitting the P key again and setting the stage.frameRate = 24;I used to tinker around in Flash stuff using as2 about 5 years ago and not touched flash since.

View 6 Replies

Actionscript 3 :: Pause Absolutely All Processes In Flash Game?

Aug 19, 2011

Like when pressing (not clicking!!!) the windows |X| button on the game window. Is that possible? Or will I have to write custom pause function? :S I have a very complicated program, and now I want to add PAUSE button.

View 3 Replies

ActionScript 3.0 :: Pause And Resume A Game When It Has More Than One Enterframe Event?

May 22, 2011

how can i pause and resume a game when it has more than one Enterframe Event?

View 2 Replies

ActionScript 3.0 :: Simulate A Pause Command For Multiple Parts Of A Game?

Oct 8, 2009

I need to simulate a pause command for multiple parts of a game I'm programming. How do I start the timer, then stop it after 10 seconds in as few lines of code as possible without using multiple functions?

View 3 Replies

ActionScript 2.0 :: Mouse Listener / Wierd Focus Bug?

Jan 26, 2009

I have a flash piece that replaces the mouse with a knife/sword graphic. When the user clicks (anywhere) the knife animates, 'slashing' the background. The click does something like..knife.gotoAndPlay(2);The animation is about 10 frames long... The problem is sometimes the click does nothing, as if it takes a single click just to focus the mouse. Rapid-clicking seems to have the desired effect if it wasn't for the aforementioned bug. I've tried a mouse listener as well as the standard on... methods and I'm still having the issue.Also, unfortunately due to client restrictions I'm having to code this flash piece in AS2 as opposed to AS3.

View 1 Replies

Flex :: Ignore Mouse Focus On Tool-tip?

Sep 27, 2011

I've created something that works like a ToolTip in my Flex application. When I roll over a certain item renderer, I pop up a new control, position it, and remove it on roll out. The order of operations is like this:

Roll over event handler triggered. Add the tooltip to this.systemManager.topLevelSystemManager.toolTipChildren. On creation complete of my tooltip, set x, set y coordinates of the tooltip (on creation complete so the width and height are calculated since they are dynamic). Roll out event handler triggered. Remove tooltip.

This worked fine when I set the x and y coordinates to be x+10, y+10 from the current mouse position. I wanted to add something that re-positioned the tool-tip if it was going to be drawn partially off screen. I added a step that would calculate if it would be drawn off screen, and re-position the tooltip if it was going to be cut off.

The problem with my solution seems to be that it now runs in an infinite loop of redraws, since adding the tool-tip to the screen underneath the mouse triggers the "rollOut" on the item renderer. This triggers the removal of the tooltip, and starts the process over again from 1.

is there any way to ignore tooltip so it doesn't take the mouse focus away from the item renderer that is now under it?

View 3 Replies

ActionScript 2.0 :: Flash8 - Pause Game As Start Point To Terminate Code

Oct 17, 2009

I'm designing a platformer game, in which the code is all held within the character MC. I want to pause the game using something like 'delete this.onEnterFrame' as a start point to terminate code. The code layout within the character is like so:

onClipEvent (enterFrame) {
...
this.onEnterFrame = function(){ //within clip event
...
if(btnon == 1){ // when button pressed(on stage)) global value of 1 is true
delete this.onEnterFrame;
}...}}

Due to the fact its within a clip event structure, it doesn't pause it, instead it slows everything down. Would I have to construct all my code in a frame layer or can I still use an MC to terminate this?

View 2 Replies

Javascript :: Flash App Receiving Mouse Events Without Focus?

May 18, 2011

Just wanted to ask is it possible for a flash app to capture mouse and keyboard events when it loses focus. I've tried putting it in a div container through SWFObject library and than used jquery forward mouse events plugin, but without success. My idea was to capture mouse events (click event) on the body and then transfer it to the flash app

View 2 Replies

ActionScript 2.0 :: AI Pathfinding For Text-Based Game?

Jun 1, 2010

Pretty much what I am looking to do is have an NPC find the shortest path from their location to the player's. Everything is turn-based, so the NPC would have the capability to move from one room to another adjacent room in one turn. Keep in mind that there would be no physical manifestation of the code, other than some text that would be displayed when the NPC enters the same room as the player.And as an added aspect if possible I would like the ability to stop NPCs from entering the same room as the player once they've reached it if the room/door/entrance is locked.So the end result would be something like this...

-------[E]
[P][ ][ ][ ][ ]

--------[ ]
[P][ ][ ][E][ ][code]..........

Only difference is that there would be no graphical representation.

View 1 Replies

C# :: How To Code An Web-browser Based Multiplayer Game

Jun 30, 2010

If I wanted to code a desktop-based game, I could pull some XNA code and UDP sockets and make a decent multiplayer game. I would have an extremely clear of how to code the game I wanted.But if I wanted to code a browser-based online multiplayer game, how would I do it?ou can't use XNA....I've been looking at some questions and I'm seeing PHP and ASP.NET and Silverlight and Flash and Java as the alternative languages...I really don't understand how it works. I mean, for a desktop-based game, you're opening a UDP socket and accepting clients and transferring data, updating player states, drawing the results using XNA. But in a browser, how do you open a socket and stuff? How does that concept work, communicating to people in realtime through a web-browser.

View 6 Replies

Create UDP And TCP Connections In A Browser-based Game?

Nov 13, 2010

I'm working on a game and want the freedom to choose between UDP and TCP connections in the future when I decide to add multiplayer. I'm not sure how something like this would work in the browser with security.

There are two scenarios I can think of for multiplayer. The first is that a player becomes the host of the game (in the browser) and thus would need to communicate with other players directly via TCP or UDP. This would save me on bandwidth costs.

The second scenario would be to have the web server host the game and pass messages back and forth to the clients again via TCP or UDP.

Do Flash or Java applets let me do something like this? If not is there an alternative I can use for the browser or am I stuck with moving to providing a game download and installation?

View 3 Replies

ActionScript 3.0 :: Tile Based Pacman Game?

Feb 28, 2010

I am trying to make a pacman game and was advised that collision detection for a game like this is much easier if you create it using a tile based methodology. I have the map created and the character moves fine around the grid. But once I added collision detection it seems to be a bit off and inconsistent. Im not entirely sure what the problem is with the collisions.

View 9 Replies

ActionScript 3.0 :: ScrollWheel Zoom With Point Of Focus At Mouse Cursor Tip?

Jun 18, 2010

Looking for code to enable zooming in/out on a graphic or movie clip using mouse scrollwheel with origin of scale change being at the mouse cursor position. I have one where it is at top left. I also require it to stay proportional, when applied to a rectangular graphic my code makes it go letterbox on zoom out!

View 3 Replies

ActionScript 2.0 :: Detect Flash Lose Focus (mouse Rollout Swf)?

Jul 29, 2005

I want my flash movie to go to a specific frame when the user moves the cursor away from the actual swf file (rollout) in the html page.
I tried different things, for instance having a big transparent movieclip in the background and use hitTest:

//this code is in the root level
this.createEmptyMovieClip('penCheck', 100000);
this.penCheck.ref = this;
this.penCheck.onEnterFrame = function() {

[code].....

This doesn't work until the user clicks outside the flash (flash loses focus).

PS: No Javascript allowed. Just AS.

View 1 Replies

IDE :: Pause And Do Mouse Over?

May 18, 2005

1. Anybody knows the action script for a Pause botton? I need a botton to pause the movie, and then play it again from you stopped when you press "pause" again.

2. how to make a mouse over effect happen? I mean when the mouse point in on a object(maybe hot area), a picture will appear, and the picture will disappear when the mouse be moved away.

View 6 Replies

ActionScript 3.0 :: Text Based Action Adventure Game?

Nov 3, 2011

I'm currently working on an action adventure game and have run into some issues. I am using flash CS4 and AS3. On the stage I have created a user input text field with the instance name of textbox and a button with the instance name of btn. I'm trying to set it up so that when the user types in a word that word is cross referenced with an array and a function is run. I have noticed that some times the functions are not run in the order there typed. For example if I type "enterdoor. lookaround." Than the following is traced.

" you have entered the door.
.
you are looking around, but don't see anything.
. "

Which is good but if I reverse the order and type "lookaround. enterdoor." then I receive the following.

"you are looking around, but don't see anything.
.
.
you have entered the door. "

Also if I were to type "gobacklookaroundenterdoor" then the following is displayed.

"go back you have entered the door. you are looking around, but don't see anything."

Notice that the function "enterdoor" is run before "lookaround" even thou "lookaround" was typed first. Also if I were to type "enterdoorlookaround enterdoorlookaround" then the following is displayed.

"you have entered the door.
you are looking around, but don't see anything.
you are looking around, but don't see anything.
you have entered the door. "

I cant seem to figure out why the functions are not run in the order they are typed by the user. Not sure if this helps but I have determined that if a function is typed 3 times or more then it only returns the function twice. For instance if I were to input "enterdoorenterdoorenterdoor" then the following is displayed.

"you have entered the door.
you have entered the door. "

I would also like for the user to have the option of typing a function as many times in a row as needed. It seems to me that I'm missing some thing simple. I was thinking if I change the commands "array" to an "associative array" it might process the functions in the correct order. It seems to me that the commands array is being compared to the inputholder array.

this.stop();
import flash.events.*;
btn.addEventListener(MouseEvent.CLICK,textChanged)

[code]....

View 1 Replies

ActionScript 1/2 :: Game Score - Points To Be Time Based

Jul 18, 2009

Is there an actionscript for a point system? I want my points to be time based from this script
stop();
count = 60;
countdown = function(){count--;
if (count ==0){clearInterval(doCountdown);
gotoAndStop(11);
clearInterval(doCountdown);
}}doCountdown = setInterval(countdown, 1000);

View 5 Replies

Flash :: Turn Based Strategy Game Techniques?

Feb 12, 2010

I want to make a turn base strategy game. I was just curious if anyone had any sources or books that explains the concept and architect of designing a turn based strategy game or any turn based game.

View 2 Replies

Java :: Platform For Web-based Multi-player Game?

Sep 28, 2010

I'm developing a web-based fantasy football game. Most of the game is a straight-forward web application built on top of Linux/Apache/Php/MySQL.

I'm trying to figure out how to implement the draft application. The draft date and time will be scheduled in advance by each league's owner. Up to 32 users may be logged on for a given league's draft, and there is no limit to how many drafts may be happening concurrently. The users will take turns selecting players, and each user's turn will have a time limit. I'd like for all the users to be able to see whose turn it is, how much time that user has left to select a player, who they select, and which players are still available. If there are users in the league who are not logged in during the draft I'd like to be able to detect that and automatically assign players to them rather than waiting for the time to run out on their turn. Ideally I'd also like to have a chat window so the users could chat with one another during the draft.

My background is in desktop application development, so if necessary I could write server code in C#/.NET or Java. As far as I can see these are the options: PHP/AJAX - It seems like it would be possible to have all the state for the draft in the database and have the operations for the draft run in PHP triggered by requests from the clients? I guess in this case the draft doesn't start until at least one user logs in, and it seems like it would be a lot of polling requests to the server if I want everyone notified quickly when a user makes a selection.

[Code]...

View 2 Replies

Flash :: Web Development - Not To Target 10 For A Browser - Based Game?

Oct 25, 2010

There's clearly a bunch of new stuff in Flash 10, I'm seeing a bunch in the Graphics class so far. Struggling a bit to reconcile it with what I know already but it looks useful - render lists and 3D transforms, etc - however I wondered if there are good arguments for targeting Flash 9 since I can definitely manage without all the new stuff I don't know. Like support on non-Windows devices, wide adoption of Flash 9 Vs 10, etc.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved