ActionScript 3.0 :: Extending Array Into 2D Matrix
Dec 26, 2009I'm trying to do just that. This is my class:[code]IIt seems the problem pops up every once in a while and never gets solved.
View 14 RepliesI'm trying to do just that. This is my class:[code]IIt seems the problem pops up every once in a while and never gets solved.
View 14 RepliesI'm trying to make game like bubble spinner....I created a grid 2d array for this game... But got stuck at insertion of a new row/ column to the current matrix position.How to insert a row/ column to a matrix after its already created ie, if i have 2d array of size 4x4
[1] [2] [3] [4]
[5] [6] [7] [8]
[9] [1] [2] [3]
[4] [5] [6] [7]...
then i have to add a row like 0,0,0,0 to the 3 rd row and need the shift of 3rd row to 4th and 4th row to 5th.
ie,
[1] [2] [3] [4]
[5] [6] [7] [8]
[0] [0] [0] [0]
[9] [1] [2] [3]
[4] [5] [6] [7]
i have a STRANGE problem with 2d arrays in flash. Trying to create matrix of squares, i used this code:
[Code]...
So as you can see, first 2 iterations of "higher" cycle mc creation are nicely stored, while the rest is not so lucky.
Has anyone here ever developed a function (or general library of relevant functions) that will allow one to find the inverse of a matrix? I've searched the forum archives, as well as the internet more generally, but haven't found anything. If anyone has some leads, I hope you'll pass them along.
If I don't hear anything within the next few days, I might try to develop something on my own, but I'd hate to do so if someone has already done the dirty work.
A solution to this problem would be very useful for 3-D work or anyone doing mathematical programming more generally.
I'd really like to be able to make Flash's array access syntax 'wrap' over the array's bounds.
Lengthy explanation -
var array:Array = ['a','b','c','d','e','f'];
To keep things simple, the first index is 0, and its value is the first letter, 'a'. To get that value, we'd do this -
array[0]; // returns 'a'
As long as the index you're using to access the array is between 0 and array.length (6 in our example,) everything works fine - but if you use an index outside of those bounds, you're shut down.
array[-3];
array[9]; // both return 'undefined'
Sometimes that's a good thing - sometimes you expect that to happen, and you're fine with it. Other times, you find yourself wishing (or at least I find myself wishing) that it'd behave a bit more like this -
array[-3];
array[9]; // both return 'd'
(e.g. a photo gallery that jumps back to the beginning when you click 'next' on the last photo)There's a little chunk of code I use over and over for this sort of thing, but it's always to alter the index before passing it into the array:
var index = -3;
while(index < 0){index += array.length}
array[index % array.length]; // returns 'd'
... and that's fine, but what I really want to do is extend the Array object itself so that it'll automatically 'wrap' index values that go out of bounds.TL;DR - Is index-wrapping possible by extending Flash AS3's Array object?
I know a matrix [x scale, y skew, x skew, y scale, trans x, trans y], and would like to get the angle in degrees.
View 2 RepliesI followed the tutorial for the Matrix Bitstream Effect here - [URL] utorials/Sp...ndex.shtml - like a slave, downloaded her code and compared, and I still can't see why my matrix will not become random. I put a bunch of copies of the movie clip of the "random" 0s and 1s on Scene 1, and they all slavishly turn to 1s and 0s at the same time, no randomness. Can anyone tell me what I'm doing wrong?
View 10 Repliesi want to know how to do the matrix effect, and hten have some letters be highlighted to show my site logo.
View 1 RepliesHow do you create a matrix in flash?would it just be - var matrix(5,3,0);5x3 matrix filled with 0's?
View 5 RepliesI have done a matrix effect, but i have a problem. It is in front of the my logo.
How do i put it as a background, so it will be behind the logo?
Here is the script that i have used:
minLines = 35;
maxLines = 35;
minScale = 10;
[Code].....
I'm really new to flash, with my background mainly in C++ and Java. But what I'm wanting to do is create a 5x5 button matrix to make a game.I've tried using the visual style of drawing the button and what not, but I really don't like it. I'd like to have like an array of button of object where I can track things like click count for each object. Is this possible with action script?
View 41 RepliesAfter reading over the Flash 10 file spec I want to play a bit with transformational matricies.If you have multiple MATRIX records in an SWF do the transforms compound each other?Or is the matrix a complete replacement of the previous matrix?Does flash operate similar to Postscript with gsave grestore like operators which allow the transformational matrics to be saved & restored?
View 1 RepliesI'm trying to use the MatrixTransform class to RotateAroundInternalPoint but it requires that the object I'm trying to rotate has matrix points defined. My question is, is there a way to add Matrix points to a non Shape object so I can rotate it, or is there another class that is used to rotate movie clips around internal points?
View 6 RepliesMost often, questions are asked about how to scale a DisplayObject, and the answer is usually to use a Matrix.
My question is, how to you GET the scale of a Matrix (scaleX and scaleY)?
There's a Matrix.scale method to set the scaleX and scaleY, but it doesn't return a value, and no other properties exist to read it back.
The reason I ask, I'm using object burried deep down into a Display list, and each may be transformed. So I use the child object's sprite.transform.concatenatedMatrix getter, but am stuck at this point on how to read the scale from it.
I was wondering how you can use the matrix to increase the component of the canvas!
View 1 RepliesI have to use Flash CS3, so I can't use the properties rotationX, roationY and rotationZ.I have a movieclip, that looks like this. It is now flat, no 3D rotation or shearing But what I want is that this movieclip has a rotationX, or that it is a bit in perspective like this: As I said, I can't use rotationX, so I have been playing around with Matrix. But I can not get it right.Here is how I try to do it
myMC.transform.matrix = new
Matrix(1,0.15,0.35, 1, 0, 0);
And this is the result get the matrix right, or is there another way?
In the 4 * 5 array that makes up a colour matrix, what do ALL the values do? All I have found is basically this:
0, 0, 0, 0, 0 <-R
0, 0, 0, 0, 0 <-G
0, 0, 0, 0, 0 <-B
0, 0, 0, 0, 0 <-A
What does each thing do?
Unfortunately geometry is not my strong point and I am on a deadline. I am trying to determine if a textfield is larger than a displayObject and that it does not sit outside the x and y of said object. If it is larger, I need to scale it and make sure it is always in the confines of the displayObject space. On a side note, i need to scale the size of the text accordingly.
View 0 RepliesI am trying to copy an image.The green stuff on the first image is a mask(which is not set, its just there to show it)Everything works fine when I dont set a mask to an image (picture 1)But when I set the mask I get picture 2.What I want is to copy a part of the image which is visible when the mask is set. I know what size the mask and image are going to be so I can calculate the size of the area which i need to copy.This is the code I am using, image has registration point in the center, thats why i use matrix.translate (not sure if its the right way).Also there is no image scaling applied (there might be later), thats why I am using matrix.scale.
Code:
var _reflectionHolder:Sprite = new Sprite();
addChild(_reflectionHolder);
_reflectionHolder.y =_targetObject.y + _targetObject.height / 2 + 10;[code]......
I ran into an issue with an app that I have been working on.The application lets a user draw a rectangle, which base class is UIComponent, on an SVG Canvas. The user can rotate, skew, scale,flip horizontal and flip vertical the rectangle. Then they can drop an image into the rectangle.We just cloned the rectangles matrix and applied it to the image and the image would transform the same as the rectangle. Well now we have changed the way the app works.
Now we don't want the image rotated or flipped on the initial drop, and this is where I'm having trouble.I was wondering if there is a way to always find the true top left of any rectangle no matter what kind of matrix is placed on it. I can find the center of the rectangle but when a user flips the rectangle the center point is outside the rectangle.Instead of finding the center I would like to find the topLeft.I have tried several things. Like transform.pixelBounds, but this gives me big numbers like 2200 instead of 400. I have also looked at senocular.com but not sure that I understand it.I just need a dynamic way to always find the top left.
I have some problems with doing Matrix transformations on a MovieClip with a Textfield. As soon as I make a matrix transformation the textfield of the movieclip disappears. And I can not get it back.
View 1 RepliesDon't laugh... [URL] Should I use the Matrix to tween from figure 1 to 2 via ActionScript?
View 3 RepliesI'm building a website and I have a constant moving background that is red. Sometimes I need to change the color of the background. Now I Don't want to load new movies! Instead I would like to use the adjust color filter to change the color of the background. Now through research I have found out that you have to use the color matrix. Here is the code
import flash.filters.ColorMatrixFilter;
var myMatrix:Array = [1,0,0,0,0, // Red
0,1,0,0,0, // Green[code]....
My question is how can Apply this so I can fade it in? I assume I use an onEnterFrame to add it but how do I alpha it? It's kind of like this tut but not for a button.
Using a matrix I'm tyring to turn a square into an isometric tile by skewing it upwards (y -30) and skewing it to the right (x + 60). This does giv the desired angles but the sides of the square are stretched and become incongruent. Is there some way to lock the sides from stretching when skewed with a matrix? Pictures speak loouder than words, the shape on the right is what I get and below it shows what I want: [URL]
View 9 RepliesI have a website which I created for my classmates, there they can log in to see their notes (some sort of electronic diary).There is obviously login script php based.However I wanted to implement something cool like Matrix like login page ^^It should work like that:Black screen shows up, some green elements start to appear over the screen, some sonar, radar, neuron activity and in the middle of it login box.Thos moving objects aren't a problem however this box would be.I wanted there to have blinking green square (like in DOS) and after someone put a letter, the box should move one place to right and still blinking same with password filed.
View 1 RepliesI have the starting point of a rectangle, and the rotation of the line that I would like this rectangle to be parallel to. My initial thought was to create a Rectangle() then rotate it, but there doesn't seem to be an easy method rotate a rectangle. From this rectangle I create I can obviously get the four points, but I need these to be adjusted based on an angle of rotation that I pass it.
View 1 RepliesI need a matrix that has 4 rows and 7 columns with a movie clip that automatically reproduces every second. Ive looked all over the forums but theres nothing related to movie clips in it. [code]...
View 4 RepliesI'm trying to get a looping matrix and then randomly stop. I am still pretty new to coding in flash. I still have not tried to put the random stop in but here is what I have so fare and it is not working.
var matrix_array:Array = Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "y", "z", "?", "<", ">", "!", "`", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "+", "|", "/", "=", "_", ",", "[", "]", "{", "}", ":", ";");
function() {
[code]....
i want to assign a transform matrix to an object, but i want to assign the values myself (as in, no 'rotate, scale etc'), but for example, set a matrix like
[Code]...
which if applied, would have no effect, but would be valid (actually not exactly that matrix, but you get the idea). i want to set the values of the matrix and the object should be affected by those values that i set by myself, no scale rotate or any predefined operations. how can i set my own matrix?
I have problem when dealing with transform in Flash cs4 ....When I rotate my movieclip and trace the output, my movieclip's width also changed....
View 4 Replies