Flash :: Using Multiple Timer To Show / Hide Enemies?

Jul 13, 2011

i have a shooting game that works with some sort of rounds, for instance, this round is gonna show 4 enemies on the screen that the user has to shoot. I show the 4 enemies at a half seconds interval of each one so it doesnt all appear on the same time. Using something like:

enemiesShowTimer = new Timer(0.5 * 1000, 1);
enemiesShowTimer.addEventListener(TimerEvent.TIMER, showEnemyAtTime);
enemiesShowTimer.start();

The player has 2 seconds to kill each enemy after they appear, so i also use this:

enemiesCleanTimer = new Timer(roundConfig.getSecondsPerEnemy() * 1000, 1);
enemiesCleanTimer.addEventListener(TimerEvent.TIMER, cleanEnemies);
enemiesCleanTimer.start();

The problem is, after the player dies i change scene and if i still have like 3 alive, enemies, the threads will try to run the methods and it will crash. I'm using always the same variable to the start the timer whenever i need it. How can i solve this? Will i have to store each "thread" (timer) on a list and then stop each one separately? Because the way it is, the other threads are in some sort of "limbo" and i cant stop then, just the last one.

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Trigger Show/hide Multiple Div Layers From Flash Movie?

Nov 18, 2007

I need to show and hide multiple DIV layers by clicking on buttons inside an embedded flash movie. I looked around and the closest I got was this tutorial here:

[URL]

but the problem is I need 10 buttons to each show one layer while hiding the other ones. For example, I click button 1, layer 1 shows, then I click on button 5, layer 1 is hidden and layer 5 shows etc.

How can the above code be split so instead of showing all DIV layers at once, it shows one and hides the rest??

View 5 Replies

Show/Hide Multiple Movieclips Query?

Nov 10, 2009

I'd like to be able to have an array of movieclips where i'm able to toggle their visibility depending on what button has been pressed. I would need to have a default movieclip that is visible and all the others are hidden, but then when I click a button to make one of the other movieclips visible the default one is hidden etc.You can see an example of what i'm trying to achieve at http:[url]........I'm experienced in PHP and HTML but have not used flash for several years so i'm pretty rusty. Can anyone point me in the right direction?

View 5 Replies

ActionScript 2.0 :: Multiple Clicks - User Can Click On To Hide / Show A Different MovieClip

Feb 27, 2008

I have a movieClip that a user can click on to hide/show a different movieClip (for this example, lets say its a circle). I have an 'onPress' on that movieClip that tells it go and play the next frame inside itself movieclip (there are two frames which just have different graphics to represent off/on) and also the line of code to hide the other movieClip.

The problem is that if a user clicks on the movieClip to hide the circle and then keeps their mouse in the exact same position and tries to click again to show the circle, nothing happens... they have to move the mouse at least a little bit before it will recognize it is being clicked again. The same thing happens with buttons I have that scroll the page... which is extremely annoying since you can't just click the same spot multiple times, you have to move your mouse a bit and then click again.

View 6 Replies

ActionScript 3.0 :: Way To Show 'enemies' On Random Base On Platform Screen

May 17, 2010

I'm getting an error: [code]I'm also looking for a simple way to show my 'enemies' on random base on my platform screen. I already made an array with the x and y coordinates but I don't know how to make AS3 print them on a random way on the platform windows.

View 4 Replies

ActionScript 2.0 :: Enemies On Minimap(radar) And Warping For Enemies

Feb 25, 2010

as from title above, minimap where enemies spawn and can be shown on the minimap and enemies warp like player_mc do. ps: i'm new to this forum. attached files below

View 0 Replies

ActionScript 2.0 :: Make Multiple Enemies That Look Same?

Dec 22, 2010

I just started Flash like 2 weeks ago, so im not very good. Im making a game where you pick a character, and shoot pigs. Every pig you shoot adds 500 points to your score. Problem is only one pig works. If i copy and paste that pig and his code (as2), when i shoot one pig both pigs explode, giving me 1000 points. How can i make it so that when i shoot one pig, one pig explodes, and i get 500 points?[code]...

