ActionScript 2.0 :: Retrieving The Perpendicular Angle From An Arc?
Mar 17, 2003
I'm working on the pinball game. I need to come up with a way of retreiving the right angle from an curved line. The idea is to have the ball follow a curve around the upper border of the game field. The ball itself is going to be a point, which the ball follows, so that I can use the shape of the object when doing hit detection. I'm not sure if that's relivant to the subject or not.
View 14 Replies
Similar Posts:
Jun 11, 2011
I am currently working my way through a book on Game Programming in Actionscript 3, and have gotten to a formula required for collision detection on finding the intersection point of two vectors. Im not sure if the author uses vectors in the strictest definition, but the convention he uses is e.g for a vector V1 :
V1.a is the start point of the vector V1.b is the end point of the vector V1.ln is the vector perpendicular to V1 (its 'left normal') V1.vx is the difference between the x coordinate of V1.b and V1.a V1.vy similar to vx V1.dx is the same as vx , but for V1 scaled down to a unit vector (the direction vector) Now,in the example we have V1 which is the motion vector of the ship, and V2, which is the target vector (i.e the line the ship is going to collide with at some point)
In order to calculate at what point on V2 the ship will collide travelling along motion vector V1, the book gives the following code using the "perpendicular dot product" (Which i have not come across before) and creating a third vector V3 between the start point of V1 and the start point of V2 (V1.a and V2.a):
[Code]...
View 1 Replies
Feb 9, 2005
Ive made this rotation with AS. But Id like to make the bar to move from angle A to angle B smoothly.
How can I do this?
View 2 Replies
May 19, 2009
What I'd like it to do is find out what key was last pressed and then based on which key it was, go to a specific frame of guy_mc. So basically if the left key was the last key press I want it to go to frame "Left", if right key was the last, go to frame "Right," etc. I'm completely lost on this one and every tutorial I come across is based in AS2 which has much simpler methods than AS3.
Code:
//listen for guy_mc to see if all keys are up
guy_mc.addEventListener(Event.ENTER_FRAME, allKeys);
//if all keys are up...
[code]....
View 1 Replies
Jun 19, 2009
I have an array variable called ball[#], which value starts at 0 and is incremented up to 8. I also have a corresponding array variable called _ballPlaced which returns true or false if a ball is placed in a target zone. What I would like to do is retrieve the array value variable from the ball[#] at any time. For instance, the ball[#] variable can be clicked and dragged, so when it's selected it becomes the event.target. E.g. How can I put the array value of the ball[0] in the ball _ballPlaced array.
ActionScript Code:event.target._ballPlaced[/* retrieve vale of ball[0] array i.e. 0 and put it in here */]
View 1 Replies
Jul 5, 2011
So basically, I need to find a way to retrieve the image url that is stored in a database, and I need to do it through asp.net if possible (I want to avoid XML if I can). I'm an actionscript 3 newbie so I don't know what calls I might use to connect to the .net page, but I am able to retrieve the data through SQL to the .net page.
View 2 Replies
Feb 6, 2007
How do I go about retreiving the attribute value in the following XML script. In this case "atl" in the first child?
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<hotels>
<prop id="atl">
[Code]....
View 1 Replies
Feb 27, 2009
I'm using multiple timers in a script, but I would like to use the same function with a Switch to define the appropriate action corresponding to the event.target. I've tried e.target.name but it says that name isn't a property of the Timer class... how can I retrieve the names (timer or timer2) within the onTimer function?
Code:
var timer:Timer = new Timer(3000);
var timer2:Timer = new Timer(3500);
timer.addEventListener(TimerEvent.TIMER, onTimer);
[Code].....
View 1 Replies
May 17, 2011
I'm using Flash CS4 Pro.In Motion Editor, the way that the blur works, it allows you to blur an object on X and/or Y axis.That means you blur horizontaly or/and verticaly.I would like to make a blur motion at another angle, by example 30 degree.
View 1 Replies
Mar 16, 2009
I have a input box in which what is typed is returned in a text field on the same page.I've created the variable inputTxt to hold the typed text and added the following code to the submit button, which works fine.
function onClick(event:MouseEvent):void
{
inputTxt = name_txt.text;
username_txt.text = "Welcome " + inputTXt + "! ";
};
I'm not sure on the code needed to retrieve the typed data on a later slide.
View 1 Replies
Mar 21, 2009
Is there a way of finding out the color of a graphic? For example if i have an array of rectangles, each with a different color set using graphics.beginFill(), can I then do something like:
color = rectangleArray[i].getColor();
View 1 Replies
Jan 21, 2010
I have created a datagrid with 2 columns. The first one is the normal text data and the second column contains buttons for each cell. What I want to do is retrieve the text information when the corresponding button on the same row is clicked. How do I get this information? I am unable to use selectedItem because I do not want to select the correct row before pressing the button.
View 2 Replies
Sep 7, 2010
I'm experimenting with data retrieval from xml spreadsheets. I have 5 links in the xml labelled:
<link0>index.html</link0>
<link1>about.html</link1>
<link2>portfolio.html</link2>
<link3>links.html</link3>
<link4>contact.html</link4>
In my movie, I have a loop, which upon each revolution a dynamic 'counter' ticks from 0 to 4, then resets etc:
[Code]....
View 3 Replies
Jan 11, 2011
I have this Load Manager Package class file now for a while and I would like to make changes to it e.g. 1st step.How to read the Xml/Text file. The first part is the original code.[code]The second part is in a way how I would like to do the same as above, but loading/reading it from the 'applicationStorageDirectory'. I have left two lines in there which are not used just for testing things. The App works as is eliminating all Errors, but of course with nothing showing of the text file.[code]
View 2 Replies
Mar 28, 2011
I have a game, in which the player can open maps to edit them. The maps each have their own colour. The player assigns a colour to the map by using sliders (R, G, B)
This all works fine.
However, I also need a way to put those sliders back in place when re-opening an existing map. This means that I need to know what the percentages of R, G and B are in a colour. I made flash trace a few of those colours, this is the output:
16646398
0
16646144
65024
58878
I need to know the amounts of R, G and B in any colour.
View 6 Replies
Nov 1, 2008
here is the deal. I am retrieving some text from an xml file in AS3.0 and i'm having some problems.
for exemple(below) :
While showing the first 3 line... I ain't able to show the last lines...
View 2 Replies
Dec 2, 2009
i have xml structure.
<?xml version="1.0" encoding="utf-8"?>
<ul>
<li><a href="http://www.google.com">Google</a></li>
[code]....
View 5 Replies
Dec 22, 2010
Have xml that looks something like the following:
<level1>ARTWORKS
<level2>ARCHIVE
<level3>COLOR</level3>
</level2>
</level1>
I am trying to retrive the ARCHIVE String, but can't seem to do that, without also getting the <level3>COLOR</level3> node. I am doing this like this: _
xmlData.navigation.level1.level2[0], which returns this:
ARCHIVE
<level3>COLOR</level3>
How do I get it to where it only returns the ARCHIVE?
View 5 Replies
Feb 13, 2009
I want to get the variable-value name pairs from an object. Anyone has got an idea how to do it? The name-value pairs are always different, not even the same lenght. I need an universal loader
[Code]...
View 0 Replies
Jul 20, 2009
I'm trying to retrieve the value of an array element in a trace statement...how do I go about this? I've had a look through the AS reference manual but can't work out what should follow the dot '.'?
ActionScript Code:
trace(currentBall.name + " is in " + zone[i]./* something here to retrieve array element value */);
View 2 Replies
Sep 15, 2009
i have several bitmap stored in an array in this way:
var my_bmp:Bitmap = new Bitmap();
my_bmp = Bitmap (event.target.content);
my_bmp.smoothing = true;
bmpArray.push(my_bmp);
how can i get later (from the array) each different image and add eventually to a movieclip?
View 9 Replies
Oct 7, 2009
I am stuck with a problem of retrieving the button Id, clicked in a dialogBox, into my FLA. To make my point clear, here is the code snippet:
ActionScript Code:
package
{
import flash.display.*;
[code]....
View 7 Replies
Jan 17, 2011
In my Javascript I am adding a variable ('videoToPlay') in order for it to be passed to the Flash object with the purpose of using it to specify which video among a list of scrolling videos is to be played.
I am completely new to Flash and Actionscript and am finding it difficult working out how/where to retrieve my variable.
[Code]...
View 9 Replies
May 29, 2005
I have a set interval working fine, however when they press the button I use clear interval. When they then press the other button to start the interval again it wont do anything?
View 2 Replies
Jan 18, 2006
I've just started out working with cookies in flash and looked at the poms tutorials [URL]Is there a list of commands that could get the users browser software etc for example?
View 2 Replies
Oct 29, 2006
I have XML data that is loaded into a mulitdimensional array.
I would like to call that information later in my actionscript but it seems that the array has not populated before I want to use it.
I am using the onload() method of the XML object.
I can trace the contents of the array directly after it is loaded with my loop, but later in the code a trace returns "undefined". My array is globally scoped.
View 14 Replies
Jun 12, 2007
Edit: By value i mean a number that is in my xml file.This is probably a very simple problem, but i've been working with this problem a few days now. I really suck at Actionscript, thats probably why.Well, I want to retrieve a value from a xml file and put it into a variable outside the onLoad function. Somehow i can trace movieIds inside the onLoad function but not outside it.Here is the code:
var playlist_xml = new XML();
playlist_xml.ignoreWhite = true;
playlist_xml.onLoad = function(success) {
[code]......
View 7 Replies
Mar 10, 2008
I am making flash mp3 player. I am using FileReference to browse for files. I won't get the file path and later realized that it is a security concern. But I tried using HTML.
I used ExternalInterface to trigger flash function from HTML which opens file selection box using FileReference.browse() option.So, as the flash file is in the HTML form, can i track the file path in HTML and send it to flash.
View 1 Replies
Feb 8, 2009
I would like to delete the movieClip that created this variable "tall" in this code I attach if it were to be a certain suit, but I keep getting undefined error messages...I think it's because it is'nt a string variable, but I am not sure since it has been retreived from the server like in the line below:
maTall.push(String(variables.tall1)); I thought that String there specifies making it a string...
[code]...
View 2 Replies
Nov 9, 2009
I'm not even sure if this is possible, but I'm looking to retrieve a string from an embedded XML file, using a variable as the XML element's name. Here's what my code currently looks like, although it doesn't quite work:
Code:
private final function getAreaTitle(_index:int):String
{
var _element:String = map_XML.mapnode.@title[_index];
[Code]....
I'm not massively familiar with the XML format, so apologies if I've not explained myself very well. As you can hopefully see, I have one XML file containing my map data and another containing my text, such as area titles and locations. What I'm trying to retrieve in the example above is the string with the label "title_training" from the "text_XML" file. Of course, the function should be able to return the title for any area, so I need to find a way of converting "_element" in to the right format
View 1 Replies