ActionScript 2.0 :: Minesweeper - Finding The Non-numbered Squares?
Jul 17, 2009
in Minesweeper, if you click on a square that has no mines surrounding it, the game will continually find all of those types of squares and the surrounding numbered squares.
I've had some trouble with this, because I either run into infinite recurrence or...well just a bunch of stuff.I've had a lot of different ideas and ways to do this...but I'm thinking:
1. If the square your clicked on is empty (no surrounding mines) put it into an array.
2. Loop: if the array isn't empty, reveal all surrounding squares, put all unnumbered squares into the array, remove squares previously used.
Code:
function getAmountOfMines(square:Object):Void {
var numMines:Number = 0;
nSquare = _root.gameBoard["Square" + (square.getDepth() - gameWidth)];
in as2 i could write the following to check for existing variables in a LoadVars() object called loadvarsobject in this example:
[code]...
with this simple process i could create whole stuctures based on the existing variables from a php file. how do i do this in as3 using the URLLoader class? im not asking how to get data from php to flash using URLLoade, my question is just about how go through and access numbered variables from php.
I am creating an app where users input their investment info into a datagrid on each row one row at a time. As they move along new rows are dynamically generated so they can input new investments. As the user moves and puts in new info I want a column to display what row the user is on (or better said what number investment he is on). how to create the function:
private function rowCount():void { myDG.dataProvider=tasks;
My problem is I need to generate numbered circles ( from 1 to 100) and I need to make them click able. When I click the circles in order (i.e. 1, 2 , 3...etc) the clicked circle should change color or get disabled (to indicate it is clicked). I should not be able to click the next numbered circle until I press the previous numbered circle and there should be a counter to show how many correct circles are clicked.
I am having problems passing even numbered variables! I have downloaded the improved version of page flip from [URL] (its a digimag). And I want to add a function so that the user can type into a input text box which page they want to go to and it will take them there. So, I have a Input text box with the variable 'page' assigned to it.
Then, I have a button containing the following code: on (press) { Pages.flipTo(page); }
This is working, only on odd numbers, but if I want to go to an even number, it adds a 0 on the end. So, if I type in 4 it takes me to 40! Why is it adding a zero? Incidentally, if I replace 'page' in the button on my code with an even number, it works! So something is happening in the passing of the variable!
I'm working on a slide show that auto plays but I want the user to be able to click the numbered buttons to go to that slide. See below link for the slide show.[URL] I know this is simple but I've tried on release gotoandplay and I tried some event handler code but don't know AS3 at all.
So what I'm trying to do, is allow users to create a bike type game. There are four different parts to it that they can choose (frame, material, tires, and handelbars), each that change one of the four different statistics (weight, durability, speed, and maneuverability) and I'd like it to update these global statistic variables each time a part is changed so that the statistic bars can update.I want to have the bike frame, when selected, to set a base for all 4 variables, and then each other part will add to it. This is what I did so far. . .
on the framescript I just have: _global.durability = (_global.framedur + _global.materialdur); _global.weight = (_global.frameweight + _global.materialweight);
I'm attempting with no success to use a for loop to generate numbered instance names so that I may attach an event listener to multiple movie clips at once.Ex: I have 10 movie clips with instance name button_1 to button_10 and I'd like to be able to do something like this:
Code: Select allvar btnName:String = "button_"; for (i = 1; i < 11; i ++) { [ btnName + i ].addEventListener(etc, etc); }
but basically i have 100 buttons being generated and assigned names ( eh_1, eh_2, eh_3, ... ). On press they are controlling several functions but i would also like them to load a corresponding jpg into a blank movie clip. the jpgs are labeled... (1.jpg, 2.jpg ....)
Code: var currentButton:Number = new Number(); for (var i:Number = 1; i<101; i++) { _root["eh_"+i].id = i;
Im having a problem where I have a set of numbered functions and I need to call them from the dynamically created buttons but I need to make sure the numbered functions are relative to each button..so button 1 will call function 1.
I have created an image gallery that loads from an XML file using mostly previous Kirupa threads. From Scotty's code (I think -- my head is moosh now) I got numbered buttons for navigating between the images.Each button is a movie clip with different labeled frames for "up", "active", "hover", and "down" states. I'd like to have the numbered button change color when its image is on view and then change back when a different image loads, and I can't figure out how to do that. I know part of the problem is that the onRollOut function overrides other changes, so I'm willing to give up the rollover effect if necessary.[code]
How can I turn on error reporting that tells me exactly on what line of my .asc file an error or warning has occurred? I need this in order to debug why my fmscore is constantly segfaulting, presumably caused by my .asc file. I know the .asc is causing the crash because when I removed a section of it, the crash suddenly stopped - but I can't figure out why it would crash at all, and it does so at unpredictable intervals, sometimes every few hours, sometimes every single time, ..
I'm trying to do a transition that you've probably seen many times. Transitioning one image to another using a grid of squares where each square fades at a slightly different time.I've made a complex movie clip made up of several other movie clips with all the squares fading at the rate I'm looking at. When I just play the color squares it works fine, but the minute I turn that master movie clip into a mask for the image I loose the transition/fade completely--just an on off thing.
I have a problem with arranging some thumbs in column when I resize the stage. The problem is that it is arranging the last square in line half outside the stage and you can see only a half.
How do you go about drawing only the outline of squares using drawTriangle. Currently I am using lineStyle to draw my lines but obviously that outlines each triangle. I know i can just draw Squares out using drawRect with no fill but that seems like a waste.
Now I could do with some hints as to how this should be done Hopefully someone will help me out here.
Ok, basically I have a map (a jpg/gif file), which should be divided into squares (like a chessboard). Each square has a coordinate (X, Y) and other pictures should be shown on top of a map square - like a small house or something (also a jpg/gif file).
It should also be possible to hide some (most) of the squares from view - like with a black square on top or whatever. Perhaps Flash should also make some lines between each square to divide them.
Furthermore only a part of the map should be shown through a window (using a mask, I guess) as the map could be large and buttons at the edge could be used to scroll the map.
I would like to link the red squares to the blue square in 3D with CS4 only (please no papervision or sandy...)I'm very closed to the solution but I still have a wrong z (visible when you move the mouse to a corner for instance)
I learned about the date class yasterday and made a lil app that will tell me when the next recess at school will be. It worked great when I ran it at home, but now when I try to run it at school all the letters in the textfields displays as squares, the numbers still work tho. The only difference I can think of is that at home i use CS5 and at school is use CS4, the font is embedded in the fla.
So far my code takes hex codes out of tweets containing a certain hashtag, and draws a square of that hex code colour. If someone were to tweet a new set of hexcodes while you were looking at the site, you would have to manually refresh the page to see the new squares.
I'm doing a tutorial from Adobe Flash CS4 classroom in a book. They're suggesting the following: "create buttons that allow users to switch between painting ellipses and painting squares". I've created the class files for the cirlcle and the square and I've set two hot keys to switch between painting circles and rectangles(it does not work) Now I'm trying to create the buttons.
package { import flash.display.MovieClip; public class Rect extends MovieClip { public function Rect(w:Number = 40,h:Number = 40, color:Number = 0xff0000) { graphics.beginFill(color); [Code] .....
If an image is 800 by 600, copy the image's bitmap data and divide the image into, say, 20 by 20 squares, each having a reference to be manipulated later. Im guessing you have to use bitmapdata for that, unfortunately I dont know how to copy bitmapdata from an image's arbitrary x and y coordinates and for a certain width/height.
I'm trying to fill a grid with different size squares, randomly, and have no overlap. I want my grid to be 100px by 100px. I've tried creating a matrix array (10x10), holding x and y values. My square size is either 10x10, or 20x20. I loop through the matrix randomly picking a square (x,y position) and placing one of the two squares. All of this works fine, but obviously the squares start to overlap.
This is the type of outcome I'm looking for: I tried adding each square to an array, then checking if the current square placed collides (hitTestObject) with an already placed square. This eventually hits true every time, because the square placed matches the same square when placed in the array. Does anyone know of a way to accomplish this? Place each square but do not have overlap?
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 am wondering what that effect is called or how to achieve it where let's say I have 6 squares, 3 on top, 3 on the bottom(2x3 matrix) and where if I click one, it gets bigger, and all the other ones get smaller. The problem here is the how they get bigger. If I click the middle square in the top row, it should stay in it's position and grow where as If If I click the bottom right one, it should grow towards the far left side. I'm guessing the registration point needs to be changed dynamically?