Best way to display dynamic data records

  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

Hi all

been considering this, and from what i gather, the possibilities are:
1) data grid componenet
2) using attachMovie, attaching individual MC's per record.

are there any other ways?

does anyone have a good example of using attachMovie as a way of displaying dynamic data
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

i remember using XML ( was an experment ) ...
pushed requierd element into an array then counting length i will attach a movieclip which basicly contains a Dynamic text field with the value of each array in it .

hope did'nt confuse u ... will atatch file tomowro .. got it somewhere back @ work ..
Repost here so i get a reminder .
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

never used the grid component. I prefer to use attachMovie (since i dont really use built in components in flash).
Basically you only need just a movieclip with a dynamic MC in the library, then attach it, for each column and row (only for the ones that are displayed).
so ... this should be what u have to do:
1) create all the mc's displayed (only once)
2) fill them with the data for a selected page.
3) add next/previous page options.

let`s say you want to display a grid with R rows and C columns

Code: [ Select ]
var R = 6;
var C = 4;
var nX = 5; // starting x for first cell in the datagrid
var nY = 5; // starting y for first cell in the datagrid
this.createEmptyMovieClip("dataGrid", 0);
var nGridWidth = 500; // width of data grid
var iCellIndex = 0;

for (iRow = 0; iRow<R; iRow++)
{
  for (iColumn = 0; iColumn<C; iColumn++)
  {
     crtCell = dataGrid.attachMovie("gridCell", "gridCell"+iCellIndex, iCellIndex);
     crtCell._x = nX;
     crtCell._y = nY;
     nX += crtCell._width + 5; // 5 = horizontal space between 2 cells
     if (nX + crtCell._width >= nGridWidth)
     {
       crtCell._y += crtCell._height + 5;
       nX = 5;
     }
     iCellIndex++;
  }
}
  1. var R = 6;
  2. var C = 4;
  3. var nX = 5; // starting x for first cell in the datagrid
  4. var nY = 5; // starting y for first cell in the datagrid
  5. this.createEmptyMovieClip("dataGrid", 0);
  6. var nGridWidth = 500; // width of data grid
  7. var iCellIndex = 0;
  8. for (iRow = 0; iRow<R; iRow++)
  9. {
  10.   for (iColumn = 0; iColumn<C; iColumn++)
  11.   {
  12.      crtCell = dataGrid.attachMovie("gridCell", "gridCell"+iCellIndex, iCellIndex);
  13.      crtCell._x = nX;
  14.      crtCell._y = nY;
  15.      nX += crtCell._width + 5; // 5 = horizontal space between 2 cells
  16.      if (nX + crtCell._width >= nGridWidth)
  17.      {
  18.        crtCell._y += crtCell._height + 5;
  19.        nX = 5;
  20.      }
  21.      iCellIndex++;
  22.   }
  23. }


// then, when you need to fill the data, you know youl have R*C records/page.
so for the given page, P
you start to fill records from R*C*P index (if you have the data arranged as in the dataGrid: r1: c1, c2, c3, c4, c5; r2: c1, c2, c3, c4, c5; r3: c1, c2, c3, c4, c5. If you have objects with data for each column, then skip the C part, and start filling from R*P index for each object).

i.e.:
Code: [ Select ]
iCellIndex = 0;
for (iRow = 0; iRow<R; iRow++)
{
  for (iColumn = 0; iColumn<C; iColumn++)
  {
     crtCell = dataGrid["gridCell"+iCellIndex];
     crtCell.dynText.text = text_from_outside;
     iCellIndex++;
  }
}
  1. iCellIndex = 0;
  2. for (iRow = 0; iRow<R; iRow++)
  3. {
  4.   for (iColumn = 0; iColumn<C; iColumn++)
  5.   {
  6.      crtCell = dataGrid["gridCell"+iCellIndex];
  7.      crtCell.dynText.text = text_from_outside;
  8.      iCellIndex++;
  9.   }
  10. }
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

ok , Made a new one ...
http://www.zainals.com/xperments/dynamic/XML.zip

edit \\

i think i shoulda used the modulo operator :? for the next row ...
i guess ... ohh well , its just a sample :D
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

gonna be checking this out when i get home. Thanks ;)

when I have bottomed this out, im going to be making some video tutorials in it. heck, the site is going to be a dynamic flash site, so it'll be used there too.

I have just ordered PHP5 for flash too, as the old php for flash I had is way out of date. I presume the concept is the same, but dont have enough time to experiment.
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

hey tell me more about the PHP 5 book , if its any good , i might get a copy ..
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

http://www.friendsofed.com/book.html?isbn=1590594665 is the one

ordered it off the bay. There aren't many tutorials or proper 'how to's' about dynamics and flash.

a few tutorials will be nice I think. Video's + naration. making functioning applications. That means my designtutorials.co.uk domain will finally be of some use.
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

Nucleo wrote:
http://www.friendsofed.com/book.html?isbn=1590594665 is the one

ordered it off the bay. There aren't many tutorials or proper 'how to's' about dynamics and flash.

a few tutorials will be nice I think. Video's + naration. making functioning applications. That means my designtutorials.co.uk domain will finally be of some use.


lovely ... :D
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

IceCold wrote:
snip...


had a go last night and thought I would post here. I was only displaying rows of records, i'll post my modified solution up later.

but thanks for yours because it worked a treat!

one point i will make. for some reason when testing the movie - ctrl+enter - it takes a long time to process. is it the attachMovie command which is causing this?
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

no, attachMovie is really fast.
is something else that's causing the delay. have to see the code to get a clue.

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.