ActionScript 3.0 :: Making A Cannon Fire?
May 8, 2011
Me and my friend are making a sidescrolling shooter to learn ActionScript 3. But we can't make our cannon shoot the cannonball. Here is the cannon.as
ActionScript Code:
package com.edwardothesheep
{
import flash.display.*;[code]....
And this is the error it gives:
TypeError:::Stage@1fc34b51 to flash.display.MovieClip.
at com.edwardothesheep::cannon/shoot()[C:UsersIanDownloadscannontestcannontestcome dwardothesheepcannon.as:33]
View 1 Replies
Similar Posts:
Jan 28, 2010
this one has got me stumped. I want an object to move 10 pixels every time a key is pressed, and I don't want it to keep moving when the key is held down.And I want to know why it moves once, and then waits a bit before moving more. I do not see why anyone would want it to do that!!!
View 1 Replies
Feb 20, 2012
EDIT: Rotation issue is solved with this:
ActionScript Code:
Math.atan2(ydif, xdif)/(Math.PI/180)-90;
I made a cannon consisting of 3 movie clips: The barrel, base and projectile. I want the barrel to point toward the mouse and the projectile to follow the barrel on the "inside" (behind the movie clip). Also i don't want the barrel to instantly go to different angels, a smooth animation that make the barrel feel like it has some weight would be nice.
Here is an image of the project: [URL]..
View 2 Replies
Oct 26, 2004
How would you script a parabol? i want to be able to "fire" a shell/cannon on a certain angle and have it do a parabol/curve in the air and land/hit.
View 3 Replies
Feb 8, 2011
For a project, I'm making an interactive side scroller.You move the character with the arrow keys and press the space bar to interact with things.So far, I followed DexNote's tutorial on YouTube.I thought that I would make the interactable objects as buttons, while the mouse focus would be on the character and when you press the space bar it make a mouse click in that area.The trouble I'm having now is that I don't know how to make the space bar trigger the "interactions."
View 1 Replies
Mar 14, 2009
ok, now that i have the cursor and following the mouse done, i need to find out how to fire a missile by clicking.
View 3 Replies
Jun 11, 2010
I have a VideoProgressEvent on my FLVPlayback but when I test the video I get these in the log:
_streamLength = NaNcalling getStreamLengthcalling getStreamLengthResult(880.821)
View 5 Replies
Oct 12, 2009
In an AIR application, I have a private variable and a setter:
[Code]...
The first time that I set "saveResult" the event fires. But it will never fire again unless I restart the application. If I change the setter to:
[Code]...
View 2 Replies
Sep 19, 2007
I set up some code to record key presses and specific chords. My problem is that I only want the keys to fire once when pressed. This is especially a problem when I require the user to hold CTRL + LEFT for an action.
The user experience is that I want users to hold down CTRL to enter a mode and then press the LEFT key as many times as needed. Currently, the CTRL trace and LEFT trace fire continuously. Is there a way to do a onKeyRelease?
Code:
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.CONTROL)) {
[Code]....
View 1 Replies
Jan 12, 2009
i have a little flash-player with a playlist and so, it plays normally a vlc-mp3-stream but has an extended prelisten-function (wich plays the mp3's directly via http, secured with a password)i've got an array with 2 Sound()-objects (for preloading purposes), the code looks like this :
Code:
playStream = url=="";
if (playStream) {
SoundObjects[SN].load(new URLRequest("http://" + URL + ":8001/MIRstream.mp3?" + Math.random()), sloader);
} else {
[code]....
this works for the vlc stream (which is not continuos), but not for the mp3s on the http-server in my opinion, this doesn't makes sense..except, maybe the recent CSRF-hardcore-paranoia [URL]
PS: i use AS3 with flex_sdk_3.2.0.3794 and flashdevelop (i activated flash10-support, but it still works in fp9)
View 1 Replies
Jul 27, 2009
This may seem totally impossible - but I can't get any script to fire off the timeline. I have been given an fla, big animation about 15000 frames long, and no script will run from the timeline. I have tried everything - reset classpaths, delete ASO file, rebuilt a fresh project from the original project's layers... There are no compiler errors If anyone has experienced this then lend me a hand...I'm about to tear my last piece of hair out!
View 2 Replies
Sep 20, 2008
how on earth do you get a timer to fire randomly? I've had little practice with timers but thought this would be a simply task to complete but cant figure out?
i've got a movieclip which"pulses" using the EnterFrame event, but would also like something else happen to this clip atrandom intervals using a timer. i've tried "timer = new Timer(Math.random() * 1000); but nothing - it just fires for the first time at a random time, then at set intervals after that....
how do you get it to randomly dispatch?
View 2 Replies
Nov 11, 2011
when i saw this website. I learn some techniques but i really love that fire effect. how to do that?Or any other program. The site:[URL]..
View 1 Replies
Dec 15, 2009
I wanted to use the currentStateChange event in my application but whatever code being called in this event was not executed so I thought may be there's something wrong with my code so I tried testing it on one of the examples in adobe live docs.So I took this example here
<mx:states>
<mx:State name="One">
<mx:SetProperty target="{p1}" name="x" value="110"/>[code]....
And all what I did is placing an alert in both events currentStateChange and currentStateChanging of panel One and I didn't get the alerts when clicking on the panel.I also tried replacing the inline code with a call to a function that makes the alert also nothing happened.
View 1 Replies
Feb 25, 2010
So I had a requirement to add an undo function to my app and I discovered this nifty ChangeWatcher class, but it's not doing exactly what I want and I'm hoping someone knows how.ChangeWatcher seems to monitor assignments to the variable reference. So when I say:
myXML = <xml/>
it fires off it's function just fine and dandy, but when I say: myXML.appendChild(thisOtherXMLVar)
I get nothing, even though the variable changes the reference doesn't so ChangeWatcher doesn't fire off the function.how to get ChangeWatcher to pick up on all changes to a variable?
View 1 Replies
Dec 1, 2010
I have a series of symbols on my stage which represent lamps. Once a frame, I want to randomly select a lamp and switch it on if its off, or off if its on; I already have a working function which does this.
I have tried to use the onEnterFrame function to try and fire this function once a frame, but I don't seem to be having much luck, largely because I do not know how to use onEnterFrame correctly. So I have a movie where my function is fired only once when it is first run.
View 4 Replies
Sep 19, 2011
I am making a custom scrolling list (smart phone like) in actionscript 3 and have the parent contianer catch mouseEvents for MOUSE_UP and MOUSE_ DOWN.Sometimes the mouse up event is missed, maybe one in 20. Does this happen if the events fire to rapidly? I do not want to use the MOUSE_ CLICK event beacuse if the mouse pointer moved at all I want the list to scroll and not catch a Click event.[code]Can I somehow ensure that all events are fired?Or if not can I somehow get mouse button states directly from flash? Not via the mouse event object, but in onEnterFrame().
View 3 Replies
Feb 18, 2009
I've managed to design myself a pretty awesome little conundrum and I know there are some kickass Flash peoples here I'm working on site for a friend of mine in class. I built a Flash website for them, but I didn't want to make Flash based MessageBoards and Blogs, so I built those in PHP. You can see the website at: [URL] I can simply link away from the Flash website to the Messageboards [URL] But instead, i want the boards to slide down OVER the Flash website using Ajax and Mootools and Absolute positioning the div containing the Messageboard. That part's not important, what's important is...
How do I get my "the.BOARD:" btn, in the Flash site, to fire the Javascript function that'll make the ajax call and slide the div out over the flash site? Lets say the function is called "moveBoard();" Does anyone know of a way to fire this js function from the CLICK of a moveiclip in Flash? Let me know if anyone needs alittle more information.
View 2 Replies
Sep 28, 2010
Working on an mp3 player that i have cobbled together myself, bit rusty on the as3 so im sure it could be improved in many ways but the it works apart from that i cannot get the SOUND_COMPLETE event to fire at the end of a track, thus playing the next track. I have looked on this forum and others but cannot seem to get this to work
[Code]...
View 6 Replies
Jun 18, 2005
I'm starting to learn classes and I'm doing a class that loads a textfile with a variable, using loadVars, followed by pure html text, then it applies css to the html text and displays it in a target textfield...I'm still new at this as I said so the code is very rough. I've worked out all the little kinks up to now..I'm stuck at one thing:When the text loads, the "loadVars.onLoad = function" is supposed to fire the css function that applies the stylesheet to the text, but I simply can't get the function to run...Is it impossible to call a private function from another private function in a class block?code:
Code:
class LoadHtmlText {
/**
[code].....
View 4 Replies
Sep 24, 2008
What would be the most efficient way to do this? TIA
View 2 Replies
Apr 1, 2009
Can I store function names in arrays, which then can be used to fire those functions when that array value is called? So basically - I mouse click, and that += 1 to my num var.
Code:
var myF:Array = new Array("thisone","thatone");
var num:Number = 0;
function thisone()
[Code]....
I dont know how to make a function call from a string value!
View 3 Replies
Apr 8, 2009
I've searched and searched on this but with no exact answer. I have a script for scroll wheel support (which I shamefully purchased due to time constraints) but it only works in Internet Explorer. Can some one kindly look at this script and tell me why the scroll wheel only works in IE but not firefox and safari? From my searching it looks like a common issue but I cannot find a resolution to it.
[Code]...
View 1 Replies
Feb 1, 2010
I am hoping someone has a quick answer for me on this. I am trying to handle a drag event when the cursor leaves the stage. Should be fairly simple with Event.MOUSE_LEAVE, but I am having unexpected difficulties.with:
Code:
this.stage.addEventListener(Event.MOUSE_LEAVE,this.mouseDragReleaseHandler);
I never reach the code in mouseDragReleaseHandler
[code]....
View 1 Replies
Jul 12, 2003
I want to generate large text files, basically 4 columns, several thousand rows, of numbers. Making an array with all this info in it occurs farily quickly, it's getting it to a displayable format that takes a really long time. Right now I use something like this:
[Code]...
View 10 Replies
May 11, 2009
I've never needed it until today but I just found out that the alt key doesn't fire it's own keypress events. I need a way to detect when that key get's pressed - any ideas out there?
View 9 Replies
Aug 9, 2011
I have a fieldgoal kicking game that I am making I have the basic game done, but I have some things that I want to add but I dont know were to look to the resources. 1. I only want one football on screen at a time right now as many times as you click it kick's a football 2 I also want the placement of my fire arrow to be in a random location for each kick
View 5 Replies
Jul 21, 2010
I am trying to program a game and I want the enemy character to fire a bullet every second, but instead he is firing an infinite amount of bullets right after the other. Here's the code with the timer:
if (k == 0){
var shootRight1 = new Timer(1000,1);
shootRight1.addEventListener(TimerEvent.TIMER_COMPLETE, enemy1shoot);
shootRight1.start();
[code]....
View 5 Replies
Sep 8, 2010
I write a mouse_over event handler in a movieclip. But the event fired when the application run automatically even if the mouse out of the application.
View 6 Replies
May 24, 2010
I have made this short example to demonstrate some problems I'm having.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Canvas
id="buttonCanvas"
[Code]...
View 3 Replies