CS3 - Key Checking Function Not Working?
Sep 8, 2009
I must admit I have struggled with this thing for a bit. It seems simple but for whatever reason I can't get it to work. I just want to make something move in AS 3 right now, and so far I've tried puzzling together two different tutorials, but both of them are missing either some source files or further explanation.
Anyway, here is the code (The bit I am having problems with)
Code:
//event listener checks for key presses
stage.addEventListener(KeyboardEvent.KEY_DOWN, checkkey);
//Create keyHandler function
[Code].....
The problem is the checkkey function in the update function. If I leave the parenthesis empty it tells me it needs an argument, if I leave it like that it tells me I need a right paren before colon.
View 2 Replies
Similar Posts:
Jul 14, 2009
Google is ranking my site preety high BUT (bigBut) in MOST searches it lists my swf-s not html pages. So when clicked they are shown in a browser window as single swf-s, not as part of html page. I am trying to workaround this by means of some variable to inspect if swf is opened as standalone or within a html.Here is the problem. I've set up a swf (swf_01 for example) in html page that loads another swf (swf_02) which is in swf_s directory. Swf_01 establishes a variable _global.isActive = 1; when html loads swf_01. So if swf_02 is loaded into the swf_01 variable is TRUE and that is OK and if the swf_02 is loaded directly from search results as a standalone swf it's not OK. That works so far. In swf_02 there is a code that checkes if variable is undefined (meaning that swf is loaded directly from search results) and, if it is, loads the right html into "_self".Somehow it's not working. Maybe my code isn't right.
Code in swf_02 (loaded one):
/if(isActive==undefined){ loadMovie("http://www.mydomain.com/index_services.htm", "_self");} // meaning: if variable is not true > this swf is loaded into browser directly from search
[code]....
View 7 Replies
Aug 31, 2009
Got two numbers and need to check if they match up (same value).
this won't fire/doesn't work:
if(codeNumb == exCode){};
But this does work:
if ( (codeNumb + exCode)/2==codeNumb){}
What gives?
View 5 Replies
Aug 22, 2010
I'm trying to check through an array to see if any of my movie clips are currently on frame 15, before taking giant leaps I was trying to just get it to work with one var in the array before all of them, for some reason this code is not working, the trace is not coming up.
Code:
stop();
var anybtn:Array = [btn1_mc, btn2_mc];
trace(anybtn[1]);
btn1.onPress = function(){
if(anybtn[1]._currentframe == 15){
trace ("Array Check Working"); .....
If someone would like to go a step further and show me how to check through all movie clips. There will be many more than btn1_mc and btn2_mc so I will definitely need to use an array.
View 4 Replies
Sep 12, 2006
Is there a way to add a listener or something to a function so when it's finished it will run another function?
I need to run a function in a class, and when it's completed run a function on the main timeline or elsewhere.
View 1 Replies
Dec 6, 2009
I have a form that is being created at the point the user clicks on. The algorithm is checking to see if a form exists in the same spot- if it doesnt, new object is created, if it does- result is traced. If no objects are on the stage- a new object is added. For some reason in this code- I get no results for the Mouse_Down event on the form itself. Method being called in main timeline:
[Code]...
View 4 Replies
Oct 27, 2009
I'm working on a game that involves some timed animations and I need to fire a kind of 'failed' event.Basically I'm moving a clip from one point to another on the stage, the user has to input a correct key combination before the endpoint. I'm capturing the inputs correctly, but I need a default procedure to fire if the player doesn't input anything at all.So I'm guessing that at the endpoint I could check if my function to capture the key inputs was actually called, and if not, call the 'failed' procedure, or if at the endpoint, no keys were pressed, do the same
View 1 Replies
Mar 5, 2009
find out error because mouse down and up function is not working.
View 4 Replies
Mar 14, 2009
I'm working on a pretty simple flash application which basically plays a music clip downloaded from a web URL, and makes a stick man dance. I have it all working fine, however, I've used the addChild function on the start button to add the mc onto the stage, however, when I applied the removeChild function to take it off again, I get an error telling me that it hasn't got a caller.Here's the script:[code]I've had my tutor look at it, and she can't work it out either, but I do get the feeling that she's not much wiser on Flash than I am.
View 17 Replies
Aug 20, 2009
i'm very new to Flash and AS3. I've created a clip and need to link some buttons to some pages on my site but they don't seem to work. Please let me know if nyone can help me...below is my code:
[Code]...
View 4 Replies
Sep 9, 2010
I'm having trouble getting a game to go to the end scene after a collison with a barrier.
Code:
function dead() {
clearInterval(ants); //stop spawning
[code].....
View 8 Replies
Oct 6, 2004
why is this working well:
Code:
with(mc){
_xscale = 160;
_yscale = 160;
[code]....
View 1 Replies
Oct 5, 2009
I can't seem to get the hitTest to work for my script shown below. I have tested using movieclips created on stage during design time and made to collide during run-time. hitTest works fine in this situation.
But if I use the attachmovie command and create a movie on stage during run-time, that clip cannot hitTest with other movieclips. The hitTest simply doesn't work.
The script below is basically, to create instances of enemymc, and it will fall vertically, hitting a movieclip target_mc which is placed during design-time.
var enemyTime:Number = 0;
var enemyLimit:Number = 20;
onEnterFrame = function()
{
[Code].....
View 3 Replies
Jan 5, 2009
Why is the function not working?This is my function:
function add_controll_pannel() {
this.attachMovie("controll_pannel","controll_panne lMC",10);
controll_pannelMC._x="157";
controll_pannelMC._y="186";
}
And this is my function call:
add_controll_pannel;
Nothing happens.
View 3 Replies
Jan 21, 2009
The code that is commented out will work, however, I'm trying to turn that code, since it's used multiple times, into a function.
Why isn't my function working when it's being called?
ActionScript Code:
function displayInfo(_ROLL:MovieClip,_MC:MovieClip, _NN:MovieClip) {
_ROLL.onRollOver = function() {
[Code]......
View 9 Replies
Sep 16, 2009
Code:
var abc:Number = 0
btn.visible = true
btn.buttonMode = true
btn.useHandCursor = true
btn.addEventListener("click", buildIron())
[Code] .....
I tried this code but it didn't remove the event listener.
View 4 Replies
Nov 2, 2009
I'm not getting errors but my program wont call my function.
Code:
this.onEnterFrame = function() {
if(wm == 10)[code].....
I want to change to my end game screen when my value of variable wm gets to 10. Sorry I cant figure out whats wrong with the if statement. It doesnt work outside a function either.
View 1 Replies
Jan 21, 2009
Ive got a problem with comparing the currentframe with the totalframes of a loaded movieclip.this is my code
Code: Select allpublic function adLoaded(evt:Event):void
{
ldr = new Loader();
[code].....
View 1 Replies
Oct 17, 2004
I'm trying to write a function that I can use for creating text fields - in this case: to make the labels for a navigation menu. But the function is not working and I don't know what's the problem. Vars are: n = name and l = depth.
[Code]....
View 1 Replies
Nov 9, 2005
I'm not getting any takers over in the Flash 8 forum.I am using the snow method wonderfully created here on Kirupa and have a quick question. Currently, the movie just starts with a screen full of snow. I'd like to get it to start off screen and fall in. Basically setting an initial state for the ._y of 0. I also can't seem to get a delay working for the function.[code]
View 4 Replies
Dec 26, 2005
I just created an image gallery that displays 3 images at a time. For some reason, it works (for the most part) in Opera, but it doesn't display the images properly in IE.
img1, img2,and img3 are blank movie clips that hold each of the photos. The links to the photos are retrieved from XML, and are displayed in a random order. The first picture shows how it looks in IE, and the 2nd is in Opera. It also seems that the clearInterval() function isn't working like it should. Once the pictures are loaded, they are resized using the resizeMe() function (called by setInterval) to fit in the rectangle.
IE: Opera:
Code:
img1._alpha = 0;
img2._alpha = 0;[code].....
View 9 Replies
Mar 21, 2007
Ok, I have a function that creates a button, it takes the paramaters
bX, bY, bcColor, bbColor, bHeight, bWidth, bHandle;
here is my function
Code:
function createButton(bX:Number, bY:Number, bcColor:Number, bbColor:Number, bHeight:Number, bWidth:Number, bHandle:MovieClip)
{
[Code]....
some reason when I try to hide Handle, it doesn't do it, & trace's dont do anything either it is suppost to create the button & store it in any handle I give it
View 3 Replies
Nov 28, 2007
Ok, the code below does get called when the mouse moves, but its like it doesnt re-run the tween until the the mouse stops moving. how to fix it? click on portfolio and select web or interactive from the drop down and you will see what I mean.
PHP Code:
mouseListener = new Object();mouseListener.onMouseMove = function() (mc_mask.hitTest(_root._xmouse, _root._ymouse, false)) mousePosX = (_root._
xmouse-mc_mask._x); mousePosY = (_root._ymouse-
[code]......
View 5 Replies
Sep 4, 2008
i have the following 2 functions.[code]when i called the first function it works... peopleOffBus(); but then when i call the other function to make p visible true, the function peopleOnBus(); doesn't work.it is calling the function but somehow my array is not working or something.
View 1 Replies
Nov 22, 2008
I'm just wondering it is that that .removeMovieClip() isn't working for me. I'm using the correct path to the object, and I've used this function many many times before. But it's not removing it now this time. I heard that there was some sort of bug in flash that you had to swap depths or something? Flash CS3
View 2 Replies
Sep 19, 2009
In actions in my .fla file I create a new object of a class (addChild) which is in an separate .as file. Now, in my .as file I want to call a function in the .fla file. This should be the parent right? So, I try parent.correct(); which does not work. I get the error #1061 (call to a possibly undefined method). However, when I do this:
var par:* = parent;
par.correct();
Everything works. Why is this?
View 3 Replies
Oct 29, 2009
I've been trying to get a flash map to zoom in and out but I can't seem to get it working, it'll zoom in fine, but not zoom out I'm zooming into a particular area of a map (Uganda in this example) with a function for a button, I'm using a boolean value to check if I am zoomed in and it registers whether it's true or false (checking with a dynamic textbox). [code]
View 8 Replies
May 26, 2011
I made a simple MOVIE which is hidden by default and will play only once the PORTFOLIO button is pressed.
PHP Code:
btn_portfolio.onRelease = function() {
subnavigation.gotoAndPlay("show");
};
I have checked and rechecked my MOVIE INSTANCE and still it's not working. I even tried adding "_root" and "this" before the "subnavigation" but still not working.
View 3 Replies
Mar 5, 2009
i have a movieclip on the main timeline, and inside that mc I have 1 button on first frame and 1 button of second frame...From the main timeline i run this script for frame 1 button...
publisering2.avpubliser_btn.onRelease = function(){
publisering2.gotoAndStop(2);
}
And this works fine.. however, i run the exact same script for the button on frame 2, ofcourse changing the path and gotoAndStop(1) instead... And this isnt working.. The button's over frame works so its activated...
View 3 Replies
Apr 27, 2009
I recently formatted my disk and installed WindowsVista Ultimate. Now, I find that this simple piece of code is not working. But earlier when I was using Windows XP, this code would open a new browser window (in firefox) and automatically prompt me to log into Gmail account, and after I log into gmail I will have this 'userEmail' successfully inserted in the "To:" field (inside gmail)
Code:
var userEmail="myemail@gmail.com"
getURL("mailto:"+userEmail);
Can't figure out why this is not working in my new OS.
View 18 Replies