ActionScript 2.0 :: Creating A Matrix Of Squares With A For Loop?
Mar 14, 2008
I want to create a bunch of squares appear in a grid-like fashion but not row by row. I'd like more of a diagonal effect.
Here's the code I have so far:
[code]...
So this sort of works in the sense of it creates a vertical row and a horizontal row. But I need it to actually kind of 'wipe' diagonally across the page.
I put together this code that builds a container that contains boxes(squares) in an ordered way. Problem is when I rotate the container, the boxes don't stay in their order. (something to do with swapping depths I think) . In fact, they look a bit confusing. Just create a movieClip 24 x 24 and Name it Box. Create another movieClip and name this one Container. Save them in your library. Then just copy this code and compile. You know the routine.
I strolled across something neat on a radio website [URL] and I really like how they do the flash on the top left. Below is the link to the actual SWF for bigger so that you can see what the SWF looks like. on the link above, you can move your mouse over the squares and it pops up a little window. You can even click on that. Here is the link to the SWF. [URL]
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?
I am working on a project where I need an interactive matrix of 500x500 clickable elements. I thought this would be an easy task in actionscript3 but boy was I wrong. I was able to create a matrix where each element was a Sprite object with attached Mouse click event. But here the performance problems begin. FlashPlayer10 can handle up to 100x100 matrix, but when I increase my matrix I start getting script timeout in browser player... Here is how my "unfinished" matrix looks like.So how should I approach this problem? I was hoping flash will be able to handle so many elements, but I guess I was wrong. I want to have a pan control to pan around for objects off screen and of course zoom in/out control.It's true I'm not very professional in Flahs and actionscript but a friend who is told me this would be no problem implementing in AS3? I need this in flash as the thing needs to be hosted on website.
I am working on a project where I need an interactive matrix of 500x500 clickable lements. I thought this would be an easy task in actionscript3 but boy was I wrong. was able to create a matrix where each element was a Sprite object with attached Mouse click event. But here the performance problems begin. FlashPlayer10 can handle up to 100x100 matrix, but when I increase my matrix I start getting script timeout in browser player... Here is how my "unfinished" matrix looks like.
So how should I approach this problem? I was hoping flash will be able to handle so many elements, but I guess I was wrong. I want to have a pan control to pan around for objects off screen and of course zoom in/out control.It's true I'm not very professional in Flahs and actionscript but a friend who is told me this would be no problem implementing in AS3? I need this in flash as the thing needs to be hosted on website (unless there is a better tool for doing something like this...).
I have a 20x20 matrix set up in Excel that I'd like to recreate in Flash. Essentially the values are either 0 or a calculated formula of -Fo or 1+2(Fo).
My question is with a matrix of this size, is there an efficient way to create and populate it besides hard coding the address for each data cell? Can I make this using a loop?
I've attached a snippet of what the Excel sheet looks like. Notice the data trend.
i have a simple matrix form that consist of 3*3 textfields. my problem is how to get the values that the user will enter into it by a loop, i mean not using a long way such:
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 am trying to create functions using a for loop for my buttons' over and out listeners.I would like to stick to a naming convention but it does not seem to work. I am trying to create 10 buttons with function names like btnOver1, btnOver2, etc...
Code: for(var i:int=0;i<=9;i++){ function btnOver[i](e:MouseEvent):void{
I'm trying to create a for loop to set the color objects outlineColor1...100 to the value defined in variable _root.outlineCol. Everything works fine when I set the color to these objects via 100 lines of code but I'd like to replace them with a for loop of course. I suspect the syntax in the first part of the second line is incorrect but I'm not sure.
for (var i:Number = 1; i <= 100; i++) { outlineColor[i].setRGB(_root.outlineCol); trace(i); }
Everything works fine except MouseEvent.CLICK addEventListener.menuInfo variable contains part of defined instace name.cURL contains full URL to link.If I trace menuInfo variable, it outputs correctly in order as I exptected.But last event overwrites everything to last element of xList (contains XML list).How do I make this work correctly
Code: function createMenuEventListener(xList:XMLList):void {
My master timeline is 128 frames long, I want the timeline to play from frames 1 to 128 once and then from frames 64 to 128 three or four times before returning back to frame 1 and starting the whole sequence again so I end up with a continuous loop that consists of the full animation once and the second half 3-4 times all repeating endlessly. I've been reading about "for" loops and guess this is what I need to use but I don't quite get how to set it up, how I'd set up a counter to count the repeats, and how it would reset etc.
I'm trying to create a vertical column of images in a mc that can be clicked. I've added listeners to reposition them once they load, but right now they are overwriting each other. I'm not sure how to rename the object and listener vars for each iteration. [code]...
This piece of code gives me an error because i have an equation on the left side of the equal sign, logically it makes sense, but flash doesn't like the code how would i do some thing like this?[code]
I have a for loop that runs depending on the length of an XML file. What I want to do is create a unique text field for each run through of the loop, and give it it's own position on the stage, and finally assign it the text from an external text file that is specified in the XML file. Everything I know how to do except creating the textfields.
Quote:
for(var i:int = 0; i < blogXMLList.length(); i++) { var txtHolder:TextField = new TextField(); txtHolder.x = textX;
[Code].....
This code creates only one Text Field, but then replaces it's text with new text with each run through.
I am new to Action Scripting 3 and am struggling to create movieclips in a for loop. Basically I am trying to create a series for movieclips and add these to my stage based on an array of values.
Im trying to create a simple loop that creates 50 buttons, adds them to screen and then when a button is pressed, it traces out that number. I can get it to work by doing stuff I consider hacky (such as using the buttons X/Y location to determine its value), but I'd rather just be able to hold a single value in the function.
The code itself is: for (var a:int = 0; a < 5; a++) { for (var b:int = 0; b < 10; b++) {
basically i want to create ten balls on the stage. I have a balls.as file which uses the drawing api to create a circle within it. also within the balls.as file there is a public variable.[code]how would i go about finding out: if you click one of the balls it traces that balls life.
I've created a basic function that sets a movieclip to a certain state depending on which mouse cursor is set (determined by a variable called txt_cursor). I can hard code this to work great for the one single movie clip but potentially have to do this for 624 other movie clips so obviously want to create a for loop to reproduce this.
I'm trying to create multiple objects in Papervision using Flash Builder, each one with it's own texture that I'm getting from an imported SWC.My code works perfectly if I apply one texture to all shapes, but when I try to put it into a loop I can't seem to get it to work. I think this is more of a syntax problem, I'm just not sure how to tell Flex what I want.Here's a chunk of the code that works fine, applying an "img1" texture to everything: [code]Does that make sense? I want each iteration of the loop to add a number to the end of "img" and apply that to the shape.
I'm building a web flash 8 app with an animated nurse that talks and help the user in different events. the voices sit in a external folder and i load them using load sound method. It works fine as a desktop app, but when testing the movie on slow download (DSL 32 KB/s) I realized that i must load all the sound before i can play the animation.
problem nr.1: How do i create folowing sound objects (voice_0, voice_1, voice_2..) using a loop?
I've tried this, but it doesn't work
for (i=0;i<numVoices;i++) { var this["voice_"+i]:Sound=new Sound; }
After loading the movieclips and text boxes dynamically I now need to get the movieclips to perform a unique function when they are pressed, for testing purposes I am using the getURL funciton and linking to the boxNo. This is just so I can see what is going on!At the moment they are all linking to the boxNo that is pulled from the last run of the loop.
for (var i = 0; i < loc.length; i++) { var boxNo = loc[i].location_ID;;