View 4 Replies

ActionScript 2.0 :: Show Hide Divs Via Flash?

Jul 9, 2009

I have a flash map. There are 6 clickable countries on the map. When one clicks on a country I want html content to appear under the flash movie. As far as I can see the best way to accomplish this is to have all the content already under the flash movie each in a separate div, with display set to hidden. Then action script inside the country buttons calls a javascript function on the html when that button is clicked, to set display:block for corresponding content filled div. I've tried a few scripts but couldn't get it working.

<code>button_kenya.onRelease = function ()
{
flash.external.ExternalInterface.call("kenya");
};</code>

Is there anything else i should do when imbedding flash into my page so that the flash can talk to the html and call the javascript?

View 3 Replies

Jquery :: Safari Show/Hide With Flash?

Jun 2, 2011

Im using show/hide to load a 'loading' flash file whilst a form loadsThe div im trying to show contains an swf fileThis works fine in all browsers except safari, which does not show the swf file upon clicking the submit buttonIm using...

$('#form').show();
$('#loading').hide();

View 2 Replies

IDE :: Hide / Show Them By Clicking A Button In Flash?

Jul 11, 2009

I have two div layers in an html page. Is there a way to hide or show them by clicking a button in flash? I have searched online and haven't been able to find something that works.

View 1 Replies

Professional :: Create Multiple Enemies And Be Able To Do HitTests Against Them?

Oct 12, 2010

i got this flash with duplicated mc's say...enemy1, enemy2, enemy3. now we all know we can do something such as..
 
if {_root.blah.hitTests(_root.enemy)){_root.enemy.nextFrame();}}
 
because the enemy is duplicated and its no longer "enemy" but enemy12 or ****.is there any way to ...create multiple enemies and be able to do hitTests against them somehow.Also im not really a fan of attachMC

View 5 Replies

Control Contents Over Divs And Show/hide With Flash As2?

Oct 11, 2009

Is it possible to control contents over divs and show/hide with flash as2?

View 1 Replies

ActionScript 3.0 :: Flash Parameters - Show One MovieClip And Hide Another

Nov 8, 2011

I am new to flash parameters but from the research I could find so far it seems that this should be fairly simple. I have a flash file that has a movie clip in it. In this movie clip there are two movie clips. What I need to do is show a one movie clip and hide another. I basically only need to set up the reading of the flash parameter code in flash...
var imageToShow:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

This is basically what I have... I'm not sure what to go on to next or if this is even correct.
Code:
if (parameter == "image1") {
image.image1.alpha = 1;
image.image2.alpha = 0;
}

View 2 Replies

Jquery :: Show And Hide HTML Before Flash Inserting?

Apr 20, 2011

the thing i'm searching for my site is something that can show, and after 10 seconds, hide some html.Exactly is for a games site. I want to show ads during 10 seconds, and after this time, load the .SWF file of the game.During 10 seconds i want to show the window of the ad in the center of the field where later the game will be displayed. It's like a 700x500px window.One of the problems is that the ad window maybe 300x200px and i want to put it in the center. It's like i want to make a scene of 10 seconds with tha ad showing like the game is loading.I beg you to answer in a begginer level, i'm not expert in scripts, just know some html, that's why i'm a bit overwhelmed with the info i found in the net.

View 1 Replies

Actionscript 3 :: Access/hide/show Layers From Flash CS5?

Jun 28, 2011

I have 2-3 layers in my movie clip and i wanto access them using ActionScript code. I want to show hide and access Elemts(buttons, text box) in that layer.

So how can i do that using ActionScript-3

View 2 Replies

ActionScript 3.0 :: Flash - Show And Hide MovieClip Buttons

Jun 2, 2010

I was looking to make 2 buttons; one that hides a movieclip that is playing on a slide, and one that shows it again. I've heard theres a few ways to do this but none of them are making much sense to me (i previously made some buttons that play, pause and stop a movieclip, and I think I am stuck in the wrong frame of mind to do these next 2 buttons...) How to tackle this task.

View 2 Replies

