ActionScript 3.0 :: Function In Main Loop Called MoveShip That Moves The Player's Ship If Some Buttons Are Pressed?

Aug 1, 2010

I'm developing a game, here is a screenshot:I have a function in my main loop called moveShip that moves the player's ship if some buttons are pressed. The trouble is, some commands began to break it recently, such as removeChild(debriefingScreen), and I have no idea why. Also, firing (spawning bullet movie clips) restores the moveShip functionality 0_

View 2 Replies


Similar Posts:


ActionScript 2.0 :: [MX] Keyboard Input - Moves The Ship Around And Fires A Laser?

Mar 17, 2004

I'm making a top-down shooter game.I have keyboard input that moves the ship around and fires a laser. everything works perfect except that when the ship moves diagonal up left, or diagonal down right, the laser can't fire at the same time. It will work in any other direction, including the other diagonals.here is my code:

[AS]
function captureKeys() {
if (Key.isDown(Key.RIGHT) && ship.x < 355 ) {
ship.x+=ship.right[code].....

View 1 Replies

ActionScript 3.0 :: Flash - Player 'Play' Function Moves To Next Frame?

Apr 13, 2011

I've got an app based on four frames with seperate events on each frame. The app is powered in AS3 and every frame calls stop(); and everything works well but the swf file in flash player has a problem where if the user hits control > play it moves to the next frame.How can I stop this? A simple conditional would prevent it but errors are triggered this way from ongoing functions from a previous frame.

View 3 Replies

ActionScript 2.0 :: MX Function To See If Buttons Pressed?

Mar 9, 2009

What I have is a series of buttons created via attachmovie based on XML nodes. I want to make sure all buttons are all clicked. What I have below is the onRelease of the button and I need to put my checkDone function in there because of the XML onLoad function. What I am struggling with is how to check if each has been clicked. Typically I would just do like but1==true but that does not seem to work.

_root["but"+b].onRelease = function() {
function checkDone(whichbut) {
done = true;

[code]....

View 2 Replies

ActionScript 2.0 :: Buttons And Transitions - Load In External Swf Files Into An Empty Movie Clip On The Main Stage Called Container

Jan 11, 2004

I have a problem with buttons and transitions and it is similar to a problem I had a couple of days ago that I posted and that was sorted out. I have two buttons onstage (they're inside a movie clip) inside the movie, on the button one I have the following

[Code]....

I have similar code on button two and this does indeed make the buttons move into place as required. My problem is this, I need to load in external swf files into an empty movie clip on the main stage called container. These External SWF files have transitions and this is where my problem is. If I place a normal button on the stage it works but not if the button is inside a movie clip and has actions applied as above. The code next is what I have believe should also be placed on the button to make swf transition one load in.

[Code]....

View 4 Replies

ActionScript 3.0 :: When A Button Is Pressed / Content Movie Moves Down To Right / Scales Down

Jul 13, 2010

I am just learning actionscript 3.0 and am hoping someone can help me with a little problem. My code seems correct but only works half the time when I preview it. All I am trying to do is when a button is pressed, the content movie moves down to the right and scales down to 50%. The code works perfectly for the first few times I push the buttons but then starts to move some of the way and stop and I have to press the button at least one more time to get it to complete! Sorry this is so long winded but I don't know how to phrase it!

View 4 Replies

ActionScript 2.0 :: Three Main Keyframes - How To Control Loop Function

Jan 4, 2009

I have a flash piece with 3 main keyframes/story ("story1", "story2" & "story 3") that cycles (and loops) from story to story, and 3 buttons that stop the cycle and take you to one of the stories

So on my first frame I have:
_root.mainMC.playing = "true";
function playOn(frame) {
/gotoAndPlay(frame);
}

Then on each keyframe I have:
stop();
setTimeout(this,'playOn',2000,"whatever the next frame is")

Then on button I have:
on (press) {
_root.mainMC.playing = "false";
gotoAndStop("story3");
}

I think somehow I have to have the button clear the function because for example, if I am viewing story 1 during the cycle and click 3, it goes to 3 and then quickly goes back to 2 and then stops on 3.

View 9 Replies

ActionScript 2.0 :: Create A Function That When One Of 'main-menu' Buttons Is Clicked

Nov 23, 2005

I'm currently working on a project were I would like to enlargen some of my menus ( there are wround 30 menus ), and this should be done when the user clicks a on one of the three buttons in the "main-menu".Now, I've been trying to create a function that, when one of the "main-menu" buttons is clicked, are called. This function then defines the menus and makes them scale, however the following code returns: "undefined".[code]Maybe a "for" loop isn't the solution, or maybe I'm just trying to define the items in a wrong way, with the array thing ( "...item[q].sca...").Btw. all the menus are loaded in dynamically through an XML document.

View 3 Replies

ActionScript 3.0 :: Flash Need Buttons Inside Movieclip Call Function In Main Class

Nov 16, 2010

I'm having some trouble finishing an interface i'm working on,the function indica() adds a menu listing of items (indicadores) inside a mask because its too large, and i added a scrollbar that allows to scroll through the items but now i need to add the buttons inside the movie clip indicative,i can add symbols and buttons, but i'm having trouble having them call functions inside the same class that the function indica() is running.[code]

View 2 Replies

IDE :: First Animation To Loop Indefinitely Till Mouse Moves Over It

Aug 22, 2009

I have two animations on the timeline- one from say frame a to b and second from frame c to d. I would like the first animation to loop indefinitely till mouse moves over it, which triggers the second animation to start and loop until mouse it moved away.

View 3 Replies

ActionScript 3.0 :: Make A Game Where The Player Moves And The Background Scrolls?

Nov 17, 2010

I'm trying to make a game where the player moves and the background scrolls to make it look like the player is moving but really the background is. The problem is whenever I blow something up in the game the explosion follows the player instead of staying with the background.

View 14 Replies

ActionScript 2.0 :: Place A For Loop In A Recursive Function With The Function Call Within The Loop

Nov 4, 2005

If you place a for loop in a recursive function with the function call within the loop... will the loop finnish or does it stop working untill the last recursion?

View 2 Replies

ActionScript 3.0 :: Custom Event Dispatcher - Spot Where A Player Moves Around The Screen?

Aug 25, 2009

So I have a small game where I have implemented a* path finding. I have a spot where a player moves around the screen along the path found. I have a section where i know the user is at the end of the path and I am looking to dispatch an event at this moment so I can do things at the end of the path.

i have imported the aStar_path_dispatcher file into the move class then i do,

[code]...

then in my main document class i import the aStar_path_dispatcher again, and set up an instance of it: then add a listener:

[code]...

however this "move finished" doesn't seem to want to work. I have never used custom events before

View 2 Replies

ActionScript 3.0 :: Compiler Bug - Var Declaration Function Definition Postcedes External Called Function Execution

Jun 29, 2010

Use Flash CS5 (and AIR, though this does not seem like it would be AIR related) in Win XP 64 I have a MovieClip symbol in my library with the identifier 'Puzzle10Piece10' with the following actionscript attached to frame 1 of the only layer with the following actionscript:

[Code]...

This runs contrary to my understanding of the pre-compiler and code execution order. In my way of thinking, any reference creation and related memory allocation is made when the object is instantiated, and indeed that allocation, unlike C depends not on code order (declaration before use), though this is an order that would satisfy even the C pre-compiler. If I understand the Flash compiler at all, it's not even a question of 'code order'... the symbol is pre-compiled such that for it to exist... for it to be instantiated, the variable would exist before the function would even be 'available' to be called internally or externally. Is my thinking way off, or is this a bug?

View 6 Replies

ActionScript :: Flex - An Object Returned From A Function Call Changed The Next Time The Same Function Is Called?

Jan 10, 2012

I have an AS3 program that calls a function multiple times. The function must return multiple variables, so I created a class for the function to declare an object containing all of these variables. For example, here's my class:

package
{
public class PER
{
[Code].....

Let's say the calling program calls the function, which returns the variables into data_set1 (where data_set1 depends on input variables arg1, arg2, arg3) using:

var data_set1:PER = function_name(arg1, arg2, arg3);

The calling program does some stuff, then calls the function again, but returns the variables into a new variable name, data_set2:

var data_set2:PER = function_name(arg4, arg5, arg6);

My intention is that data_set1 and data_set2 are different (e.g. not linked together).

My question is, given that arrays are passed by reference, will data_set1 be modified to agree with data_set2 upon the 2nd function call? Why or why not?

View 1 Replies

ActionScript 2.0 :: Add Audio That Will Play When User Moves Over Buttons?

Feb 5, 2006

I have a presentation which is split into several different movies which are linked together by buttons, all I am trying to do is add a sound which will play when the user moves over the button, and then another that will play when they click on the button; I got this to work once but it cut off the sound because it loaded a new movie, so I found the onSoundComplete command, which I've tried in a load of different ways but nothing works...
here's the code i've got at the moment:

on (rollOver) {
mySound = new Sound(this);
mySound.attachSound("twisted1");
mySound.start(0, 0);
} on (release) {
mySound = new Sound(this);
mySound.attachSound("twisted2");
mySound.start(0, 0);
twisted2.onSoundComplete = function(loadMovie("history.swf", "this"));
}

And this is the error that I am getting:
**Error** Scene=home, layer=links, frame=1:Line 12: ')' or ',' expected twisted2.onSoundComplete = function(loadMovie("history.swf", "this"));
I've tried a few things but i just seem to get more errors...

View 6 Replies

Flash :: Display Main() Class Being Called?

Aug 23, 2010

I'm trying to display objects from class files and methods.

Now I was looking at the source of this project here [URL]

To learn how to do this from AS3, main question I have how is the Main() class being called there? There is no actionscript in the frames of the FLAs so where is the call coming from to the Main class to initialize display? Is there something special about the Main() class that has it called when a swf is loaded.

I tried to duplicate it by making a simple Main which extends MovieClip and simply placing it in the root folder of the project but it isn't being auto called and it hasn't worked.

View 1 Replies

MovieClip Called Target_mc On The Main Timeline?

Sep 18, 2007

I have a movieClip called target_mc on the main timeline... Inside that movieClip, I have four frame animation where there are aim1_mc and aim2_mc on each frame...I also have a for loop that hides aim1_mc on all the frames... It works fine on the first loop, but I see the aim1_mc of the frame 1 from the second loop...

ActionScript Code:
this.target_mc.onEnterFrame = function ()
{

[code]......

View 7 Replies

IDE :: Add Listener To Main Timeline That Listens For MC To Be Called

Feb 6, 2009

On my main timeline I have an empty MC that my external swf's get loaded into once a user makes his selection from the menu.I would like to tween the load in and load out of these swfs.What is the best way to go about this?Should I add a Listener to the main timeline that listens for my MC to be called? I guess the real hangup here for me is understanding how to initiate the tween on load in and load out.

View 1 Replies

ActionScript 2.0 :: Loaded Movies With Main Swf And Then Be Able To Swap Them When They Are Pressed

Feb 27, 2004

I simply want to call in some loaded movies with my main swf and then be able to swap them when they are pressed. When I load my external movies into the main movie should I be putting them in separate "empty" clips? If I don't, each time I load a movie it replaces the current movie in the "empty" clip. Where do I put the code that will make the movie that is pressed come to the front? On the movie that is coming in? or the movie that it is loading into? It seems that a simple my_mc.swapDepth(x) should work? For (x) I would like to specify a number because there might be more than two clips that I would like to load in....

View 14 Replies

ActionScript 3.0 :: Return Result From Function Called By Function?

Aug 4, 2010

I'm using an AMF service that was built by someone else. Basically what happens is that some info is passed to the AMF service and it returns true or false.I want to be able to pass in various info to the a function that calls the AMF service(submitTracking) and then get the true or false value returned in onResultSubmit to be passed back to submitTracking.

var screen:String;
var buttonnumber:String;
function submitTracking(screen:String, buttonnumber:String) {

[code]....

View 3 Replies

ActionScript 3.0 :: Creating Class That Moves Buttons With Mouse Events

Jan 27, 2010

I am trying to work out how to do something really hard and i think the only way that I can do it is to pass a timer an argument. I want to create a class that moves buttons to the right on mouse over, and moves them back on roll out. But I am trying to make a sort of easing effect in action script. The last movement should be 1 pixel, the second to last move 2 pixels, the third to last be 3 pixels etc.

The class will have a variable that stores the original x coordinate and the desired resting coordinate for the button on roll over. on roll over, the script calculates the number of pixels between where it is and the destination, or on roll out, it would calculate the number of pixels from its current position to the original position. Then it would use that number to do the following calculation:

while(numPix>countPix){
count++
countPix+=count
} this.x=destinationX-countPix /*or + count pix depending on weather its moving to the right or left*/
while(count>0) {
this.x+=count /*or -= if moving back*/
count--
/*timer would elapse here*/
}

So u see, it counts the number of pixels it needs to move, then it counts the number of increments (count) it needs to move between timers for this sort of easing motion. I just don't know how to implement this in actionscript

View 1 Replies

ActionScript 3.0 :: Run The External Swf's Actions When It's Called Main-intro.sql

Nov 11, 2009

I have a swf called main.swf that is loading an external swf called main-intro.swf.main-intro.swf has a clip that fades up and then I have a stop action 24 frames in. The problem is is that I get a null object reference error (1009) when calling the external swf. If I remove the stop action then it works, if I rename the external swf to intro-main.swf it works with the (stop action).It seems it just doesn't want to run the external swf's actions when it's called main-intro.sql

View 2 Replies

ActionScript 3.0 :: Place All Of .fla Code In A Class Called Main.as?

Oct 3, 2010

Can I place all of my .fla AS3 code in a class called main.as?I dont want to run my as3 project from the .fla but how do I start the main.as?my .fla file looks like this and I dont know how to put this into a class?Do I simply do this in line 1 of fla file?

var mymain:main=new main();

Code:

var noLoaded:int;
noLoaded=0;
var li2:ClassImg6= new ClassImg6();
li2.addEventListener("image_loaded",imageLoadedHandler);

[code]....

View 1 Replies

ActionScript 3.0 :: Can't Unload FLV Called To Timeline Loop

Jun 5, 2010

So I tried to use quicktime but flash CS4 no longer accepts it. All day yesterday I've been working with a .flv version (which doesn't look nearly as good) and tried to directly import it but got an error ("no such file exists") even when it's right next to the other files.

With the Wizard I tried both picking the local file and assigning the URL of the file previously uploaded to my site.So i then tried to use actionscript to load it into the actions layer on the frame at the beginning of the "game" scene which after hours of fiddling finally worked.

I just want it to loop until someone clicks to go to another section but now what happens is the video and sound from the .flv keep playing even after you click on another button to navigate away from this scene.

I tried online to find a way to unload the .flv but none of them worked - went thru pages of google searches but the suggested coding did not prevent the .flv from unloading.

var vid:Video = new Video(480, 320);
vid.x=231;
vid.y=457;

[code]....

View 0 Replies

ActionScript 3.0 :: Remove A Dynamic Textfield When I Click One Of 2 Buttons Which Moves To Another Frame?

Nov 11, 2009

I am trying to remove a dynamic textfield when I click one of 2 buttons which moves to another frame.I can't seem to get it off the screen. removeChild works but it removes it totally and its not there when its suppose to be.

View 4 Replies

ActionScript 2.0 :: Make Simple Page To Click Several Buttons Before It Moves On To Next Scene?

Apr 9, 2010

New to AS and would like to know how to make a simple page where the viewer has to click several buttons before it moves on to the next scene. They can only go to the next scene when all of the buttons have been clicked.

View 3 Replies

ActionScript 2.0 :: Google Maps Error Doesn't Appear When Its Swf Is Being Called By The Main Swf?

Nov 20, 2009

Im trying to call to the main.swf other swf that contains some text and a google map. The swf that contains the google map is working fine...but everytime i play the main one, the text appears but the gmap doesnt.the code that i put on the main.swf refering to the google maps one is below (i followed the logic of the gallery that came with the presentation .fla):

// google-maps module
case "google-maps" :
if (firstLoad != true) {
var move1Content:Tween = new Tween(contentBG_mc, "_x", Strong.easeIn, contentBG_mc._x, -500, 0.5, true);

[code]....

View 13 Replies

Actionscript 3 :: Adobe Air Application Main Class Constructor Not Being Called

Feb 8, 2010

I'm writing an Air application using only Actionscript, and Flex3 SDK as the compiler. Everything compiles and runs fine under adl, but when the final air file is built and installed, the main class is never initialized.[code]When run under ADL, "Init" will be output to the console, but when installed and run, nothing happens (the constructor for class main is never called).

View 2 Replies

ActionScript 2.0 :: [fmx] Jump From One Scene Called Main To Other Named Tutorial 1-6?

Mar 23, 2004

I am trying to jump from one scene called main to other named tutorial 1-6 here is my code to jump to tutorial 2 as an example

on (release) {
_root.gotoAndPlay("Tutorial2");
}

I've tried every variation that I can think of, no _root gotoAndStop and also putting in _root.gotoAndStop("Tutorial 2", 1);

i dont know if it makes a difference but the navigation buttons are on a movie clip which pops up over the main stage...if that makes sense, that flash file is huge i didnt want to attach the whole thing...

View 1 Replies







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