ActionScript 2.0 :: Grid With Different Size Tiles?

Mar 12, 2011

following a recent question below is the code for a grid with different size tiles

Code:
var mcWidth:Number = 50;
var mcHeight:Number = 50;
var spacing:Number = 5;
var numberOfRows:Number = 3;

[code]....

View 0 Replies


Similar Posts:


ActionScript 3.0 :: Random Grid With Different Sized Tiles?

Jul 23, 2009

need to fill a grid with tiles that will be of different sizes,but all multiples of the stage size - something like this:I want to randomize number of tiles placed into the grid without having any tile overlap. It will then place a tile at a random position on the grid, but not in any grid cells that have already been covered by a tile. And...also I want the grid/tiles to be dynamic enough to scale if the stage is resized.

View 14 Replies

ActionScript 3.0 :: Fill Grid With Different Size Squares?

Mar 8, 2012

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?

View 3 Replies

Actionscript 3 :: Modulus / Grid Layout With Items Of Changing Size

Mar 3, 2011

I'm trying to figure an elegant way to display a certain number of items in a grid. I have a feeling the answer lies partly with modulus, but it's a little more complicated than that. I know how to lay out items in a grid based on a set number of columns. Something like this:[code]but what I want to do is set things up such that if there is only one item (j=0), the image covers the entire available area (stage.Width and stage.Height or, for simplicity, 1000px, and 500px). If there are 2 items, there should be 2 columns, with the images taking up half the width of the stage and all of the height (500x500), 3 items - 3 columns (300x500), 4 items - 2 columns & 2 rows (500x250), and so on, keeping a balanced grid layout but decreasing the dimensions of the items and increasing the number of rows in some sort of logical and balanced manner.

View 1 Replies

ActionScript 3.0 :: Populate A Fixed Size Grid With X Number Of Cells?

Jan 2, 2010

I have a 850 by 480 px grid. For every keystroke i am looping through an array to check if input textfield is matching object keyword, and then create cells that cover the whole grid.

But i am not sure how to populate the grid. The range is between 0 and 300, and the user input decides how many cells i have to create.

If the result is 4, i should create a two by two table. If it's 64, i should have a eight by eight table.

View 0 Replies

Flash :: Flex Data Grid: Check Whether Item Renderer Displays Last Row In Grid

Feb 3, 2012

I'm currently working with the OLAPDataGrid component and got stuck at a relatively simple task: I want to style the last row of the grid differently from the rest, so my cell item renderer needs to know whether he's rendering the last row with content in the overall grid, including those rows currently not rendered because they are outside the visible grid space. AdvancedGridListData's rowIndex property only gets me the row index of the renderer relative to the range of visible grid rows, i.e. when I scroll down the grid, a data item with an index greater than 0 gets the rpw index = 0.

View 2 Replies

ActionScript 2.0 :: Create A Simple Multiplication Grid Where Children Will Fill The Grid?

Oct 9, 2009

I need to create a simple multiplication grid where children will fill the grid. Its an empty grid at the begining, when they start the time start as well.Its a grid of 10 x 10. when they enter the last number, the grid should show what they did wrong and the time they spend. It's an idea of how it could work but if anyone has something that looks like this.

View 6 Replies

ActionScript 2.0 :: Make A Square Grid Of Fixed Side Length But Varying Grid Number Using Code?

Jul 5, 2011

I want to make a square grid of fixed side length but varying grid number using code.That is, the number of grids should be specified by the user (say 3*3) and after pressing a button, the stage should be broken into 3*3 grids.I don't want any code, just a method on how to do it. I have tried it by using simple loops but the method just fails for no reason I can figure.

View 5 Replies

Flex :: Applying PaddingRight To Grid Column Not To Grid Header?

Mar 31, 2010

Whenever I add paddingRight to a column in the flex grid, it adds the padding to the header as well.Is anyone familiar with how I can add paddingRight just to the column and not to the header? Below is the column code where I was specifying the padding.

<mx:DataGridColumn width="60" headerText="Type" dataField="Grade" headerStyleName="headerLeft" textAlign="left" draggable="false" resizable="false" headerRenderer="GridHeaderRenderer" paddingRight="5"/>

