[thelist] Flash results table
Og Site
mindmachine at hotmail.com
Sat Aug 30 22:30:22 CDT 2003
Greetings. I have done exactly what your trying to do numerous times.
Everything is quite simple, the only real issue is ensuring the alignment of
each tables content as the content changes from long to short. Here are the
essential steps.
Concept.
What we will do is place each fields content in an MC. This MC will contain
a text field which is a variable, and an invisible button (a button with
only a hit state and no other content on the other frames). Based on the
number of records you display, we will replicate this MC, each time filling
it with new content from your text file.
Note: this step by step is going to assume some level of actionscript and
Flash usage.
1. Create the Mc that we will use to hold the contents of each record. In
order to ensure that all content lines up use a different text field for
each field of information. Think of this MC as the row, and each of your
text fields represent the columns. Save this MC to your library object,
right click it in the library and set the linkage name to "recordMC". We
will use this identifier to load it from the library in our movie.
2. Now we need a frame of actionscript. We will start with a stop command
because we can do everything here on the one frame. By the way, I'm typing
this from my parents place at the moment so my actionscript references will
be explained, but I won't be typing the code. What we are going to do on
this frame is stop the movie and load the variables from the text file. One
of the tricks of loading variables from external sources is knowing when the
flash player has recieved all of the information. The most common method is
to use an on.Data() command which is triggered the moment the flash files
starts to recieve the requested data. Inside the on.Data() function we want
to put an on.EnterFrame(). We do this because although the onData() command
will notice when information has started to load into the flash environment,
it does not know when all the needed data has been loaded. So what we need
to do put a final variable in the text file, a variable which we will check
until it has value. I use a isDone variable at the end of my text files.
The key is to set the isDone variable in flash to something like "Null",
then set it's value in the text file to something like "Done". So we can
loop with the onEnterFrame() function using an if..then statement. If
isDone <> "null" Then delete this.onEnterFrame and continue. So our movie
stops, sets the isDone variable to "Null", then requests the variables from
the text file, once data starts coming in our movie triggers the
this.onData() function which jumps into the this.onEnterFrame, which waits
until the last variable "isDone" does not equal 'null' (which means all data
has been loaded and we can continue). The next step is to create a for..
Next loop. It should read like this
For i = 1, while i <= your_total_fields
attatch Movie to 'this', using the MC linked name "recordMC", and calling
the new one something like "recordMC" & i (which will create a new name for
each of the newly created movies)
// then set the variables in the newly created movie
Set ("recordMC" & i) & ".field1" = value from text file
Set ("recordMC" & i) & ".field2" = value from text file
Set ("recordMC" & i) & ".field3" = value from text file
//then we need to position them, we will do this by multiplying each movies
Y position by i * the total height of the recordMC
set property Y, 0 + (i * the_height_of_recordMC)
Next
So what happens is, we attach a new version of the original record Mc to our
movie, then we set the variables inside the newly created recordMC. Then
using the height of the recordMC we multiply that by i, which means they
will list evenly from top to bottom. Now each of these recordMC's has the
button in it which you can make do whatever you want. I realize this is
quick and dirty, but the idea is there and I'll be happy to provide you with
source files of work I've previous to help illustrate the system better.
Good luck.. I hope I was more helpful than confusing... I hope ;).
>From: "Mark Joslyn" <Mark.Joslyn at SolimarSystems.com>
>Reply-To: Mark.Joslyn at SolimarSystems.com,
>"thelist at lists.evolt.org"<thelist at lists.evolt.org>
>To: "Evolt \(E-mail\)" <thelist at lists.evolt.org>
>Subject: [thelist] Flash results table
>Date: Fri, 29 Aug 2003 14:01:51 -0700
>MIME-Version: 1.0
>Received: from acornparenting.org ([216.40.227.23]) by
>mc10-f25.bay6.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Fri, 29
>Aug 2003 14:33:20 -0700
>Received: (qmail 17515 invoked from network); 29 Aug 2003 21:02:59 -0000
>Received: from localhost (HELO www.acornparenting.org) (127.0.0.1) by 0
>with SMTP; 29 Aug 2003 21:02:59 -0000
>Received: (qmail 17366 invoked from network); 29 Aug 2003 21:02:32 -0000
>Received: from mail.solimarsystems.com (HELO
>mail.Corp.Solimarsystems.com)(168.215.208.194) by 0 with SMTP; 29 Aug 2003
>21:02:32 -0000
>Received: from DG0KRP11 [192.168.10.135] by mail.Corp.Solimarsystems.com
>withESMTP (SMTPD32-8.02) id AF6B5C800FE; Fri, 29 Aug 2003 14:02:35 -0700
>X-Message-Info: JGTYoYF78jFCWGIg9CDuUW/RHhAz54kb
>Return-Path: <Mark.Joslyn at SolimarSystems.com>
>Delivered-To: thelist at lists.evolt.org
>Message-ID: <008901c36e70$c585f930$870aa8c0 at Corp.Solimarsystems.com>
>X-Priority: 3 (Normal)
>X-MSMail-Priority: Normal
>X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0)
>Importance: Normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>X-Declude-Sender: Mark.Joslyn at SolimarSystems.com [192.168.10.135]
>X-Note: This E-mail was scanned by Declude JunkMail (www.declude.com)
>forspam.
>X-BeenThere: thelist at lists.evolt.org
>X-Mailman-Version: 2.1b5
>Precedence: list
>List-Id: thelist at lists.evolt.org <thelist.lists.evolt.org>
>List-Help: <mailto:thelist-request at lists.evolt.org?subject=help>
>List-Post: <mailto:thelist at lists.evolt.org>
>List-Subscribe:
><http://lists.evolt.org/mailman/listinfo/thelist>,<mailto:thelist-request at lists.evolt.org?subject=subscribe>
>List-Archive: <http://lists.evolt.org/pipermail/thelist>
>List-Unsubscribe:
><http://lists.evolt.org/mailman/listinfo/thelist>,<mailto:thelist-request at lists.evolt.org?subject=unsubscribe>
>Sender: thelist-bounces at lists.evolt.org
>Errors-To: thelist-bounces at lists.evolt.org
>X-OriginalArrivalTime: 29 Aug 2003 21:33:20.0116 (UTC)
>FILETIME=[2A954340:01C36E75]
>
>Situation:
>I am currently developing a Flash MX application that will display the
>results of three different arrays. This application cannot use any program
>languages(ASP, PHP, etc.) or connect to a database. Thus, the reason for
>the
>arrays. (By the way - is using arrays the best solution to simulate
>database
>connectivity?)
>
>The arrays are loaded from an external .txt file. I have explored the
>possibility of dynamically creating movieclips and textFields. I got this
>working correctly, but with all the different depths, targeting where the
>mouse clicked was impossible.
>
>Problem:
>How can I display the results in a table format (rows and columns)? Also,
>each result would need to be clickable. Are there any good tutorials about
>this out there? I can't seem to find them - all I found was how to import
>HTML tables into Flash - not exactly what I want.
>
>Any help would be appreciated.
>
>--
>* * Please support the community that supports you. * *
>http://evolt.org/help_support_evolt/
>
>For unsubscribe and other options, including the Tip Harvester
>and archives of thelist go to: http://lists.evolt.org
>Workers of the Web, evolt !
Peace and Clarity
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
More information about the thelist
mailing list