ActionScript 2.0 :: CS3 Complex Rotating Turret
Jun 12, 2010
I'm trying to make a turret that points towards the cursor, but lags when the cursor is moved. I can get this to work, however I am running into problems when the cursor crosses from quadrant 4 to 3 (and vice versa). The problem is that the function I am using to control the turret's rotation rotates the turret around the opposite direction almost 360 degrees to get to the new position, instead of moving the few degrees it needs to.
View 3 Replies
Similar Posts:
Aug 20, 2009
i am trying to make a "double-barrel" firing cannon in AS3..below is a crappy drawing of what im trying to acheive...im having trouble making the two bullets come out where they should (1 on the left barrel, 1 on the right barrel). prior to this, i already successfully created a standard "one-barrel" turret that rotates depending on the mouse location and fires 1 bullet per shot.. what i'm trying to do now is (like i said above) to create a double-barrel turret that would fire 2 bullets per shot (1 on the gun1 and 1 on gun2)..below is the code i used for the single-barrel turret: on the timeline:
ActionScript Code:
stage.addEventListener(Event.ENTER_FRAME, followMouse);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fireBullet);
var radians:Number;
[code]....
View 0 Replies
Mar 18, 2009
i am terrible at explaning things but i'm going to try my best.for example. I have a rotating turret that will follow the mouse 360 degrees.so i wonder if it is possible to go inside the turret ("mc") and stop at frame (2);when the turret reaches 170 degrees.
View 2 Replies
Oct 11, 2011
I have a Spaceship movieclip, with a movieclip Turret inside. Spaceship extends the Unit class, where I want to rotate the Turret. In my Spaceship constructor, I use super(this.turret); but this always returns null. Passing other variables works, and before calling super(), I can successfully trace this.turret So why can't I pass it to super? And how can I fix this? [edit] Perhaps it has something to do with the turret not being available/added to stage yet when super() is called? If so, how could I deal with that and get it "Unit" anyways?
View 1 Replies
Aug 11, 2004
I know there's all these posts on how to use For... loops to hittest, but no matter how hard I try, they just don't work. So, after hours of hair tearing, paceing and starting a new game I've decided to bother you all for help.
My situation is that in the game I'm making, I have a movable turret firing duplicated bullets. I need to hittest them against a duplicated set of oncoming robots. I've tried using a for loop, but I just can't get it to work.
I've attached the .FLA, and I would be grateful if anyone could point out what I'm doing wrong (ignore the values for removing the clips and the random duplication; I had to shrink the stage size to make the file size smaller
View 3 Replies
Aug 11, 2009
i recently learned how to program a tank-type game.. i was able to make the turret follow the mouse and fire bullets that would move to the direction the turret was pointed at..what i'm trying to do now though is make the bullet follow an object moving on stage.. sort of like a heat-seeking missile..
View 2 Replies
Nov 1, 2005
I have a rotating menu that sets the selected button to the 3:00 position once clicked. I need the labels for the buttons to stay in the upright position as they rotate with the button. I have attached an image. Anyone know of an action script that would keep the labels upright?
View 8 Replies
Jul 27, 2009
I am trying to work with this xml in AS3. [URL]. But I am getting a url error. I was wondering how to read this in, or what might be causing me to get this error:
ActionScript Code:
Error opening URL '[URL]'
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. [URL]&List={76269379-92F6-4418-8605-0A5414F91AA9}&View={9F672220-5766-409C-9C90-D746C4B85223}
at SharepointXML_fla::MainTimeline/frame1()
The xml shows up when you go here, but it won't read in.
View 1 Replies
Aug 29, 2008
I'm having some trouble with a movie clip button. Basically I have a button that when you click it it sends you to another frame on the root timeline. This all works fine, however I want the button to stay in it's transformed state whilst you are in the specific root timeline frame, therefore signifying where you are on the site. Here's the code I have used -
[Code]...
View 6 Replies
Jul 28, 2009
making a flash game that has a lot of rather complex illustrator graphics. In the game you walk down a street, so all the graphics has to be moved every frame. In some levels where there are a lot of objects in the street the game starts to lag. after importing it to flash and making a mc of it, break it apart to save flash from drawing all the shapes that aren visible anyway?
View 2 Replies
Apr 24, 2011
I would like an animation to play (of the words being scribbled out) and when you mouseout, it goes back to normal. On page click, I wanted the link to change colour so that you would know which page you were on.I have created a frame by frame animation of the words being scribbled out, but I don't know what to do with the animation!How do I insert it into my html? Do I need to use actionscript in flash?
View 2 Replies
Aug 5, 2010
I'm building an event calendar as part of a website .The calendar is divided into two sections, "calendar" on the right with the actual calendar displayed, and "calendarContent" on the left, where information about the evnts is supposed to show up. The different frames in "calendarContent" are all labeled. Within "calendar" I have different movieclips for each month, and inside each month I put the buttons that open the event descriptions in "calendarContent."
Now, for some reason it's not working. The function I'm trying is the following:
MovieClip(root).pages.calendarContent.gotoAndStop("artsundays");where "pages" is the name of the parent movieclip that "calendar" and "calendarContent" are both inside, and "artsundays" is the label for the frame in "calendarContent" I want to go to. The function is placed within one of the month movieclips. I get the following error:TypeError: Error #1010: A term is undefined and has no properties.I've also tried usng MovieClip(parent) instead of MovieClip(root).pages (since "pages" is the parent), as well as a few other variations, but the problem remained.
View 9 Replies
Jul 14, 2009
I've this application, where two children are playing catch. One throws and the other catches. While I can show a ball object moving between two stationary objects, how do I show the objects "releasing" and "catching" the ball, in a way that is close to lifelike?[URL]...
View 3 Replies
Sep 27, 2011
I'm trying to understand if it is possible to generate complex PDF files with Flex. By complex I mean add images, styled text (font-family, weight, columns) layout elements with large degree of control and so on. I was looking at AlivePDF library but cannot understand if it can handle more complicated PDF generation than plain text.
View 1 Replies
Aug 15, 2009
...for example, I'm trying to import a sun shaped PNG... I want the suns rays to act as the masking object... so I can see what's beneath it through the rays. Think of taking the paint brush, making a circle and then the rays are just again a paintbrush stroke.When I set up the mask however, though it's a transparent png, it ignores the actual shape & turns into a rectangle.
View 6 Replies
Jan 13, 2011
I'm pretty new to flash and action script, and I'm trying to create a complex button. But when I test the scene, it won't stop it keeps looping. I checked for errors and its come up with syntax error: expecting semicolon before leftbrace.[code]...
View 0 Replies
Jan 15, 2011
If I have a button inside a movieclip inside another movieclip and so on, how do I remove a child of the stage or a child of a child of the stage from somewhere several layers up from that? I am having trouble understanding stage and movieclip heirarchy I guess.If that's not clear, here's another example of what I don't get.
a_mc contains b_mc which contains c_mc which contains d_mc which contains e_mc. If I have a button inside e_mc called f_mc, how do I remove c_mc from that button?
View 1 Replies
Apr 22, 2009
When you open the website and load the contaner with all mc,there is two situations:
1) Load perfectly and my container 3D effect is not so CPU Intensive and works smooth
2) My container with all _MC is very slow and eatin the CPU. The 3D effect is totally screwed up. The container is scaling it self all the time on the x-as and y-as.
Open the a new browser and set it to max view (not fullscreen) then open the domein URL...I use Tweener addTween() for the 3D effect... off course if i turn it off its all fine.. But i like this 3D effect so much.
View 1 Replies
Apr 20, 2004
Data=["M", "XYZ", "1/1/00"]
Attributes=["sex", "name", "date"]
Search=["sex", "name", "date"]
var orignal="{sex}<b>{name}</b>{date}"
I am getting a string from XML file in the above format which i am storing in original varible. But at the time of showing the output, I want values of the variables ( {sex} ..those are in culy braces) to be displayed which are their in array Data....like for sex value is M ..for name it is xyz...etc...and the values should be displayed in a format defined in the strring....so how do i create a new string which would look like this...newstring="M<b>xyz</b>1/1/00"
View 2 Replies
Sep 2, 2004
I have 7 main navigation items, some of them have pop-out menus to the right with subnavigation. Current Example I'm trying to get it to behave like this:- You roll over Nav item 1, and Nav1's subnavigation shows to the right- You are able to still click on Nav item 1 or it's subnavigation and each will bring up content- When you roll off the area (nav1's area + subnav1's area), the submenu goes awayAs you can see, I've got Nav1's rollOver and rollOut working, but now I need to place a button area over "Musical Arts Center" (Nav1) so I can have an onRelease for that item
View 1 Replies
Feb 21, 2007
How I can get the complex button, when pressed to goto a certain frame of the main timeline and not the complex button timeline. Right now I have it set when press and release gotoandplay(2)... but it plays the button timeline and not the main timeline:
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
}}
this.onRollOver = function(){
rewind = false;
play();
}this.onRollOut = function(){
rewind = true;
}this.onRelease = function(){
gotoAndPlay(2);
}
View 1 Replies
Jul 17, 2003
There are two stationary balls-ball A and ball B. There is another ball- ball C, which has to move from ballA to ballB.The problem is that when the I "run" the movie, ball C is automatically placed at the position of ballB. That is, I do not see ball C moving from the position of ball A to the position of ball B.I have used a line-drawing algorithm to move ball C. Also, the entire stuff is written in Actionscript. PS:this._x++ and this._y++ will not work because ballC has to travel the exact path between the two balls
View 4 Replies
Mar 28, 2009
I need to check if two (rather complex) arrays are exactly the same. I know that I can simply loop through everything & set a flag in case something is not the same, but I was wondering if there would be some easier way than this using a pre-built method?
View 11 Replies
Jul 8, 2009
I am trying to make an educational script and I must use conditionals to detect how my movieclips are gonna act. I have two buttons and if they are clicked their related variable equals to 1. if not pressed their variables are 0. I put a button to see their state (if 1 or 0) and trace the variables. I am sending Fla to check if I am making any mistakes.. even I click different buttons to change the variables, I always get the same trace...
PHP Code:
var released:Number;var pump_situation:Number;serbestbirak.addEventListener(MouseEvent.CLICK, serbestbirakma);function serbestbirakma(event:MouseEvent):void (even
[code]....
View 5 Replies
Dec 14, 2009
I'm writing code for a website (for the first time) using Flash CS4 AS3 and am hoping someone out there can answer a simple question for me. I have multiple buttons on the stage that point to different areas of the timeline. All of the simple buttons work fine.he problem that I'm having is with the complex buttons (that have a movie clip in them) only work one time and then die. They still animate, but don't function after the first use...Why?! I've googled for days and am baffled to my wits end.I'm talking about and be able to point me in some direction. I've tried several different things from different sites, so the code is a little funny right now. The buttons that don't work are 'mybutton, pic1, and entrypic1.' Everything is labeled correctly in the properties manager and the code is below:
stop();
function setupEvents() {
pic1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
[code]......
View 5 Replies
Feb 1, 2010
i'm trying to create a menu system where each item expands in height when clicked but is then collapsed back to the original state when other items are clicked.m is the height of the expanded state. n is the height of the collapsed state. i is the number tacked on the instance name.Also, I'm using Tweener for smoother transitions. I've done this already by copying out the code but it's 24 items so 24x24 lines of code when I'd like to be able to do it a little more elegantly. Here's roughly what I want to do, but don't know if it's possible:[code]So every box below the one that's been clicked on most recently gets the value of m added to the y value and every box above doesn't.Is it possible to retrieve the value of the variable i that corresponds to the currentTarget?
View 1 Replies
Apr 20, 2004
Data=["M", "XYZ", "1/1/00"]
Attributes=["sex", "name", "date"]
Search=["sex", "name", "date"]
var orignal="{sex}<b>{name}</b>{date}"
I am getting a string from XML file in the above format which I am storing in original variable. But at the time of showing the output, I want values of the variables ( {sex} ..those are in culy braces) to be displayed which are their in array Data....like for sex value is M ..for name it is xyz, etc. And the values should be displayed in a format defined in the string....so how do I create a new string which would look like this...
newstring="M<b>xyz</b>1/1/00"
View 2 Replies
Mar 19, 2009
I have buttons that need to perform multiple functions: On rollover, they send their link to the browser's status bar. On roll out they clear the status bar. On press they send tracking code to the html. And on release they send getURL with the link. I've put in some variables so that I don't need to copy the links over and over, but I'd really like to streamline button functions so that I don't need to make a whole new set of onRollover onRollout onPress onRelease functions for each and every link. how to simplify button functions so that they can work for any button.
Code:
//IMPORT THE JAVASCRIPT EXTERNAL
import flash.external.*;
//THE FUNCTION THAT WILL CALL THE JAVASCRIPT FUNCTION IN THE HEAD OF THE HTML DOC
function jsStatus(link) {
// The name of a JavaScript function to call
//IN QUOTES, IN THIS CASE callStatusBar
[Code]...
View 2 Replies
Jun 2, 2009
I've been attempting some pathfinding and I have got really close! it works fine until its surrounded by other nodes that have already been tested which means it cant do complex maps so heres the code:
A*
Code:
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.TextField;
public class pf extends MovieClip {
[Code] .....
I'm sure I have got it 99% right just that last bit is wrong.
View 4 Replies
Oct 28, 2009
I was thinking of making a complex number class but then realized it would be a bit of a pain to have to call functions every time I wanted to perform operations on them. Would there be any way that I could set two complex numbers like so:
Code:
var z:Complex = new Complex(-0.7, 1.4); //where the number is then -0.7 + 1.4i
var c:Complex = new Complex(1, 1.1);
and then store the result in another?
Code:
var x:Complex = z + c;
In other words, is there a way to make the +, -, * and / operators behave in ways other than those they normally would?
View 2 Replies