ActionScript 3.0 :: Flash Hide / Show A DIV-Layer On A Html-page?

Aug 17, 2007

Can Flash hide/show a DIV-Layer on a html-page?

View 16 Replies

Actionscript :: Flash - Change A Button, Onclick - Show/hide?

Aug 16, 2009

Using ActionScript 2.0, how do I show or hide a button onclick? I am making a simple mp3 player, and would like my pause button to change to a play button when clicked, and vice versa.

View 2 Replies

Flash :: Javascript(jQuery) Plugin To Hide / Show Swf Seaminglessly?

Dec 19, 2010

As we know we can't $.show/$.hide to show/hide the flash component,which will cause the flash player to redraw it. Is there a flexible component that can hide/show flash components with redraw them?

[Code]...

View 3 Replies

Javascript :: Hide And Show Flash Video Player With ExternalInterface?

Mar 1, 2011

I'm trying to create an overlay containing a flash player that is shown when a user clicks on a link. The div containing the player starts with display:none in CSS. Upon clicking, the div will be shown, and JS will use ExternalInterface to configure and start the player. The JS configures the player when it catches a "flash ready" event, which is fired by Flash on ADDED_TO_STAGE.All this works, except that the ExternalInterface callbacks are never created. The JS and AS3 work fine if the player is shown upon page load, or is hidden with visibility:hidden instead of display:none. I am aware that Flash will not be initialized with display:none, and this works as expected: when the Flash is unhidden, it fires its events and correctly initializes everything else (eg. GUI, other internal stuff). The only thing that doesn't happen as expected is that my ExternalInterface callbacks are not added.

ExternalInterface.available is true. It's not a timing problem, because even after several minutes the callbacks are still not present. The strangest bit is that the flash is able to call JS, fires JS events fine, and the code to fire the events comes after the code to add the callbacks. There are no errors thrown by any of the AS3 code. I'm seeing this problem in both Chrome and Firefox.

View 2 Replies

Flex :: Flash Builder Show / Hide ComboBox Based Off Selection

Mar 29, 2012

Is it possible to show or hide a comboBox based off the selection made in another comboBox. I have been looking for documentation on this to no avail.

View 2 Replies

ActionScript 3.0 :: Flash Hide Or Show Scrollbar For Multiline INPUT Textfield

Feb 14, 2012

I use AS3 which I keep separate from my fla project.

I have a contact page and the textfield where you type your message is an Input textfield with multiline and textwrap enabled. The height of my textfield allows for 5 lines of text, then you will have to start scrolling after that.

I use a my own scroll bar nested in a movieclip with instance name "txtScroller"
The Input textfield instance name is "messageText"

What I want to do: I want to hide the "txtScroller" mc and show it when the user has typed more than 5 lines of text (using enter to break to a new line, etc).

Now for my problem: The first part of the code works, the "txtScroller" mc is hidden, and I have even tested it with the trace function (see code bellow).

I can for the life of me NOT get the the second part to work, the part where i want to show "txtScroller" mc again. I've treid with the trace function as well but it shows nothing in the 'output' pannel (see code bellow).

The Code:
This is all I have with regards to hiding or showing the "txtScroller" mc.

