ActionScript 2.0 :: Crossing Algorithm?
Jun 4, 2011I have table
words = [aaaa, bbbb,cccc,dddd,eeee,ffff]
and i want to make table like this:
words2 = [aabb,bbaa,ccdd,ddcc,eeff,ffee]
I have table
words = [aaaa, bbbb,cccc,dddd,eeee,ffff]
and i want to make table like this:
words2 = [aabb,bbaa,ccdd,ddcc,eeff,ffee]
Given 2 point A(x,y) and B(x,y), is there a way to tell if C(x,y) is crossing the line that A,B do? I mean in between thoses to 2 points...
View 14 RepliesI want to shape tween multiple objects on the same layer. When they are placed independently from each other all the time on the canvas, I have no problem to make them morph into the other shapes in the ending keyframe.
However, when some of the objects are crossing each other in either the starting or ending keyframe, they don't morph smoothly but quite funnily. Funny phases are nested between the intended starting and ending tages.
See the images below. What should I do to prevent this?
[Code]...
I want to shape tween multiple objects in the same layer. When each objects are placed independently within within distance from each other, I have no problem to make them morph into the other shapes in the nex keyframe.However, when some of the objects are intersecting each other in either, they don't morph smoothly but quite funnily. Funny phases are interpolated between the intended starting and ending stages.See the images below. What should I do to prevent this?
View 1 RepliesI have an animated fish crossing the screen. I made that using the animated fish (movieclip1) following a path on a guide layer. All these are into another movieclip (2). I want in mouse hover condition to accelerate the tween. In other words I want the user to point the fish with the mouse (mouse hover) and then the fish tries to escape (tween acceleration). How can I accelerate the tween?Keep in mind that in fish movieclip(1) I have more than one Tweens. So the code must be for selected tween (named by frame label). Another thing is that acceleration mustn't be directly from 0 to 1. There must be an ease on the start and on the end of acceleration so it can be more realistic. I am not related on programming so I would like a complete answer (not just directions)
[Code]...
Currently, I am using the code below. But it is telling me that the circle is starting to hit the line when it's y position is 40. But since the circle actually isn't crossing the line itself (virtually) until it's y position is at about 205, I don't want the trace-action called so early.
Code:
var circle: Sprite = new Sprite();
circle.graphics.beginFill(0xFF0000);
circle.graphics.drawCircle(0, 0, 10);
circle.x = 170;
[code]....
[flash=]
package app.demo.MyTouchApp{
import flash.display.Sprite;[code]..........
how to perform a search in XML, so I use the above method, kinda hard code I know...for example, I try to search " keyIn:String = "BR1014"; " means I wanna search BR1014 in 4 XML files, so I load the XML info into an array, and using for loop to loop the XML array (in this case TitleArray1[i], TitleArray2[i]...) and compare it with keyIn (which store the value BR1014), some how the value is located in TitleArray4[i] which have the length of 12 (trace(TitleArray4[i].length) = 12)
so everytime I run it, I will overwrite abc 12 times... and out put 12 time the abc value, in this case BR1014 was located in TitleArray4[3], so the 4th output of "abc" is BR1014 but others is all 999...
I have a database which has 2 tables:
CREATE TABLE RecipeDB (
RecipeID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR,[code]........
I also have an actionscript, in which I have ingArr:Array of ingredient strings.Now, I would like to realize the following queries here:
1) Select (all fields) one recipe which has the most of ingredients from the array. If more than one record have the same amount of matches, then divide the number of matches by total number of ingredients in recipe and return the one with the highest ratio. If there are no matches return nothing.
2) As above, but return 10 recipes with the most matches and do not perform check for equal number of matches. Sort the results by the number of matches.
I want to stimulate sea wave,but I have no idea about it. Is there an example code for it? I know as3 can make many good graphics and text effect, so I want to learn it eagerly,but I don't know which book should I read. Anyone could introduce a good book for me about as3 algorithm? More example code are better in the book.
View 3 RepliesI am developing my application in flex and JSP, so when I am passing values through HTTP Service Post method with request object but these values are tracing and modifying by testing team so I am planning to encrypt values in flex and decrypt it in jsp.so is there any algorithms like SHA or MD5 more secure algorithms,
[Code]...
I have been trying to implement the Round Up Power Of 2 algorithm outlined in the following link in AS3.
[Code]...
The algorithm works great for most of the values I've tested. It is mentioned that this will return 0 when given an input value of 0 which is technically incorrect but I'm ok with that output. What I'm not ok with is when given an input of 1 I get and output of 1. I'm thinking that this must be a caveat of AS3 and its wonky uint implementation but I can't seem to figure it out. I have also tried using the >>> logical shift operator to the same result. My C is a little rusty, but I'm not sure how this would even return 2 in C. Can someone explain to me whats going wrong here? I assume if an input of 1 was a special case it would have been mentioned in the above link.
Is there any algorithm to perform erase operation in a bitmap? I would like to create functionality similar to how photoshop or other graphic application performs erase. Is erase operation so difficult that there isn't much help (for bitmaps) available? I am OK even with name of an algorithm, I can proceed from there.
View 2 RepliesI've searched and racked to no avail.. so, does anyone have an algorithm to create a concertina type rectangle, ideally horizontally. The desired effect is exactly like that of normal horizontal Window Blinds (assume they're closed- doesn't matter) of say 30 parts (or slats) of equal height and uniform width.
When such a blind is raised half-way up notice how the parts at the bottom go from dead flat to an increasing value in height, with perhaps the top-most part hanging normally.
Similarly, when the whole Blind is all the way up, all parts are flat. Conversely, when the whole Blind is fully extended, all parts hang at their own, uniform height. It's this "slightly differing but related to my neighbors height" I'm stuck on.
how to implement this algorithm: I have number (1-100), however, it will return to 0, when it meets 10, likewise 11 returns to 1, 12 to 2...
90 -> 0
91 -> 1
...
I have 5 Button movieclips, each with different states, (OVER, OUT, and ACTIVATED)Obviously when you rollover the button, itll play the over animation, itll also apply for the rollout event of the button. When you click the button, itll go to the activated state.Here's my question...What condition will i use so that when a certain button is activated and i click on a different button, the activated button will play its rollout state before going to its idle state.. What's happening to me is itll just quickly go to its idle state without playing his roll out animation.
View 8 RepliesI am programing with AS2 so here goes my question: I want to create an algorithm that looks up an array and finds the nearest integer in it. Lets say i have different numbers like 1, 2, 4, 5, 8, 9 and i want to find the nearest member to 6 from those numbers. How should i build the algorithm. So far i'm using two arrays and two inside loops, but cant find the right way to make it.
View 3 Repliesmy program calculates ax,ay -> using this variables -> vx,vy -> after that I calculate the little step that my mc will make, in other words I calc x,y position [code]as you can see all depend on each other...but the problem is that after getting new x,y I want this x,y to be used to calculate next step!fo every new coordinate I want new vx,vy ax ay!
View 8 RepliesI met a problem while I am learning the flash actionscript 2.The question is how to implement this algorithm: I have number (1-100), however, it will return to 0, when it meets 10, likewise 11 returns to 1, 12 to 2...
90 -> 0
91 -> 1
...
I want to put shortest int in shortest:
shortest = 500;
for(i = 1; i <= _global.var_process_count; i++) {
if(_root["process" + i].process_time_original.text < shortest)
shortest = _root["process" + i].process_time_original.text ;
}
What's wrong with above lines of code?
I am building an application in Flex, wherein I need to encrypt user id and password using the SHA1 alogorithm. I have not come across any standard Flex library which allows me to do this. Does anyone know how to achieve this in Flex?
View 1 RepliesI'm currently working on side scroller that has an isometric-type perspective (think Double Dragon) and the only thing I could think of to use to manage the depths of the MCs was a bubbleSorting algorithm.
[Code]...
Now this works fine (because I don't have a huge amount of MCs to sort), so I guess this is more of an academic question. As far as I know, bubblesorting is pretty much one of the worst sorting algorithms out there. Has anyone successfully adapted a better one for this purpose? Not trying to get you to post your code as much as just an idea for me to play around with because I'm a geek like that.
I know there isn't a built-in linked list in AS3, but one can easily write his own. However, I found it difficult to come up with a good solution for sorting such list.If you didn't know, linked list is a chain of "cell" objects, where each object has a reference to the next object, typically you can write it like this:
Cell1.next = Cell2;
Cell2.next = Cell3;
CellN.next = null;
(Circular linked list and bidi linked lists are out of the scope of my problem, for now at least).
I looked into other languages that do have linked lists or even standard libraries for them, however, I don't seem to be able to either port any of their solutions, or, some of them, if ported to AS3 would not be workable (since they use recursion) or would otherwise have huge overhead because of lots of method calls etc.
I think, I'm focused on 2 possible algorithms: Merge sort and Insertion sort. These two seem to be most applicable to AS3. However, I may be wrong - so, please fill free to correct me.
I have finished a little game called "math match". The idea of the game comes from "math mountain", a game is for the player who must caculate some kind of mathmatic questions, if the answer is correct, the player will move along a predefined path in several steps. I am newbie for programming games, so I am not sure what I have done in moving the role is the correct one, although it works okay. I know in Flash CS3, I can use motion guid layer to make the role move along a predefined path, but it seems it's not good in the game, or I don't know how to control it in actionscript 3.0. So I used many 'marks'(little movieclip) along the path. That divide a path into small pieces of lines, so I can move the role along the lines. If the 'marks' is enough, the precise is enough, the movement works okay.
But I think it's quite not a good method. I don't know if there is any good algorithm to move the movieclip along a predefined path, and this path is random, is hardly to be described by any math equation. I think in Flash CS3, we can draw a path by author tools, indeed Flash CS3 use some algorithm to do that. If we can get that math equation, we can simulate the movement very precisily, but is it possible? I don't know.
I'm looking for a Mod-10 (modulo 10) validation algorithm writen in actionscript. From a text-field, the user will enter a code and on submit, actionscript will validate if the number is right.
View 3 RepliesAny algorithm to see how many different variations there are within a set of data... For example, if I had:
1 1 1 1 2 3 3 2 1 1 4
The algorithm could figure that there are 4 different "types". I don't mean 4 numbers, because there are obviously more, but 4 varieties; of course, how to go about count how many of the different types.
I'm looking for an algorithm that will break down a number into n chunks, so that the sum of the chunks will equal the original number. Example - take 30,000 and break it into 100 random numbers - but the sum of those numbers needs to be 30,000.Seems there must be some algorithm to do this, just not sure what it is called.
View 6 RepliesI'm builiding some sort of data portfolio in a section of a website. The method i'm using is the next one:
- Load an XML with all the data
- Call a function to build the portfolio.
- Use a "for" within said function to place all of the images at their respective positions
So, what I'm trying to achieve is to place the all of the nodes at the same time on and off screen following the next pattern:
[Code]...
[Code]...
Is there a way to do this with RegExp maybe? I know that I could just add each variation of each pattern to the array, and just search it, but I want to do it more intelligently.
This is unfortunately a quite complex issue to explain, so please don't get discouraged by the wall of text - it's there for a reason. i'm working on a transformation manager for flash, written with Actionscript 3. Users can place objects on the screen, for example a rectangle.
This rectangle can then be selected and transformed: move, scale or rotate. Because flash by default rotates around the top left point of the object, and I want it to rotate around the center, I created a wrapper setup for each display object (eg. a rectangle).
[Code]...
Now, to the question: should I use a different kind of setup, system or structure? Should I maybe use matrixes, if so, how would you keep a static width/height after rotation? Or how do I fix my current wrapper system for scaling after rotation?
Based on user input height, weight, measurements and other data, dynamically generate a person (can produce 3D graphics)?
View 1 Replies