ActionScript 3.0 :: Finding If Line Passes Through Object?
Jun 21, 2009I have two points and an object with a given width(or length). I'm trying to find out if the line between those two points passes through the object.
View 3 RepliesI have two points and an object with a given width(or length). I'm trying to find out if the line between those two points passes through the object.
View 3 RepliesI am making some string variables to use in an animation. Another person in the office has has written all of the text using Word. Some of these strings have up to 50 lines and each new line has some sort of special character in there which creates an arror in AS. I can manually go through and place the cursor at the end of the line at that point, hit delete and then type in " ". This eliminates the error but I have a lot of these strings, days of work. I have not been able do a simple find and replace. Has anyone experienced this before? Is there a way to use notepad++?
View 2 RepliesIm making a game, where a player controls a character moving around the screen using the mouse.the player moves using a tween, using the current x y pos and the click x y pos to move the character around here's the thing, i have objects on the screen (such as rocks, etc) that i do not want the user to be able to walk through. i do not want to use hit test to simply chuck the character off the object in real time because that's messy and it would mean the tween continued and stuff.. instead, i want to add some code to the top of the "movePlayer" function that checks to see if an object (such as some rocks) is going to be hit, and if it does, i want the tween to only go to this point (yellow in the below diagram)
Here's what i mean:the player clicks on the screen ( the blue dot) and instead of walking straight to the blue dot, the code determines the point at which the player will hit the big orange block, and only tween to that point, if there are multiple orange blocks in the way, the tween will stop the closest block.
I need to find an instance of a movieclip that is on my flash file. It is really big and uses a lot of memory. It says on the number of times used that there is one instance of the object on the flash file, but I can't find it. I thought I deleted them all but there must be one left. How do I go about finding it? It's a really large flash file with many layers, and I don't want to just delete the library file. Is there any way I can find where the object is placed in my file?
View 2 RepliesWe have a client server architecture where a C++ server talks to Flash clients. I'm developing the server and would like to send through tcp an xy coord to simulate a button press where the receiving flash client would find the topmost visible object at that coord and send a mouse event to it such that we could simulate play without a human present. I'm told this is incredibly difficult, but it seems to me that there must be a way to do this. Am I off the mark? Or is there a mechanism in flash to iterate through all objects regardless of parent child relationships to find a visible button at an x, y coord and signal a press event?
View 2 RepliesI'm trying to write a plug-in for Flash CS5 that will display the "instances path" for a selected object. I'm trying to work with JSFL.I manged to get all selected objects using fl.getDocumentDOM().selection. I iterate over the array I get and look at the objects. I am able to get each of the objects' name. What I need to do is construct the "path" to that object (e.g., scene.scene.instance4.myText). Can anyone think of a way to do that? Is there a way to get the object that contains a certain object?
View 5 Replies* Is it possible to create weak references to objects (like theventListener/EventDispatcher is able to do) so that if they are removed, you won't be stuck keeping a reference and taking up space to something that should be garbage collected?* Is there any way to find out how many active variables are referencing a certain object? This would be handy to actually create weak references, since, if you for example, have a static array containing all objects created in that class, you can do a regular check to see if there is only one remaining reference, and if so, you can safely remove it.
* Also, might there be any way to list the entire space (one big chunk of binary data, most likely) of every variable currently running in the program, all references, basically, what Flash is currently storing in RAM?I'm pretty sure that Flash (as crappy and lacking as it is in so many areas) does not have anything like any of these built in, but hopefully there is at least something.
Since Flashbuilder does not support WCF over https, I am considering to use weborb remoting as alternative, but not really sure how flash is going to know weborb location, if they are sitting on different servers. Looked at destination, source fields, but not really find a field called url in remoteObject in Flex.
View 1 RepliesI have a menu MovieClip that has its buttons inside of it. I have the menu with a MousEvent.CLICK and trying to figure a way to register what you are clicking on.
[Code]...
There is most certainly as easy way of doing this, but for the life of me I can't find it.
How do I determine the array name of an object i.e. when I hover over a certain clip on stage, I want to identify which array it is from.
I'm often finding a need to get a stage-relative position of objects in my game, which are often buried several layers deep as children of children of children, etc, often with differently scaled/moved/rotated parents. The position i want isn't quite relative to the stage, but a main holder object i have on it called lvlHolder (see code below). I wrote a function to deal with it that recurses up the display list, accounting for each object as it goes, to get a global position. It's worked so far, but one thing it doesn't account for is rotation. I'm finding a need for that now, and i'm not sure how to account for rotation of objects, to rotate offsets from them,
My function is below. how i should enhance it to accomodate for the rotation of each parent object? Also any tips on optimisation would be good, as i'm using this a LOT (roughly twice per frame, per object, for physics calculations) I'm also wondering, in similar situations i've seen something related to transform matrices used
[Code]....
I'm working on writing a tweening class in as2 that has a callback variable and I can't seem to find a good way to get the scope without specifically passing in a scope variable as well. This tweening class needs to work in classes as well as on the timeline. Here's what my codes looks like right now.params.scope[ params.onComplete ]( params.onCompleteParams );params is an object passed into the class. This works but I don't want to have params.scope in there.
View 1 RepliesI want to find out which type an object has. Therefore I thought of the 'switch' statement, but how would you do that? The following code does not work, but you will get the point of what I want to do.
Code:
switch (object) {
case is String:
trace("string");
case is Array:
trace("array");
[Code] ....
i've been working on a problem for a while now, which involves targeting the closest movieClip in relation to the x y coords of the mouse, I've attached a nice little acompanying graphic.Each mc added to the stage has it's own sub-class (HotSpots) which uses Pythag to measure distance from mouse. At this stage i can determine the closest value from my Main class but can't figure out how to reference it back to the movieclip... hope this makes sense. Below are the two Classes.My Main Class which attachs the mcs, and monitors mouse movement and traces closest value.[code]
View 3 Repliesdetermine the base class of a Flash library object at runtime, using Actionscript? The toString method gives me the class of the object, but what I'd really like to determine is the superclass of the object. So, if I have an Actionscript class called "Fruit" and I created many different Fruit types in the Flash library ("Cherry", "Apple", etc.), is there a way in code I can determine that an "Apple" is a child of "Fruit"?
View 2 RepliesIs there a way to have a function draw a box around an object by finding the objects instance name via a string?
such as:
Code:
function BoxObject(object) {
//code to draw a box around the object
}
and then juts have an object with an instance name, like "my_mc" and then call the function on a keyframe like:
BoxObject("my_mc");
I have a video inside of another movieclip. When I go full screen, I scale up the outer movieclip to fit the screen. So that OuterMovieClip.width is equal to screenWidth etc. How do I maintain the aspect ratio on my video so it does not get distorted? Whats the proper math for that?
View 1 RepliesI'm developing a game like application in flash (as3) which is embedded in an html page.it uses many classes and timers etc..while viewing the page it plays as normal. but after some 5 to 10 minutes the flash player becomes slow,slowing down every process.
View 4 RepliesHere is what I'm doing (using AS 2.0)I'm generating some XML based on parameters passed in a URLOn Frame One, I have an input text box. I would like whatever the user inputs in that text box to pass into the URL. For example, if I had a text box that said ZIPCODE: _________ I'd like that zip code to be passed into the URL
Code:
stop();
this.btn_send.onRelease = function() {
[code].....
I've gotten stuck on a sound issue where I want the sound to play when the mouse passes over a symbol, which I've managed to get working, but unfortunately it is also playing when the page first opens, which I certainly do not want.
The script is:
cow.addEventListener(MouseEvent.MOUSE_OVER,gomoo); function gomoo(evt:MouseEvent) { var entermoo:Sound = new Cowmoo(); entermoo.play(); }
Given this: if(myVar){}, what will pass as true or false?In JavaScript for example, false are values like null, undefined, 0, '' (empty string), false.
View 2 RepliesWhat passes to a subclass extending from a main or superclass, be it document or extending from a general MovieClip class etc? Does it pass absolutely everything from the superclass? That is to say, instance functions, variables defined inside these functions etc? Or just constructor variables? What passes through and does 'static' affect the transference of these values?
View 2 Repliesi have a text field within a movieclip and i would like the hand cursor to show when the mouse passes over it. but the hand won't show, i'm not sure if the text field is influencing the outcome.
var mc:MovieClip = new MovieClip();
mc.useHandCursor = true;
addChild(mc);[code]...........
I'm trying to code the snap to grid functionality. The dragged object should snap to the grid if the distance between the object bounds and a grid line is less than 5px. I found a way to do it if the object's rotation is 0 but it doesn't work if I rotate the object. I need a different approach. Can you point me into the right direction with the algorythm or any source code?
View 3 RepliesI've written an event listener that passes 2 arguments with it. Now, after the condition is met,I've to remove the event listener but with no success..Here's the code:
//Function animateChar called on Enter Frame event with 2 arguments
www.addEventListener(Event.ENTER_FRAME, animateChar(184, 86), false, 0, true);
//Here's where animateChar is defined
private function animateChar(__x, __y):Function { return function(e:Event):void { var t = e.target; t.x += (__x - t.x)/speed; t.y += (__y - t.y)/speed; if ((Math.round(t.x) == __x) || (Math.round(t.y) == __y)){ t.removeEventListener(Event.ENTER_FRAME, animateChar); // Not working.. } } }
I have a project I'm working on and I am really stumped on making a seemingly simple animation work.The animation is of a coin scratching off a layer to reveal the layer beneath. I have the coin animated, and the layers in place. I am wanting to know if there is a way to erase/delete every place the coin passes over the stage, revealing the layer beneath. I've seen animations where ActionScript is used to allow a user to control the coin/pointer and activate the "scratch-off" effect. However, I am trying to come up with a method that is not a user-initiated animation since I want the effect to repeat in several places in the timeline.For the life of me I cannot figure out how to make this work. I am a moderately skilled Flash user and an ActionScript novice.
View 1 RepliesIs it possible to say, make an application that passes its keyboard events to other programs?Like if I typed something into a text field in flash it would also "type" it into chrome, microsoft word, notepad++, ext.
View 1 RepliesOk so I have a function (loadthm1) on frame 1 of the main time line. I want to call it from inside a movie clip as the playhead passes a frame. In as2 I could just say _parent or _root.functionName(); but in as3 I get a undefined method error. How do I point to the function and call it?
ActionScript Code:
var thmLoader1:Loader;
function loadthm1(url:String):void {
[Code]...
How do I write my class so it passes all of its functions/methods to the calling movieclip? For example, the following code imports my graphics class and creates a square:
ActionScript Code:
import sprites.vectorGraphics;
var vGX = new vectorGraphics();
var newSquare = vGX.createVector(this, 'square', 'rectangle', 20, 20, 0xff0000, 1, 0x0000ff, true);
That I'd like to be able to do is this:
ActionScript Code:
import sprites.vectorGraphics;
var newSquare = createVector(this, 'square', 'rectangle', 20, 20, 0xff0000, 1, 0x0000ff, true);
Is it possible to add code (...html or php?) to an html link (i.e the link will be featured in an html website) that passes a variable into the flash site it links to (just something simple like '_root.pageChoice = "home3" '? So when the site opens the swf turns to a certain page?This will be necessary as there will be links to the site from different html sites and each will need to see a different version of a certain page.
View 4 Replies