How To Show One Pdf File In One Column Of Grid Using <mx:grid> Tag
hi frnds, can anybody tell me how to display a pdf file in one coulmn of grid as one griditem. tell me me the cod eto do that in mxml tag with attribute form . if not possible then in actionscript form.
reagrds- ankit
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 02-26-2008, 03:51 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Add Variable Column Name Into A Grid
can anybody help me .I have a problem in adding variable column name
code:
str="name"
_root.grid.addItem({str:'Jim!!', age:30});
output:
str age
jim 30
I want the following output:
Name age
jim 30
thank you
Add Variable Column Name Into A Grid
I have a problem in adding variable column name
code:
str="name"
_root.grid.addItem({str:'Jim!!', age:30});
output:
str age
jim 30
I want the following output:
Name age
jim 30
thank you
Function For Data Grid Column
I've got a datagrid which is editable. I need to put a function on one column that checks to see that the value entered for that column is not being used by another row. It's a users table and I want to make sure that when adding or changing a user, the usernames do not conflict with other users.
Any ideas.
How To Calculate Column Value In Grid Control?
I’m developing shopping cart module and I’ve a problem, I have a grid control as the cart, this cart has 3 columns quantity, product, size and subtotal and my problem now is that I want to calculate the total value for the subtotal column, I’ve class file and I did function like the following
private function calc_carttotal() {
var products_array:Array = this.m_cart_so.data.products;
var cart_total:Number = 0;
var cart_Alltotal:Number = 0;
trace("products_array = "+products_array);
for (var i = 0; i<products_array.length; i++) {
var counter:Number = 0;
trace("I = "+i);
trace("array itemes = "+products_array.length);
//if (products_array[i].productID != undefined) {
var myprice:Number = products_array[i].price;
var myquantity:Number = products_array[i].quantity;
cart_total += myprice*myquantity;
counter = counter+1;
cart_Alltotal += cart_Alltotal+products_array[counter].price*products_array[counter].quantity;
trace("total item = " + cart_total);
trace("total = " + cart_Alltotal);
//}
return cart_total;
}
}
All what I need is to make [i] get the current row index and also the total value for subtotal column.
Really it’s highly appreciated to help me because I’ve a very tight time and deadline.
How To Create A Column Header In A Grid Using Action Script?
Hi all,
I have tried to draw a grid like thing in flash using action script with the help of looping, how can i change the color of the first row in the grid? plz help me in coding. I have shared the coding here.... this will create a table like structure with 5 rows and columns with some random numbers inside each cell.
for (var i = 1; i<=5; i++) {
for (var j = 1; j<=5; j++) {
counter++;
// We attach the movie clip on the stage
grid_container.attachMovie("cellMCs", "cell"+counter, counter);
// We assign a _x position to the cell
grid_container["cell"+counter]._x = initX;
// We assign a _y position to the cell
grid_container["cell"+counter]._y = initY;
grid_container["cell"+counter].randomNumber.setNewTextFormat(txtFormat);
// We generate a random number that we display in the dynamic text field of the cell
grid_container["cell"+counter].randomNumber.text = Math.floor(Math.random()*9)+1;
trace(grid_container["cell"+counter].randomNumber.text);
// We assign a onRelease event to the cell
//grid_container["cell"+counter].onRelease = function() {
//cellName.text = this._name;
//};
initX += 30;
}
initY += 30;
initX = 0;
}
Thanks in advance,
Cbe.
Good Way To Dragdrop Mc To A Sticky Grid With Grid Cells That Animate.
Is there a way to get mc._dropTarget to recognize a hidden MC it drops on?
I have am trying to drag drop a movie clip item onto a 9 by 6 grid. The user should not see the grid. Each grid cell has a number of properties, including an animation that plays in it depending on what is dropped in it. What is the best way to do this. I came up with two ways:
A. Do the math:
1. Figure out what the drop point x and y values would convert to in the grid to find the grid cell it applies to.
2. Attach a new movie clip animation to that cell's centered x,y point to show something happened there.
B. Fill the grid with Movie Clips:
Use the mc._droptarget to see what grid cell movie clip was dropped on and then change its animated state to show something happened there.
The problem with A is that it is a little slow and cumbersome.
The problem with B is that I can't let the user see the cell movieclips. mc._droptarget only works to detect if a mc was dropped on visible graphic area of another mc as far as I can tell.
I could sure use some help on this. Is there a better way?
- Wade
Grid Thumbnail With Dynamic Grid Lists
After 3 days of browsing and searching any sollution for my problem I decided to ask you directly here. 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. If somebody can please redirect me or help me I would be very happy, also other ppl here that are seeking for the similar. thank you
How To Drag Column Data From One Data Grid To The Anther?
How to drag column data from one Data Grid to the anther?
Hi,
I build an application in mx2004 and I have 2 dataGrid instants containing data.
I am looking for a way to let the user drag a row of data from a data grid and drop it in anther data grid.
I have an “EventListener” on “myListener.cellPress” caching the data, but I could not find a way to determine where to drop the data and how to insert it to the destination dataGrid.
Thank
Nimrod
How To Drag Column Data From One Data Grid To The Anther?
How to drag column data from one Data Grid to the anther?
Hi,
I build an application in mx2004 and I have 2 dataGrid instants containing data.
I am looking for a way to let the user drag a row of data from a data grid and drop it in anther data grid.
I have an “EventListener” on “myListener.cellPress” caching the data, but I could not find a way to determine where to drop the data and how to insert it to the destination dataGrid.
Thank
Nimrod
How Show Hand Cursor At Data Grid?
hi,
how we are usehandcursor at data grid and scrollBar component. I try to solve it through
CellRenderer class and study flash internal classes (DataGrid ,ICellRenderer,ScrollBar,UIScrollBar ) but i am fail to solve it.so please some one tells me how usehandCursor used in as3 component.
Help With Accessing Grid Spaces In A Grid
Hi Guys
I need a bit of help with my coding. 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],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1]];
var board:Object=new Object();
board.tileWidth = 30;
board.tileHeight = 30;
board.depth = 1;
board.path = this.grid;
function buildGrid(map){
var mapWidth = map[0].length;
var mapHeight = map.length;
for (var j:Number = 0; j<mapHeight; ++j){
for (var i:Number = 0; i<mapWidth; ++i){
var Tilename:String = "cell"+j+"_"+i;
var x:Number = i*board.tileWidth;
var y:Number = j*board.tileHeight;
var type:Number = map[j][i];
board.path.attachMovie("tile", Tilename, ++board.depth);
switch(type){
case 0:
board.path[Tilename].dropable = true;
break;
case 1:
board.path[Tilename].dropable = false;
break;
}
board.path[Tilename]._x = x;
board.path[Tilename]._y = y;
board.path[Tilename].gotoAndStop((type+1));
//trace(board.path);
//trace (i);
var depth:Number = 2001;
power.onPress = function(){
this.startDrag();
}
power.onRelease = function(){
this.stopDrag();
trace("drop - "+this._droptarget);
var drop_target = eval(this._droptarget);
if (drop_target != null){
if (drop_target.dropable ==true){
//drop_target.gotoAndStop("topsource");
trace("drop on tiles");
trace("we are dropped!");
this._x = 250;
this._y = 60;
_root.board.path.attachMovie("powersource2_mc", "powersource", depth);
_root.board.path.powersource._x = drop_target._x;
_root.board.path.powersource._y = drop_target._y;
_root.board.path.powersource.onPress = function(){
_root.board.path.powersource.startDrag();
_root.board.path.powersource.swapDepths (2001);
}
_root.board.path.powersource.onRelease = function(){
//this code gets the grid/cell/i_j reference and converts it to numbers that
//gives the x and y position within the array
var gridPos = this._droptarget;
var xcellRef = gridPos.substring (12);
var ycellRef = gridPos.substring (10, 11);
//these variables turn the string values into numbers
var Gridx:Number = xcellRef - 0;
var Gridy:Number = ycellRef - 0;
trace ("current x position is::" +Gridx);
//trace ("curent y position is ::" +Gridy);
//var gridCheck:Number = Gridx+1;//check to the right
//trace ("the square on my right is::" +gridCheck);
if (Gridx+1 == _root.board.path.brightlamp){
trace ("something is there!");
}else{
trace ("nope nothing here!");
}
snapto=30;
_root.board.path.powersource._rotation += 90;
Newx = Math.round(_root.board.path.powersource._x/snapto)*snapto;
Newy = Math.round(_root.board.path.powersource._y/snapto)*snapto;
_root.board.path.powersource._x = Newx;
_root.board.path.powersource._y = Newy;
stopDrag();
}
}else{
this._x = 250;
this._y=60;
}
}
}
}
}
}
buildGrid(myGrid);
sorry about the long post but any help will be greatly appreciated!
Tegalad
Grid Marker Not Data-grid
Hi Geeks!
Curious to know if its possible to created grid like marker over an image within Flash?
Have a look at attached image
Flash Viewer Slide Show Grid Maker Mashup Help
Hello everyone over here at Flash 8. I posted some questions regarding adding extra functionality to the Flash Photoviewer Slide show on the Flash MX 2004 wing of this forum and was wondering if anyone had any ideas.
Basically I took the Flash Photoviewer Slide Show, the Thumbnails tutorial, and iKim's Grid Maker tutorial (all great work) and mashed them together at the expense of some of the functionality:
http://www.kirupa.com/forum/showthread.php?t=249902
Grid Equations | Convert Array To Grid, And X/y To Array Pos
Grids? inside Grids? What?!
So recently I have been getting into grids for interactivity solutions surrounding drag/drop of movieClips. Without doing any internet searching (good/bad?) I sat down with a pad and pen and tried to calculate an equation to help control the code for a couple reasons.
First; I had been using something to increment the rows and columns which let the columns determine when a new row would start. This is messy and just bloats the code.
Code:
(not actual code)
for ( var i = 0; i < len; i++ )
{
if( column > totalcolumns )
{
column = 0;
row++;
}
else
{
column++;
}
xPos = column * columnSpace;
}
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
[converts array of items to grid positions]
1 . 2 . 3 . 4 . 5
6 . 7 . 8 . 9 . 10
11. 12. 13. 14. 15
Second; I wanted to determine where a drop occurred in a grid without doing hitTests on more than one item and trying to rationalize < > positions. So I ended up writing out a bunch of numbers, looking at the remainders and eventually leveraging % . (which I later found out is what everyone else probably uses ? the easy way). But how can I make the grid react to my [ _xmouse , _ymouse ] position when dragging an item?
Code:
(actual code)
var newY = Math.floor( i / cols ) * ySpace;
var newX = ( i % cols ) * xSpace;
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
[converts array of items to grid positions ( with less code ) ]
1 . 2 . 3 . 4 . 5
6 . 7 . 8 . 9 . 10
11. 12. 13. 14. 15
To solve the second problem I worked backwards and was able to write a way based on [x,y] that finds a position in a grid array and splices my drag item right inside to temporarily resort on the fly. So onMouseMove it looks like all the items adjust to the item I am dragging when over it's future position in the current grid.
To get the position, it looked something like;
Code:
function getGridPos ( newX, newY, array, cols, startX, startY, xSpace, ySpace)
{
var len = array.length;
// max bounds
var xMaxPosition = cols * xSpace + startX;
var yMaxPosition = Math.floor( len / cols ) * ySpace + startY;
// percentage of width/height
var xpos = ( ( xMaxPosition - startX ) / xSpace );
var ypos = ( ( yMaxPosition - startY ) / ySpace );
// convert to position in array
var xposProduct = Math.floor( ypos ) * cols
var yposProduct = Math.floor( xpos );
// position in array
var newPos = xposProduct + yposProduct;
return newPos;
}
// get array position from x,y
var arrayPosition = getGridPos ( _xmouse, _ymouse , tempArray, cols, startX, startY, xSpace, ySpace );
// put inside temp array
tempArray.splice( arrayPosition , 0 , my_mc );
// sort new items
arrayGridSort( tempArray, cols, startX, startY, xSpace, ySpace );
[p = mouse position ]
1 . 2 . 3 . 4 . 5
6 . 7 p8 . 9 . 10
11. 12. 13. 14. 15
[converts x/y position (p) to an array position]
[1,2,3,4,5,6,7, p, 8,9,10,11,12,13,14,15]
[resulting grid resort ]
1 . 2 . 3 . 4 . 5
6 . 7 . p . 8 . 9
10. 11. 12. 13. 14
15
So this works great. I?m able to know exactly where a point converts to an array position which helped me build a class for all future projects, GREAT 2.0! Now I can have a grid resorting when I just drag over and and the array position is known before I drop the item I'm holding - with drastically less code than I had been using previously!
HERE IS THE PROBLEM / CHALLENGE
So for complication sake (and this is more of a challenge than a problem ) what if I want to do the same thing but make groupings? Like, for every 2 columns - items space out 50 extra pixels and likewise for the y values? I understand how to make that function one way, but I have no idea on how to convert that back into an array position as I have been using in the previous example.
Code:
[ colGroups of 2 , colSpacing of 100 ]
1 . 2 . . . . . . 3 . 4 . . . . . . . 5 .6
7 . 8 . . . . . . 9 .10 . . . . . . .11.12
. . . . . . . . . . . . . . . . . . . . . .
13.14 . . . . . 15.16 . . . . .. . p17.18
19.20 . . . . . 21.22 . . . . . . 23.34
Now it?s easy to make that go one way;
Code:
// original xGrid equation
var newX = (i % cols) * xSpace;
// additional xGrid Groupings equation
var xGroups = 2;
var xGroupSpace = 100;
newX += Math.floor( (i % cols) / xGroups ) * xGroupSpace;
And While that is all said and dandy? What the heck is the reverse of that function to put it back into array form? The problem is just that my current reverse equation really only works on the percentage of the width/height - and that does not take segments into consideration. (solution: bezier hybrid maybe?)
So anybody a math whiz out there? Can I get a little Penner help? I don't need this done ASAP but it would be cool to not have to look back on this problem again.
Thanks!!
Fading Grid Tutorial HELP TO LOAD FILES FROM EXTERNAL FILE
Hi there,
I've done the Fading grind tutorial from Voetsjoeba and it was well done.
But i'm trying to load the images from an external file, for example from an xml file, or other way that it was possible, but i'm not figuring out how...
I've added this line code into the AS, but it didn't work when i upload the file and try to access online:
Code:
_root.createEmptyMovieClip("image", 999);
for (i=1; i<11; i++) {
image.loadMovie("/Imagens/I"+random(i)+".jpg", i);
}
If some one could help me i'll be very glad!!
And sorry about my english...
Thanks in advance
see ya
Grid?
Is there any way to disable the grid so that you can move objects around on the stage freely? I don't view the grid when I am creating things, but I am tired of not being able to line certain things up because an object seems like it has to line up with the grid. Is there any way around this because this has been frustrating me beyond belief. Thank you in advance for any help you can provide me.
Grid
How do i make a grid show up in flash so I can draw straight lines?
Help With Grid
I'm creating a project to layout pages of a book onto a poster, so that pages can be easily rearranged using drag and drop. So far I have used ActionScript to draw a grid, where the user can enter the number of pages he/she wishes to use and it best fits to the screen resolution. I'm not that great with Flash MX and so I have a few questions for you all, if it's not too much to ask.
1) How can I use ActionScript to create draggable, changeable text (with a limit on width and height)?
2) How can I make the text snap-to my grid boxes?
Thanks for your time.
Xml In Grid.
Could someone help me with binding xml to a grid like this one
I am trying to make a gallery which would place a thumnail node, from the xml, in each cell.
About Grid's
I have quite new in actionscript and my english is too not very good
I try to write paint-by-numbers application in Flash 8.
I have knowledge how to create grid, how to scale movieclips and etc simple stuff!
But i have some questions too:
1. How thin grid I can create with readable numbers in grid cell???
(Now I have 60x60 grid 700x700 pixel Scene size, is this the maximum limit when I can read numbers? Or there is some tricks to get smaller numbers to be readable in grid cells! I need only numbers in cells!)
2. Can I fill grid cells dragging mouse over them? Like selecting box on grid and this box will be filled? Or dragging line, etc ...
3. Is there easier way to make clickable grid, than putting movieclips side-by-side. Probably not!
I have hi-level PHP and Javascript programming knowledge, but not Flash and Actionscript. thats why maybe stupid questions here!
Thanx to everyone who understood what I asked and can answer those newbie questions! Maybe some have sample scripts or links where I can find solutions to my questions....
//Muhv (from Estonia)
Grid With AS
Hello,
I would like to draw a grid with AS and would appreciate all your help. I have two movieclips:
1: hr_mc horizontal line
2: vr_mc vertical line
I am able to render either hr or vr but cannot seem to get them to render together. I would highly appreciate your help.
Attach Code
function DrawGrid()
{
this._x = 170;
for(i=0; i<=10; i++)
{
_root.attachMovie("VL_mc", "VL_mc" + i, i,{_x: i*20, _y:200});
_root.attachMovie("HL_mc", "HL_mc" + i, i,{_y: i*20, _x:200});
}
}
DrawGrid();
Grid
I am trying to make a Grid that is equal to the width and the height of the flash movie. I have a movieclip called box which is 30x30, and want it to repead along the x to form columns and along the y to form rows so that it makes a big rectangle of smaller squares. For some reason it looks like this:
+
+
+
++++++++++++++
Instead of:
++++++++++++++
++++++++++++++
++++++++++++++
++++++++++++++
Here is my code:
ActionScript Code:
onLoad = function () { boxWidth = box._width; stageWidth = Stage.width; rows = stageWidth/boxWidth; trace("Number of Rows:"); trace(rows); // boxHeight = box._height; stageHeight = Stage.height; columns = stageHeight/boxHeight; trace("Number of Columns:"); trace(columns); // boxX = 0; boxY = 0; // for (i=1; i<=columns; i++) { for (j=1; j<=rows; j++) { // Create and Orient MovieClips duplicateMovieClip(box, "boxC"+i+"R"+j, i+j); // this["boxC"+i+"R"+j]._x = boxX; // this["boxC"+i+"R"+j]._y = boxY; // trace("Created Box Number"); trace(i+j); // boxX += boxWidth-1; } boxY += boxHeight-1; boxX = 0; }};
Any help would be greatly appreciated
Grid Fun
Hi,
I am trying to make a map made up of lots of little dots. With the code below I create a grid of dots and then mask it with a vector world map. This actually works but sends my cpu to 100%, is there a better way to do this?
Code:
numItems = 5500;
numColumns = 100;
cnt = 1;
startX = startY=0;
padding = 1;
_root.setMask(_root.map);
for (var i = 0; i<numItems; i++) {
this.attachMovie("dot", "dot"+i, i, {_x:startX, _y:startY});
startX = (cnt%numColumns == 0) ? 0 : startX+this["dot"+i]._width+padding;
startY = (cnt%numColumns == 0) ? startY+this["dot"+i]._height+padding : startY;
cnt++;
}
Grid
I am trying to make a Grid that is equal to the width and the height of the flash movie. I have a movieclip called box which is 30x30, and want it to repead along the x to form columns and along the y to form rows so that it makes a big rectangle of smaller squares. For some reason it looks like this:
+
+
+
++++++++++++++
Instead of:
++++++++++++++
++++++++++++++
++++++++++++++
++++++++++++++
Here is my code:
ActionScript Code:
onLoad = function () { boxWidth = box._width; stageWidth = Stage.width; rows = stageWidth/boxWidth; trace("Number of Rows:"); trace(rows); // boxHeight = box._height; stageHeight = Stage.height; columns = stageHeight/boxHeight; trace("Number of Columns:"); trace(columns); // boxX = 0; boxY = 0; // for (i=1; i<=columns; i++) { for (j=1; j<=rows; j++) { // Create and Orient MovieClips duplicateMovieClip(box, "boxC"+i+"R"+j, i+j); // this["boxC"+i+"R"+j]._x = boxX; // this["boxC"+i+"R"+j]._y = boxY; // trace("Created Box Number"); trace(i+j); // boxX += boxWidth-1; } boxY += boxHeight-1; boxX = 0; }};
Any help would be greatly appreciated
XML Grid
I need some help with flash gallery I purchased from istock. It has rows going vertical. I managed to change it to go horizontal. I want to have both horizontal and vertical (i.e) FWA site. I am attaching a snapshot and the script that I am thinking needs modification. Please help and thanks.
_global.Timer = function ( _listener ) {
this.$counter = 0;
this.$delay = null;
this.$startNum = null;
this.$stopNum = null;
this.$step = null;
this.$int = null;
this._listeners = new Array ();
this.addListener ( this );
this.addListener ( _listener );
};
var XN = _global.Timer.prototype;
AsBroadcaster.initialize ( XN );
XN.start = function ( _delay, _step, _startNum, _stopNum, _loop ) {
this.$delay = ( _delay ? _delay : this.$delay );
this.$step = ( _step ? _step : this.$step );
this.$startNum = ( _startNum ? _startNum : 0 );
this.$stopNum = ( _stopNum !== undefined ? _stopNum : this.$stopNum );
this.$counter = this.$startNum;
this.$loop = _loop;
this.stop ();
this.$count ();
};
XN.stop = function () {
this.$stopCount ();
};
XN.resume = function () {
this.$count ();
};
XN.$count = function () {
this.$int = setInterval ( this, "$update", this.$delay );
};
XN.reset = function () {
this.$counter = this.$startNum;
this.$resetTime ();
};
XN.$resetTime = function () {
this.stop ();
this.resume ();
};
XN.$stopCount = function () {
clearInterval ( this.$int );
};
XN.$update = function () {
if ( this.$counter <= this.$stopNum ) {
this.broadcastMessage ( "onTimerCount", this.$counter );
this.$counter += this.$step;
};
if ( this.$counter >= this.$stopNum ) {
if ( !this.$loop ) {
this.stop ();
this.broadcastMessage ( "onTimerFinished", this.$counter );
} else {
this.reset ();
this.broadcastMessage ( "onTimerLoop", this.$counter );
};
} else {
};
};
delete XN;
MovieClip.prototype.alpha = function(accelerate, boundary) {
var accelerate = accelerate;
var boundary = boundary;
this.onEnterFrame = function() {
if (this._alpha>boundary) {
this._alpha -= accelerate;
if (this._alpha<=boundary) {
delete (this.onEnterFrame);
}
}
};
};
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
header = [];
titles = [];
descr = [];
images = [];
links = [];
total = xmlNode.childNodes.length;
for (z=0; z<total; z++) {
header[z] = xmlNode.childNodes[z].childNodes[0].firstChild.nodeValue;
titles[z] = xmlNode.childNodes[z].childNodes[0].firstChild.nodeValue;
descr[z] = xmlNode.childNodes[z].childNodes[1].firstChild.nodeValue;
images[z] = xmlNode.childNodes[z].childNodes[2].firstChild.nodeValue;
links[z] = xmlNode.childNodes[z].childNodes[3].firstChild.nodeValue;
//links[z] = xmlNode.childNodes[z].childNodes[4].firstChild.nodeValue;
}
DuplicateMc();
} else {
_parent._parent.mc_error.gotoAndStop(2);
_parent._parent.error.text = "Sorry, xml file not loaded";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("xml/last_added.xml");
sety_ar = new Array ();
index = 0;
iloscWyswietlana = 5;
var t = _global.t = new Timer ();
t.addListener ( this );
delete t;
function DuplicateMc() {
ile = z - 1;
szerokosc = 265;
wysokosc = 250; // This controls the spacing between each content
liczba = 1;
for (p=0; p<ile; p++) {
s = attachMovie ("zestaw", "zestaw"+p, p);
y = Math.floor (p/liczba);
pozycja = y%iloscWyswietlana;
s._y = (5); // Controlls listing order for content - list horizontal
s._x = (wysokosc+5)*pozycja+2;
s.title_txt.text = titles[p+1];
s.desc_txt.text = descr[p+1];
s.img_container.loadMovie(images[p+1]);
s.mc_button_link.link = links[p+1];
s.num = p;
s.mc_button_link.onRelease = function() {
var l = this.link.split("#");
if (l.length>1) {
this.getURL(l[0], l[1]);
}
}
if (links[p+1].length<8) {
s.mc_button_link._visible = false;
}
s.mc_button_link.onRollOver = function() {
this._parent.desc_txt.textColor = 0xC40000;
this._parent.borders.gotoAndPlay(2);
}
s.mc_button_link.onRollOut = function() {
this._parent.desc_txt.textColor = 0x737373
this._parent.borders.gotoAndPlay(11);
}
sety_ar.push ( s );
s.mc_button_link._visible = false;
};
_parent._parent.resizer_1.resizer_2.prev_btn._alpha = 30;
_parent._parent.resizer_1.resizer_2.prev_btn.enabled = false;
_parent._parent.resizer_1.resizer_2.prev_btn.useHandCursor = false;aktualizujWyswietlanie ();
}
function aktualizujWyswietlanie () {
ukryjWszystkie ();
wyswietlOdpowiednie ();
};
function ukryjWszystkie () {
for (var i=0; i<sety_ar.length; i++) {
var s = sety_ar [i];
s._visible = false;
s.fade._alpha = 100;
};
}
function wyswietlOdpowiednie () {
for ( var i=0; i<iloscWyswietlana; i++ ) {
var s = sety_ar [ index+i ];
current_pos = (index/iloscWyswietlana)+1 ;
total_pos = Math.ceil (z/iloscWyswietlana);
_parent._parent.dragline.pos_txt.text = current_pos+"/"+total_pos;
_parent._parent.dragline.header_txt.text = header[0];
s._visible = true;
s.fade._alpha = 100;
};
_global.t.start ( 100, 1, 0, iloscWyswietlana, false );
this.onTimerCount = function ( _count ) {
var s = sety_ar [ index + _count ];
s.fade.alpha(5, 0);
if (links[s.num+1].length<8) {
s.mc_button_link._visible = false;
}
else if (links[s.num+1].length>8) {
s.mc_button_link._visible = true;
}
}
}
function forw () {
if ( index < z - iloscWyswietlana ) {
index += iloscWyswietlana;
aktualizujWyswietlanie ();
_parent._parent.resizer_1.resizer_2.prev_btn._alpha = 100;
_parent._parent.resizer_1.resizer_2.prev_btn.enabled = true;
_parent._parent.resizer_1.resizer_2.prev_btn.useHandCursor = true;
};
if ( current_pos == total_pos ) {
_parent._parent.resizer_1.resizer_2.next_btn.enabled = false;
_parent._parent.resizer_1.resizer_2.next_btn.useHandCursor = false;
_parent._parent.resizer_1.resizer_2.next_btn._alpha = 30;
};
}
function prev () {
if ( index > 0 ) {
index -= iloscWyswietlana;
aktualizujWyswietlanie ();
_parent._parent.resizer_1.resizer_2.next_btn._alpha = 100;
_parent._parent.resizer_1.resizer_2.next_btn.enabled = true;
_parent._parent.resizer_1.resizer_2.next_btn.useHandCursor = true;
};
if ( current_pos == 1 ) {
_parent._parent.resizer_1.resizer_2.prev_btn._alpha = 30;
_parent._parent.resizer_1.resizer_2.prev_btn.enabled = false;
_parent._parent.resizer_1.resizer_2.prev_btn.useHandCursor = false;
};
}
Help With Grid...
Im trying to make a grid for thumbnails. 5 thumbs across then start a new row.
example....
•••••
•••••
•••••
•••
So here is the code im using. Ive really need help on this, because every time i think i figured it out. Im wrong.
Code:
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = thumb_mc._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
Xml Into Grid
Hi.
I have thits function to load my images into flash from an .xml document. What i want is to place the images in a grid with 2 columns in the X direction instead of one as it is now. I cant really figure out how to do.. A techish loop or something?
Code:
function xmlLoaded(event:Event):void
{
xml = XML(event.target.data);
xmlList = xml.children();
for(var i:int = 0; i < xmlList.length(); i++)
{
imageLoader = new Loader();
imageLoader.load(new URLRequest(xmlList[i].attribute("thumb")));
imageLoader.x = 249;
imageLoader.y = i * 70 + 78;
imageLoader.name = xmlList[i].attribute("source");
addChild(imageLoader);
imageLoader.addEventListener(MouseEvent.CLICK, showPicture);
}
}
My XML has this structure:
<image>
source and descripton and that stuf
source and descripton and that stuf
source and descripton and that stuf
source and descripton and that stuf
...continuing
</image>
Grid Movement
[swf width="550" height="400" background="#FFFFFF"]http://www.arcadenetwork.com/worlds/worlds.swf[/swf]
This is a project i'm currently working on. Could anyone tell me how I could make a character move from one cell to another in straight lines taking the shortest route - (not travelling diagnally over squares)?
Thanks
Gary
Imported .JPG To A Grid ?
Is it possible to do this with ActionScript.. I've a photo that I imported into Flash and made into a movie clip... so far so good
What I would like to do (if possible) is take that single MC and make into (say) 9 smaller MC's.. each containing part of the original photo..
so MC(1) would be the top left bit of the photo,
MC(2) would be the top middle of the photo
MC(3) is the top right of the photo
etc etc
So I could then move each part of the photo (like a jigsaw puzzle)
Creating A Grid
I have two input boxes named optionx and optiony. A person can enter a number value into these and a grid will draw itself being optionx wide and optiony high.
I have a MC 4 pixels wide that when duplicated optionx times can form one row. I have;
setProperty ("node"+i, _x, i*5);
so that there is a 1 pixel gap between each duplicated square to give the impression of a grid.
What I am having trouble with is getting the squares to move down a line once they have reached the optionx value to draw the rest of the grid ie optiony value. And then stop once the whole grid is drawn.
Any help/hints would be really appreciated.
cheers
How To Duplicate A Grid Of Mc's..
Hi, I am wondering how you would go about duplicating a grid of movieclips on the stage..
I can generate them in a row next to each other, but after 5 have been created I want to go to the beggining again and duplicate more on the next row.
Eg if the user entered 20 mc's I could generate a 5x 4 grid of mc's.
Does anyone know how this can be done easily in actionscript?
Thanks
Defining A Grid
Can anyone explain to me how I'm supposed to define a grid? Like, if i wanted to make a chess game.
I looked at some source, and realize I can create rows and coulms using two arrays with For loops, but how do I define the position of each row/column/cell using x-y coordinates so that a piece on the grid can be moved to specific square?
Thanks.
CountBule
Functioning Grid
I posted this before, but got no answer. Maybe some more info is in order.
I've been unable to find any tutorials or info regarding the use of a grid. I want to define a grid not unlike one in a chess game. I want to be able to move pieces around (and ultimately save their position). However, I have no idea how to define such a grid in Actionscript. The best example I have is a connect four game I d/led as an example. The following code defines the game grid...
// connect4 jim burton mar 2002 j.b@dynamitechicken.com
// initialise the array of places on the board
// Define 2D array object of the form places[row][column]
// with properties
// x: positions x pos
// y: place's y pos
// state: (empty, red, yellow) the status of each
places = new Array(7);
for (var r = 0; r<7; r++) {
// new row
places[r] = new Array(7)
for (var k = 0; k<7; k++) {
// new column
places[r][k] = new Object()
places[r][k].x = 65+(k*50)
places[r][k].y = 85+(r*50)
places[r][k].state = "empty"
}
}
emptySpaces = 49
its pretty apparent how the Array and For loops work to create the the rows and columns. What part confuses me is "places [r][k] = 65+(k*50)" and the other line below it. Exactly what does this do?
If anyone can explain this to me, or show me a better way to establish a grid, I'd be most grateful.
Actionscript Grid?
Is is possible to make a grid entirely out of actionscipt with only one line and have the grid rotate on mouseover of a different button?
10 X 10 Duplicate Mc Box Grid?
What I want to do is lay one hundred boxes 10 high, buy 10 wide, using actionscript. How can I position them so that I am only using one box on stage and it duplicates itself and layes itself in the right position all evenly spaced. I have this code that is on the first keyframe and a box 20 pixels buy 20 pixels on the stage named, "box". This lays them ten wide and does a fine job , but how could I get them to line up ten high buy ten wide?
_root.box._visible = 0;
for (i=0; i<10; i++) {
_root.box.duplicateMovieClip("box"+i, i);
_root["box"+i]._x = 100+i*45;
}
XML Data Grid
I am trying to break apart and understand the BlackAdder Component Set that I got from Macromedia.com that includes the XML Data Grid which I am specifically try ing to break apart. I dont understand this code really. Could anyone please expound on this for me?
[code]
Main = myXMLData.firstChild;
Record = Main.firstChild;
i = 1;
while (Record != null){
ColumnName = Record.firstChild;
this["myRowArray"+i] = new Array();
while (ColumnName !=null){
if (i == 1){
myHeaderArray.push(ColumnName.nodeName);
}
this["myRowArray" + i].push(ColumnName.firstChild.nodeValue);
ColumnName = ColumnName.nextSibling;
}
i = i + 1;
Record = Record.nextSibling;
}
NumRow = i;
Grid Zoom In/out
Any ideas where I might find a .fla for a grid
effect equal to the one on this link;
http://www.frostdesign.co.uk/
i.e you click a square on the small grid and it then
'grows' to the full size of the screen. Click again then
it zooms back out.
Thanks.
RPG Player Grid
I'm trying to develop a 'grid', each tile 36x36 pixels, to track characters, as well as to designate whether Collision Detection is present on any given tile. How do I refer to each tile (_root.tile1) in my code, and designate it as a non walkable surface or not? Ultimatly, the movement code will ref. the MC's _x & _y pos. then check it against the grid code to see whether or not he can step in the tile.
any ideas? Thanks guys!
-Tyler
Problems With A Grid
for about the fifth time, im making a map out of map pieces, like corners, horizontal connectors etc, and im having a problem. not sure what it is, the code seems fine. i assure u the draw() function works so i wont bother putting it up.
code:
lib=new Array()
lib[0]=new Array([0, 0, 0], [1, 1, 1], [0, 0, 0])
lib[1]=new Array([0, 1, 0], [0, 1, 0], [0, 1, 0])
lib[2]=new Array([0, 1, 0], [1, 1, 1], [0, 1, 0])
lib[3]=new Array([0, 1, 0], [1, 1, 1], [0, 0, 0])
lib[4]=new Array([0, 0, 0], [1, 1, 1], [0, 1, 0])
lib[5]=new Array([0, 1, 0], [1, 1, 0], [0, 1, 0])
lib[6]=new Array([0, 1, 0], [0, 1, 1], [0, 1, 0])
function parse(a, s, lib){
function box(a, y, x, j, i, s){
c=createEmptyMovieClip(x*i+'b'+j*y, k)
c._x=x*i*s
c._y=y*j*s
hex=(lib[a[y][x]][j][i]) ? '0xcccccc':'0x000000'
draw(c, s, s, hex)
k++
}
for(y=0; y<a.length; y++){
for(x=0; x<a[y].length; x++){
for(j=0; j<lib[a[y][x]].length; j++){
for(i=0; i<lib[a[y][x]][j].length; i++){
box(a, y, x, j, i, s)
}
}
}
}
}
map=[[1]]
parse(map, 8, lib)
can anyone see a pproblem?
Grid Scale
Hi I am trying to learn how to reproduce the portfolio section on :
http://kurtnoble.com
I have worked out the grid moving and loading swf into the sections but need help in how to set up the brown box which fades in scales and then fades to white using action script.
Please take a look at the attatched to see how far i have got.
any help would be great
mark Newbie.
Fine Grid
How can I create a fine grid over some graphics? Should I do this in flash or photoshop? Because I would like some animations to happen below the grid but above the background graphic.
Data Grid
I have created a site all in flash and the client is now asking for a listing of all their stores to display in one of the sections. I pulled a customer list from their data base and I have about 175 listings all over the over the world. Any ideas on a nice easy way to format dynamic text in flash. I need a table structure but I noticed that table tags are not supported in flash text boxes.
Any ideas or solutions are welcome.
thanx.
Data Grid Xml
hello,
Ive been trying to import an xml doc into a flash data grid component. When i run it, it looks as though it has filled the grid, but with blanks.
Any ideas???
Drawing Grid
How do I make my text draggable and snappable to each other???? THX LOL
Assistance With Grid
Hello
I am wondering how I can create a grid of squares that when I click on them I can switch the color between black and white.
Imagine a chess board, but all squares are white to begin with. Each square when clicked should turn black. If clicked again, they should revert back to white and so on. The matrix of squares I plan to use is quite large so obviously an array should be used to store the on/off state of each square.
Any help on this matter would be great.
Copy To Grid
How do I copy an object once and then paste it into every grid square?
Grid Placement
Hey freinds.
So, what I have is a basic script to make an object snap to a position on a grid depending on where the mouse is:
For refernce sake, 'map', is the grid in which the script is applied to, being a small block, 20 by 20px.
code:
onClipEvent (enterFrame) {
_x = math.round((_root._xmouse-10-_map._x)/20)*20+10;
_y = math.round((_root._ymouse-10-_map._y)/20)*20+10;
if (_root._xmouse>_parent.map._x && _root._xmouse<_parent.map.mapwidth+_parent.map._x && _root._ymouse>_parent.map._y && _root._ymouse<_parent.map.mapheight+_parent.map._y ) {
_visible = true;
} else {
_visible = false;
}
}
However, when I make the map move, (just adding _parent.map._x++ on the script above), the object snaps to a grid that isnt relative to the map. So while the map creeps away, the object stays in the one place.
help appriciated
thanks everyone
Grid Of Diamonds
hi there,
i know there is probably a logical way to do this, but at the moment this is the only thing i can think of.
im building a dynamic mask made up of grid of diamonds which scale up to fill a space. In order to do this the diamonds must tesellate, which means that they dont arrange themselves like a normal square grid, where one square appears directly under the other and next to each other.
(sorry if im confusing you, im not very good at explaining myself)
at the moment i am using this code to generate my grid of diamonds:
code:
function buildMask(mask) {
var maskWidth = 13;
var maskHeight = 6;
for (var i = 0; i<maskHeight; ++i) {
for (var j = 0; j<maskWidth; ++j) {
duplicateMovieClip("diam", "diam_"+i+"_"+j, i*100+j*2);
setProperty("diam_"+i+"_"+j, _x, i*50);
setProperty("diam_"+i+"_"+j, _y, j*25);
trace (i);
}
}
}
buildMask();
stop();
but the problem i am having is that this grid doesnt tesselate the diamonds to make up one full square, because it is arranging the diamonds as if they were squares. one under the other and one next to each other.
i cant see a way around this. what i thought maybe was to have the script determine between odd and even numbers and shift the line of the grid accoringly, but i dont know if that will work.
if you have any ideas, please help. i dont think anyone will be able to understand what im asking for but if you have any ideas, please let me know.
thank you
Ross
|