ActionScript 2.0 :: Switching Back And Forth With A Key Press
Jan 19, 2011I want to be able to press a key once and have it stay on a movie clip (which it does) and then press it again to return to the existing movie clip
View 1 RepliesI want to be able to press a key once and have it stay on a movie clip (which it does) and then press it again to return to the existing movie clip
View 1 RepliesMy only accomplishment so far with it was to create a space shooter game which i modified slightly and animated it or at least the enemy spache ships and the players spaceship.
Here is what I want to do, but cant seem to figure out
I want to have a character on screen who is standing stationary normally, but still facing a direction.(left or right)
Now I want to be able to switch to a walking animation towards the right when I press a key and a seperate animation for when he walks left also at the press of a key I want to do down and up to, but I should be able to figure those out once I learn left and right
I also want it so when I lt go of the key they stop the walking animation and return to stationary, but stay facing whatever direction i pointed them
Im currently programming a game and having the character animation respond to the spacebar to play a jump animation.
To cut the code down here is the bit that's the problem:
ActionScript Code:
var space:Boolean = false;
if (evt.keyCode == Keyboard.SPACE && space == false)
[Code]....
The script works great, apart from when the animation is over, the variable 'space' is set to true, but I need it to go back to false after the function has been applied.
In my app, I switch back and forth between Scene 1 & Scene 2 using gotoAndStop. No problems in either scene the first two times each. After doing Scene 2 the second time and going to Scene 1, one of my buttons is gone and the variable for it is null. The button was created with the IDE, not in my script and exists only in Scene 1. I have nothing in my script that moves it or removes it from the stage, let alone destroying the object itself.
Using the debugger, I noticed that the pointer for the object has changed at the very beginning of the scene (flash.Display.SimpleButton(@146fb21) to flash.Display.SimpleButton(@146fd91)). So it seems to me that display objects made with the IDE are destroyed (var = null) when exiting a scene and recreated when the entering the scene.
what could cause this one button and not any other similarly created objects (buttons, movieclips, textfields, etc.) not to be recreated and only after the second revisit to its scene.
I was just curious as to whether or not it is possible to broadcast a live stream and then be able to push in, let's say for familiarity, a commercial? I have tried to find some information on the Flash Dev Net area, however, I don't think it leans towards what I am aiming for.
View 1 RepliesI have this site I am working on and I need to use as2 to switch between French and English. Using the flash examples I was able to switch to french but when I try and go back to english but it doesnt populate the XML.
import mx.lang.Locale;
Locale.setLoadCallback (localeListener);
lang_cb.dataProvider = Locale.languageCodeArray.sort ();
lang_cb.addEventListener ("change",langListener);
[code]....
In the continuing evolution of my code, I simply want a button to alternate moving the playhead backwards and forwards along the timeline between frames 1 and 17. This code is not working. I have attached a screen capture to clarify your questions in advance
[Code]...
I need to return to my original function after capturing an event (downloading something) with another function. The original function needs to return a value, which depends on the downloaded data. So, I'd like to pause original function for the time needed for the download and the eventhandler function to complete it's work, and resume it afterwards.
The obvious way is to set a flag value (both the original function and the eventhandler are within the same class) and make the original function check it until the eventhandler function changes the flag. But that would be wasteful, and my AS is slow enough already:) [other parts of the application utilise some heavy graphics]. Is there another way? Like an event that gets captured "in the middle" of the function? Or some other form of flow control?
I have got a movie clip moving up the stage and when I press the keyboard I want it to come back down to its starting position on the bottom of the stage. What code do I add to the following?
[Code]....
How can i make it so a when you press a button it starts a countdown but every other press dosent reset it?
View 14 RepliesI have a problem when I making a game Flash with action script 3,. I want tomake my character move when the key helding and I want my character attackwith one tab press either
View 3 RepliesI have text field which is 0 by default (score_txt)Two buttons +1 and -1 (plus_btn and minus_btn) When I press +1 text increases by one, and when i press -1 it decreses
View 4 Repliesi have an object that i want to drag and drop with the same event.Something like on press start drag and on press again stop drag. I'm sure it's pretty simple with and if and else statment but i can't find how to do that...The best i have done so far was this:
[Code]...
I have a Flash website with 3 interfaces( 3 frames with movie clips inside). they have a button that goes to different loaded .html page(text). But once the back button is pushed on the web browser, it always goes back to the first frame instead of the actual last page, which might have been frame 2 or 3.
View 1 RepliesI have a project (see attached) where I need to have the folders seem like they are floating in space, and I need the best way to make it so when you click on a back folder, it slides off the screen and come back in front of all the folders.
View 2 RepliesAnyways I am using action script 3.0 and I created multiple layers using just one scene. I created a layer with lables on them to mark where I want my buttons to point to and go to. I have the stop (); on the first frame. And I made my buttons mostly interactive with movie symbols and tweens.My first scene I have 2 doors, the user can pick which door to go to and it takes them into a different path.I made the buttons that are clicked to go forward, and then I tried to make an invisible button on the button edge of the scene to go backwards However, the PROBLEM is when I click my button to go backwards I am stuck on the first page and can't move forward.
function gotoOne(evt:Event):void{ gotoAndStop("one")}backbutton1.addEventListener("click",gotoOne);
function gotoFour(evt:Event):void{
[code].....
I have a GUI using Flex. I have a condition like i need to execute some command line arguments in the local machine and get the results back or output back to a textbox area. How can i do a button on submit, execute command in the local machine and return the output?Command to execute example:
echo logfile.log | grep username
Code:
button1.onRelease = function ()
{
// in this computer, it will now run a command, please wait.
}
I am working on a having external swfs get loaded into the main swf one by one from an array.I can get the first one to load, but it just keeps on playing the first item in the array over and over, instead of loading the next movie. I have a container on my stage, cleverly named "container" and I am using AS2 and loadMovie.
I am guessing my conditon on my if statement is off, but I am not sure how to tell the onEnterFrame to check the currentframe of the loaded swf and not the container itself. I might be way off, but in my mind I feel like this mostly makes sense, but knowing Flash it is probably not nearly enough coding.I might also add this won't be running on the web, so I don't need to worry about preloading swfs since it will be running directly off a PC onto a screen in our office.Here is my code:
Code:
var myClips:Array = ["movie1.swf", "movie2.swf", "movie3.swf", "white_logo.swf"];
var i:Number = 0;
_root.container.onEnterFrame = function() {[code].....
I've got the standard scene 1 with three frames on it. the first frame has a movie clip with about a 70 frame timeline. the second frame has a movie clip with about a 20 frame timeline. the third frame is black with a stop action. i'm trying to make a leaderboard banner, and i need each clip to play one after the other.
right now, when ctrl+enter it plays nothing. i actually have to rewind it to have it play the first clip. then it just repeats the first clip and completely skips the second. in the first clip's timeline, I have a parent.gotoAndPlay(2); on the last frame.
I have some knowledge of Flash, but not enough obviously. Right now I've got the standard scene 1 with three frames on it. the first frame has a movie clip with about a 70 frame timeline. the second frame has a movie clip with about a 20 frame timeline. the third frame is black with a stop action. i'm trying to make a leaderboard banner, and i need each clip to play one after the other. right now, when ctrl+enter it plays nothing. i actually have to rewind it to have it play the first clip. then it just repeats the first clip and completely skips the second. in the first clip's timeline, I have a parent.gotoAndPlay(2); on the last frame.
View 1 Repliesi want to know how we can make back button in flash to go back to page same like browser back button.
View 1 RepliesIn my apps, i would like to:
1)have a pop-up menu when a button is touched, then ok to close but still in the same page as it is
2)invoke the popup menu by using samsung's "MENU keycode",then ok to return the same page as it is
3)having the user to swipe 5 images to view them, left image as 1st and 5th image as last image with smooth transitions
4)and also using the "BACK keycode" to go back to previous page
How can I write this snippet of code for a button in AS3?I'm having a hard time completing this.Here is my AS2 code.It is attached to a button.[code]
View 2 Repliesi made a character that has 5 frames:
1st nothing
2nd axe
3rd spear
4th sword
5th bow
i am trying to make it so the weapons will switch when i press the a,b,c,d,e button on the keyboard( i will figure out the actual button l8r) i have made a mc clip button to make it switch which works but i cant figure out how to do it from the key board
[Code]...
i have an rtmp folder with videos,I am trying to do a seamless change to next video using nestsream play2 method.have tried using the fast switching of NetStreamPlayTransitions. SWITCH like below.[code]The problem is the switching is not happening.offset=-1 is supposed to be fast switching. The idea is to make a seamless transition to the next video.if we dont use any transition method or use opts.transition = NetStreamPlayTransitions.RESET;its the same as not using any. It just switches normally.RTMP is supposed to provide a relatively faster transition, i am looking for a seamless option .
View 1 RepliesI am using the following line of code in my Flash movie: navigateToURL(request,"_blank");However, when I am using Internet Explorer 7 (with tabbed browsing enabled), and this code is called to open a link, the link is opened in a new tab, but IE7 does not switch you to view that tab as you would expect!When I open a link in a normal web page in IE7 (and the link opens in a new tab because _blank was specified in the HTML code for that link), IE7 will switch you to that new tab to see the web page you just opened, so why does it not happen when using Flash?I know that within the settings for IE7, there is a setting that you can tick that says, Always switch to new tabs when they are created, and this solves the problem. However, many web site visitors will not have this ticked.How can I make sure that when a user opens a link in a new tab from my Flash movie, IE7 switches to that tab?I am using ActionScript 3.0 and Flash CS4.
View 1 RepliesLet me preface this post by saying I have been studying actionscript 3 for 2 months now and I am now at a point where I am looking into how experienced developers code their projects and what tools they are using. Repeatedly, I come across a post or a blog entry where a developer says:
[Code]...
Now here comes my confusion/question(s). When a developer says something like that, are they saying that they ONLY use FDT to create their projects? If so then how are they going about doing it without the use of the Flash IDE? Do they just keep creating external .as classes and then link them all together or what?
In my 2 months of studying, I really feel like I have learned a lot, but I cannot seem to wrap my head around this. I want to break away from the Flash IDE (if at all possible) so that I can go deeper to the code.
Why will this not work? I get back: "Welcome Back, DEFINED." The firstToUpper function will not run. I set the variable for Party already.
Players = firstToUpper(Party); function firstToUpper(word) { firstLetter = word.substring(1, 0); restOfWord = word.substring(1); return (firstLetter.toUpperCase()+restOfWord); trace("hey")}Hiusername.text = ("Welcome Back, " + Players);
I'm making a website for my business. I want this site to run similar to an OS UI. The first issue I've run into is swapping between "window" MC depths. I'm not quite sure if its just that I need to add a mathematical variable to each one every time it is clicked or how to getDepth of the highest "window" MC in order to put the desired "window" MC above it.
You can download the .fla file <a href="www.dpr.150m.com/images/index.fla">here</a>.
If I have a prompt window where I am asking the user for some input, is there some way I can prevent them from switching window focus to the other windows in my application? (switching to other applications is fine) I'd actually have preferred if the window didn't appear in the taskbar at all, but utility windows look awful and I'm using system chrome so lightweight is out.
View 5 Replies