Code:
if (messageText.numLines <= 5) {
trace("less");
txtScroller.visible = false;

[Code]....

View 9 Replies

Actionscript 2 :: Show Tooltips Inside A ScrollPane Without Letting Flash 8 Hide Tooltip?

Dec 23, 2011

I have the content of a scrollpane that, when clicked, show a tooltip movieclip with attachMovieClip; the problem is that the attached movie clip, for the first rows, goes under the border of the ScrollPane and is partially invisible.

Is there a way to solve this problem (without changing the position of the attached movie clip?)

View 1 Replies

Actionscript 3.0 :: Display Html In Flash Movie And Interact With Hide / Show Divs

Apr 13, 2009

I have a movie clip that displays an embedded html with a bunch of divs that are expected to hide and show other divs when the users click them. i.e. imagine that you have a span with an instruction in javascript to show a div when you click it. I already made the html file, the external css and the external js. The movieclip (in actionscript 3.0) loads and displays the html content and also the css, but i haven't managed to figure out how am i supposed to link or use the javascript to do the trick. I've tried so far doing an exhausting research over the internet for the past few days and the only infromation i've got is that web developers use externalInterface to access javascript functions, but they use flash buttons to execute the js code, and it appears to me that i cannot use or embed flash btns in my site. I don't know, I'm kinda new to flash and this is the first time I work with actionscript 3.[code]or how do I achieve de hide/show thing with another method? I'll be wandering around the site in case you have any extra doubts about this subject.

View 2 Replies

ActionScript 3.0 :: Managing Multiple Instances - Assign The Bullet Speed And Check For The Collisions With Enemies?

Sep 17, 2011

I have been reading these forums for like 2 months, thus i never felt like being able to post something as a valuable answer to someone's problem, since i've been AS3ing for like 3 months now. I have a small problem here on a game that i am trying to create. I am trying to make a shooter game . Like the ones u kill enemies and then the the level advances ( imagine the pseydomovement depth feel of the background giving the player the taste of further movement of the field , yes like old airplane games ). Ok to the point.

1) created a main .as where all the code is running. The movement of the player is written there also. no problem with that. 2) created a bullet class where i assign the bullet speed and i check for the collisions with enemies. the problem occurs somewhere here i have created a statement where every some time ( like 0,5 secs ) an enemy appears and takes a random road till the stageHeight . here is the code .

[Code]...

So when all 5 mikros are out i start firing them . BUT only the last child of mikros seems to follow the hittestobject procedure of my code. Which means that if all of the 5 mikros are on stage the one with the smallest .y value will disappear when hit by "sfera". I know it is huge but this pains my head for like 1 week and i cannot think anything . Tried some staff. but i do not know if this is proper thinking or if my programming is proper for this and i must redo all.

View 1 Replies

ActionScript 3.0 :: Inactivity Timer For Auto-Hide?

Mar 30, 2010

I am trying out the inactivity timer technique and I am still trying to get it to work. This what I have so far [URL]As you can see I have it so when the mouse isnt moving the control bar goes down and vice versa. But when I move the mouse the control bar replays the up motion.

View 8 Replies

Actionscript 3 :: Flash Slide Show With Timer Object And The Option To Go Forward Or Backwards?

May 2, 2011

I am new to using Flash, but with some helpful YouTube tutorials and various Google searches, I was able to create a slide show that automatically transitions to the next after 6 seconds. I also thought it would be neat if I could give users the ability to go back or forward or jump specifically to a certain slide. But my problem is that after I click a button, the timer seems to be off.

[Code]...

View 1 Replies

Actionscript 3.0 :: Inactivity Timer For Auto Hide Control Bar?

Mar 30, 2010

I am trying out the inactivity timer technique and I am still trying to get it to work. This what I have so far [URl]As you can see I have it so when the mouse isnt moving the control bar goes down and vice versa. But when I move the mouse the control bar replays the up motion.

Code: Select all//call tween
import caurina.transitions.Tweener;
const BUFFER_TIME:Number = 8; /* stores the time to buffer for
the video in seconds. */

[code]...

View 1 Replies

ActionScript 2.0 :: CS3 Show/Hide Mc's In Array?

Oct 13, 2009

Several arrays are created by passing a number (k) from a different array,for every item in the array I need to have a little dot.I have a movieclip on the timeline with a maximum of 15 dots.So if the array has only 6 items, the last 9 dots should dissapear.

PHP Code:

function fill_items(k:Number) {
var item = josXML.firstChild.childNodes[2].childNodes[k];

[code].........

But the dots_total[t]._visible = false; part isn't working...Maybe it's the wrong way to achive this, but i can't seem to figure out why it's not working.

View 2 Replies

ActionScript 1/2 :: Hide And Show Datagrid?

Aug 7, 2011

How do I hide a datagrid and then show it?I have a button to select. The button when clicked should show the datagrid. Once the user clicks a cell on the datagrid, it should hide again.

View 1 Replies







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