View 1 Replies

ActionScript 2.0 :: Grid Thumbnail With Dynamic Grid Lists

Mar 19, 2007

I really like the thumbnail gallery for its simplicity and beauty. But I would like to ad or vertical scroller (I'm unable to find it here too, maybe I'm blind, just I'm more at the end of my seeking options) or a make a grid thumbnails, that will show 2 columns of thumbs and 5 pictures in each columns, then under the 2 columns i would like to ad a sort of arrow or button that if my gallery have more then 10 pictures it will go on the next thumbnail list. I'm not looking for any extra fading effects or special movements. Just would love to have a single thumbnail grid on side, with option to have lists of thumbnails by 10 if there is more then 10 pictures or so.

View 14 Replies

Flex :: Resizable Grid Row And Grid Item

Sep 24, 2009

I have a mx:Grid component in my flex application. But I would like to resize it by clicking and dragging in the border. This component doesn't allow doing that.I want to put a panel in each gridItem of this Grid component and resize it.

View 1 Replies

ActionScript 2.0 :: Accessing Grid Spaces In A Grid?

Jun 24, 2008

I'm building a small editor that allows users to place electrical components onto a grid so that they can see how electricity works. I have built a grid using an array and for loops and attach movieclips dynamically to that grid. What I want the moviclips to do is to look in the four spaces either side of itself i.e. up, down,left and right.I have managed to pull the grid coordinates out of the grid which enables me to tell the clip which grid space to look at but have been unable to successfully get the code to work.Here is my code:

myGrid = [[1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],[code]....

View 1 Replies

ActionScript 3.0 :: How To Make Tiles

Dec 7, 2009

How do you make tiles in AS3? I can't find any good tutorials that actually teach it. I'm wanting to create an isometric tile based game, but I don't understand how to make the objects line up together.
 
I have an isometric engine in AS2 but I don't know how to get it into AS3.

View 5 Replies

Flash :: Represent Tiles In XML?

Jun 28, 2010

So, I'm writing an AS3 program that tiles floor tiles. I want the user to be to be able to create their own floor schematic represented by different rectangles. It'll be drag-and-drop. They will lay out their schematic (which is composed of different size rectangular tiles) and drop colors/patterns onto them.

This schematic will then be tiled on a 3D plane to represent what the actual floor would look like.

I've got the 3D part working, drag-and-drop working, etc. What I'm missing is the floor schematic stuff. I've spent a lot of time trying to figure out the best solution, but I can't QUITE get there.

Here are some examples (out of a WHOLE bunch of possible combinations) of how the floor schematics could look:

The different tiles within the schematic are the droppable regions. My problem: How can represent these schematics in XML? Don't worry about tiling, sizing, etc. I've got that all figured out already. I just literally do not know how I can represent a tile schematic in XML and draw it correctly with AS3.

View 4 Replies

IDE :: Pathfinding With Direction Tiles

Oct 25, 2009

I've been experimenting with path finding, in particular the A* algorithm. I've understand the basics for it and can currently get an object to move from point A to B avoiding walls. However I'm trying to create one way blocks, (then eventually add turn left and right only and T juncs etc) so I don't have to use thick walls to prevent the object from taking a certain route. The code I have so far is....

[Code]...

View 1 Replies

ActionScript 3.0 :: How To Place Tiles On Background

Sep 17, 2010

I'm trying to place tiles on background. I have a tile (20X20) on stage ( 600X400px) and I have declared it as a Symbol of Class BgTile (also have checked to export for actionscript), Problem is that it is working only partially. Some Tiles in the second row are missing and a (or more) tile(s) is(are) placed at the origin (Registration point is in the center) strangely.

function CreateBG():void{
for(var i:uint=0;i<20;i++){
for(var j:uint=0;j<30;j++){
var tempBG=new BgTile();
tempBG.name="tile"+i+j;
addChild(tempBG);
getChildByName("tile"+i+j).x=j*20+10;
getChildByName("tile"+i+j).y=i*20+10;
}}}
CreateBG();

View 4 Replies

ActionScript 3.0 :: Making A Column Of Tiles?

Oct 12, 2010

I'm trying to learn how to make grids using the Vector method. I have my tiles set at 100x100. I made a function to layout the first set of tiles in the first column. Here is my function:

public function Grid():void  { for ( var i:int = 0; i < 5; i++)  groundTileList.push(new Ground_tile());  var column:Ground_tile = groundTileList[i];  addChild(column);  column.x += 100;  }

[code]....

View 3 Replies

ActionScript 3.0 :: Get Multiple Tiles From One Picture?

May 24, 2011

I have a .png file with 16x16 tiles that I want to make into their own variables. I've tried using BitmapData like this:

bitmapData=new BitmapData(16,16,true,0x000000);
bitmapData.draw(loader);
bitmap=new Bitmap(bitmapData);

addChild(bitmap);But I then realised that would only work for the top-left tile of the picture. How would I be able to get the rest of the tiles?

View 2 Replies

ActionScript 2.0 :: Create A Map Using Tiles And An Array?

Nov 9, 2009

This is my first time using Actionscript in probably 4 years and I'm learning everything all over again. For example, here's what I tried to jump right into doing and just realized I don't remember how. I'm trying to generate a world map out of tiles I created in Photoshop. I've created a symbol in the library for each tile and want to use an array and a for loop to create the full map.

So far I seem stuck on creating the array itself. I've started by creating a variable for each tile that exists such as m73 = "Lake South" where "Lake South" is the name of the symbol in the library. The full map will be a 32x32 grid of tiles but for now (until I get it working) the array is much smaller. An example of it is like this:

worldMapArray = [m4,m4,m4,m4]
[m0,m4,m4,m4,]
[m17,m16,m16,m16];

Hopefully this is enough to convey what I'm trying to do. However, when I use something like trace(worldMapArray[0][1]); it comes up as undefined. I've already created the needed for loops that use attachMovie for each iteration in the array, but as the array itself isn't set up right nothing happens.

View 1 Replies

ActionScript 3.0 :: Resizing Tiles Using Loops?

Mar 18, 2011

I found the following code online for a Flash Memory Game. You click on pairs on grey tiles, when you click they reveal a color and when the two colours match the tiles disappear.

The problem I'm having is that the tiles are too big and I need to resize them. However when I do only the first 9 of 16 tiles are resized. It's as if the nested loops calculate the first 9 tiles and the last row and column take up whatever space is left.

Anyway lines 19 and 20 are the ones in which the tiles are calulated:

tile.x = (x-1)*50;
tile.y = (y-1)*50;

Code:

package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.TimerEvent;

[Code]....

View 4 Replies

ActionScript 3.0 :: Generating The Random Tiles?

May 5, 2011

I have an engine for platformer game and I need to generate random blocks while moving and of course delete old ones, when the hero leave pervious position.Here is the code for generating random platforms when the game starts (costructor):

ActionScript Code:
public function TheGame()
{
bla-bla...

[code]....

As you can see, I create a loop which creates 10 platforms in different positions.My goal is to create a function which will delete blocks from the array which are not in the stage anymore and create new blocks when screen is moving up.

View 2 Replies

ActionScript 3.0 :: Managing Many Tiles (or Symbols)

Mar 5, 2012

I'd like to display a group of squares following a pre-determined path to create rows. Like row 1 to 10 would be Row1(), 11 to 20 Row2() and so on. The main reason for this is to hide the Menu before actually showing/building it. After the Menu is build up, I could remove the squares any way I want to reveal the Menu behind.

View 0 Replies

ActionScript 2.0 :: Creating Field Of Tiles?

Jan 7, 2007

Basicly this should work just like a non OOP tile game board. It just stacks the tiles on top of each other and never changes the color. So I assume that _root.cname is the wrong way to referance it.

Code:
//Create beginning variables
var checks_ver:Number = 8;

[code].....

View 3 Replies

ActionScript 3.0 :: Swapping Tiles From Board (9 Frames)

Dec 29, 2009

I create a board using the class Baldosa (which is a tile on my .fla file with 9frames, each is a tile of a different color). I first create and array of numbers which indicates which frame (color) the baldosa element will display. As grey baldosas are more than the other colors (this is intended), then I unsort the array to avoid grey baldosas accumulating on the right side of the board. Then I push each baldosa in an array, and add each of them as child of the contenedorBaldosas(container) to avoid adding events for each Baldosa.

The problem comes when I want to check collisions. If there's a collision, I swap positions of each Baldosa. It only works if I swap the tile at depth number 0 and the last at depth 79, for the rest of Baldosas, it doesn't detect any collision (the baldosa clicked will return to its original position as nothing had happened. I made a trace and it seems the baldosa clicked doesnt collide with another baldosa in the array (each baldosa is given the name baldosaxx using the variable in the for loop), but rather an unnamed instancexxxx.

Also I'm treating the baldosa elements as Sprites, but as the baldosa in my .fla is a MovieClip, and it contains a Timeline where each frame is a baldosa of a different color, the problem may be also here.
package {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
[Code] .....

View 1 Replies

ActionScript 3.0 :: Check The Existance Of Other Tiles On The Same Row And Column?

Apr 20, 2011

I'm working on a tile game and need to figure out an equation.. I have a grid which is 12x11.. when I place a tile I need to check the existance of other tiles on the same row and column and add up their values..I need to create an equation with the following variables :-
 
Receives a number between 1 and 132 :-
 
divides and/or multiplies the number into all the possible divisions of 12 in between 1 and 132 adds or subtracts the correct amount of tiles which lie either side dependant on it's position(I have drawn out the grid, and, for example, tile 66 has five tiles either side, tile 121 has 11 to it's right because it's in the bottom left hand corner)

View 10 Replies

Actionscript 3 :: Image - Slice A Bitmap Into Tiles

Aug 9, 2011

I have the Bitmap data from a Loader object and I would like to slice it up into 32x32 squares to use as tiles. What is the most efficient way to do so?

View 2 Replies

ActionScript 3.0 :: Snap MovieClips Together - Hybrid Tiles

Apr 11, 2011

Here's the functionality I am trying to achieve: I have 30 tiles on my stage. I can move them around through multitouch like this:

ActionScript Code:
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
import flash.events.TouchEvent;
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
for(var i:int = 1;i<=30;i++){
this["tile"+i].addEventListener(TouchEvent.TOUCH_OVER, onBegin);
}function onBegin(e:TouchEvent):void{
e.currentTarget.startTouchDrag(e.touchPointID)
}

What I want to happen is that when a tile is released on another it snaps to that tile and they become one tile so when moving around you actually move them both. When you release the 2 tile 'hybrid' onto another tile it becomes three tiles together and so on.

View 0 Replies

IDE :: OOP/Event Related: Transition Game Tiles?

Oct 13, 2009

I'm working on OOP skills by creating a fun Mahjong game. I made a working concept (not very OOPed yet), and am trying to get everything OOPed before its too late. I want the tiles to transition in, maybe teleport in like a Star Trek movie. The tile object is a movie clip, so it can play the transition as it is added to the stage. Tiles will be added in, in increments so there's a cool wave-like effect of teleporting.

How would I know when the tiles have finished transitioning in? Would the tiles generate an events that the game object detects, starting the game after receiving X 'finished' events? Or should I create a timer in the game object where the amount of time to wait for the transition depends on the number of tiles being added to the board?

I think I'm close, but could use any general feedback on the concept. The coding is not an issue. I'm just trying to wrap my head around things.

View 2 Replies

ActionScript 3.0 :: Dragged Object Should Snap To The Grid If The Distance Between The Object Bounds And A Grid Line Is Less Than 5px

Jan 16, 2012

I'm trying to code the snap to grid functionality. The dragged object should snap to the grid if the distance between the object bounds and a grid line is less than 5px. I found a way to do it if the object's rotation is 0 but it doesn't work if I rotate the object. I need a different approach. Can you point me into the right direction with the algorythm or any source code?

View 3 Replies

ActionScript 2.0 :: Create Tiles Based On A 2 Dimensional Array?

May 28, 2008

I'm having a big problem with my tile-based game. I create tiles based on a 2 dimensional array. Each tile is a Movie Clip, created using attachMovie. The problem is that when there are many of these tiles, the game lags, because so many properties must be stored for each MC. Is there a better method for creating "tiles" than attachMovie, or a way to free the memory used for each one?

View 10 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved