ActionScript 3.0 :: Finding Biggest Value Without Using An If
Jun 25, 2009Does anybody know if there is a command to say: x= biggest value out of a,b,c,d,e ( without using an if )
View 2 RepliesDoes anybody know if there is a command to say: x= biggest value out of a,b,c,d,e ( without using an if )
View 2 RepliesThis is in AS3:
ActionScript Code:
itemPropertyX = event.target.parent.propertyX;
Simple enough code, works fine when the event.target.parent is the one that has .propertyX, but I'm using this as part of a function for use on various things, and not event.target is the same number of .parents from the .propertyX, so some of them need to be
ActionScript Code:
itemPropertyX = event.target.parent.parent.propertyX;
.. but I can't change the code or the ones that only need the one parent don't work, right?So.. how do I find the topmost parent? I tried using event.target.root but that comes out to be the stage every time.
I'm trying to center a movieClip on the stage but this movieclip is animated from a simple pixel to its full size.So when i try to get the width and height of this MC I get a width of 5. While the width is 500 after the animation is played.How can i get the biggest width of this MC so I can center the MC at the start of the anim?
View 0 RepliesWhich is the simplest way to get the biggest number in an array?
Is there any method that does it directly or I have to order the array and get the last element of it?
What's the command for choosing the biggest value out of for ex. 5 variables? Math.max(); can only take 2 values.
View 2 RepliesI need an algorithm to place a set of N rectangles inside a circle for radius R, so that they can scaled up to the biggest possible size that doesn't exceed the border of the circle.
View 1 Repliesfinding a good swf to fla converter. I would love a trial version that lets me actually see the action script.
View 1 RepliesI 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 RepliesI'd like to use the x and y mouse coordinates as variables in a program. I'm very new to Flash and ActionScript and I'm not even sure which classes I need to import or which listeners or handlers I need to use.
View 1 RepliesI am interested in finding a good swf to fla converter. I would love a trial version that lets me actually see the action script.
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 am studying CS5 but I can't find help files or tutorials... is everything online now? Where should I go for help?
View 3 RepliesThis should be a simple one. I am running an IF statement that needs to check the 5th value in a pre-populated array. I'm finding it hard to find the right method of searching the array.
[Code]....
indexOf seems to just return where the value is...but I already know where it is! I just want to know WHAT it is! There will also be values that are exactly the same in other positions in the array. I have to focus in specifically on the 5th value.
I have a flash app hosted at The contents of that crossdomain.xml file are as follows:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
[code].....
I need to break a number down to be represented by a randomly ordered sequence of 2s and 3s.[code]I'm currently doing this with a loop in ActionScript 3 but have been looking into the possibility of using some kind of mathematical formula to save me a few lines of code. I'm a bit of a sop when it comes to Math and I've not yet found anything suitable.
View 4 RepliesAt some point I will have created a MC on the stage. Later on, I want to put a different on in its place. The original MC may, or may not, be there.So I need to first check and see if it is there, whack it if it is, then add my new one.I know the name of the variable I used to create the MC, but I think the problem is I did this from INSIDE another clip. When I am trying to find it and remove it, I am outside that clip, so I don't think the main timeline knows of that variable. So when I try:if(ribbonEGM) removeChild(ribbonEGM);[code]How can I test and remove the ribbonEGM clip from the main timeline?
View 9 RepliesI have to find a node value in my xml, and where is this childnode there to reading the block.
[Code]...
I have made a few posts now, and I'd like to especially Prid for not only answering them, but for giving me guidance on how to learn AS2. I am progressing very nicely, and have made a couple of simple games without any tutorials, but theres one thing I couldn't find. I have this character which can move, up and down, left and right. I also have an enemy trying to shoot at him. However, this enemy needs to know where the character is. I already have the shooting code (Prid), but it was for shooting in the direction of the mouse. What I need now is to replace the bit of code that finds the mouse coordinates with code that finds the coordinates of the player.
The shooting code is on the frame (doubt that is important to say, but still) and the instance AND name of the Character is, well, Character. So basically, I need a code to calculate coordinates of a movie clip that does not have a fixed position. Oh and one more thing, should I post simple stuff like this in the beginner section, because I've seen waaay more complicated stuff there than in the AS2 section.
My main loads an external swf. Then it creates a bunch of ball movie clips on the stage. I need to reference the content from labeled frames in the external swf. In AS2 all you had to do was use _level.
View 6 RepliesI am having trouble in finding target in a drag drop scenario. I have a movie placeholder named onepic1 and i load a movie using
Code:
onepic1.loadMovie(this.img1lnk);
[Code].....
I am wondering if Flash has a built in way of finding if a value in an array exists. IndexOf only works with string values, but I couldn't find any function that tries to find a value of any data type in an array.
If there isn't one, I will just end up using this:
Code:
contains = function (array, input) {
for (i=0; i<array.length; i++) {
if (array[i] == input) {
return 1;
}
}
};
I am trying not to use my own functions for things that Flash already has built-in, so I just want to double check with you all in case I missed something
Is there a way in AS 2, to figure out where a swf is embedded, without the use of FlashVars? I have a widget that is being embedded on different sites, and some sites disallow the use of flashvars.I'm trying to figure out all of the sites that my swf is embedded on.
View 1 RepliesWhen I drag a movieclip from the library and create an instance on stage I can select it and look in the properties to see what it's an instance of. If I create the instance dynamically using attachMovie, how can I find out what it's an instance of?
View 5 RepliesI have a shape and I want to find out what the highest y value is for an x value.Example: I have an oval, and with width 200 px. I input an x value like 78 px from the left and I want to know what the highest y value is that matches the x value (the top of the oval at point x)
View 3 RepliesI'd calling out
trace(this.parent.numChildren);
which returns me "2". Now, when I call out
trace(this.parent.getChildAt(1));
it returns me "null".
What is the problem as there are two movieclips in the parent called "sb" and "content".
I have to resolve a problem I encounter to find the equivalence between menu links and displayed pictures. (in order to highligh the good menu name) how I can find and trace which MC is on top of a defined layer. All these MC were created dynamically from an Array.
View 2 Replieshow to find the Num of Children in a particular case, as below. I am trying to figure out how many birds are there at a particular time, so that I may control their growth.
Code:
var timer: Timer = new Timer(500, 45);
timer.addEventListener(TimerEvent.TIMER, timerFunc);
timer.start();
[Code]....
where to use "parent", "this", and "root" etc. it can help me for the future as well.
I am having trouble in finding target in a drag drop scenario. I have a movie placeholder named onepic1 and i load a movie using
Code:onepic1.loadMovie(this.img1lnk);I load the img1lnk variable externally using
Code: img1lnk=onepic1.swf The SWF loads into the placeholder, NO PROBLEM in that!
And I identify a dragged object into that movie using
[Code]...
What should I use to test my swf movies on another (not my development machine) ?When I open them with IE or firefox the Flash active x player doesnt have the zoom 100% option so I end up with distorted (resized to window) swf is there a standalone flash player for that kind of purposes or something?
View 1 RepliesSo, I have a dynamic text box, which, naturally, being dynamic, changes. What I would like to figure out is how to tell when the changing text is larger than the textbox holding it. Of course, just because it is a certain number of characters long doesn't mean it will be larger than the textbox holding it. Twenty of the letter "w" is larger than twenty of the letter "i" So, is there a way to tell if the textbox isn't large enough to hold its text?
View 5 Replies