Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 20th, 2001, 11:54 AM
alligatorTim alligatorTim is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 45 alligatorTim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 37 sec
Reputation Power: 8
multiple rows from DB to php to flash

has anyone here ever had any experience pulling multiple rows from a table in a DB with php and then passing those to a flash file via loadvariables().

i can get one row no problem, but not multiple rows. i've tried just about everything. passing arrays, dynamic variable names... i'm stumped.

Reply With Quote
  #2  
Old December 24th, 2001, 05:19 PM
JeffCT JeffCT is offline
PHP & Ruby Developer
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2001
Posts: 1,437 JeffCT User rank is Lance Corporal (50 - 100 Reputation Level)JeffCT User rank is Lance Corporal (50 - 100 Reputation Level)JeffCT User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 5 h 36 m 40 sec
Reputation Power: 9
I don't see anythign preventing you from sending multiple rows, just number them in some way. Put all the data for the first row in vars like this:

var1_1
var2_1
var3_1

etc.

No reason you can't do that. It's a cheesy workaround but that's Flash for you. You could also try XML but I don't like the way XML is so bulky and not space efficient, and I try to keep my Flash+PHP programs as tight and efficient as possible.

Reply With Quote
  #3  
Old December 31st, 2001, 11:45 AM
mbritton72 mbritton72 is offline
Shrill Digital God
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Raleigh, NC
Posts: 64 mbritton72 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m
Reputation Power: 7
incremented name/value pairs

In PHP:

<?

// Query stuff here


$current_row = 1;

while ($fetch = mysql_fetch_array($result)) { echo "&varName".$current_row."=".$fetch["fieldName"]."";
$current_row++;
}

echo "&loaded=1";

?>


In Flash Actionscript:

count = 0;
index = 1;

loadVariables ("php_template.php", "", "POST");

// Then, with the text field named flashVarName, on a keyframe:

flashVarName = varName1;

// Now make buttons to advance / back up in this fashion:

on (press) {
if (Number(index) < Number(count)) {
index = Number(index)+1;
} else {
index = 1;
}
flashVarName= eval("varName" add index);
}
__________________
I'm not impatient, I just have a low tolerance for boredom.

Reply With Quote
  #4  
Old December 31st, 2001, 01:01 PM
alligatorTim alligatorTim is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 45 alligatorTim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 37 sec
Reputation Power: 8
thanks very much for the suggestions. i need the rows displayed in flash in a list format. i can pass say the first 20 rows like you guys mentioned and then create 20 different movie clips all with different but corresponding variable names. but how do i stop a longer row from wrapping and then overlapping the following movie clip.

is there a way to dynamically create these movie clips depending on the variables it gets from your php script so i don't have to create 20 movie clips?

-alligator

Reply With Quote
  #5  
Old December 31st, 2001, 01:51 PM
mbritton72 mbritton72 is offline
Shrill Digital God
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Raleigh, NC
Posts: 64 mbritton72 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m
Reputation Power: 7
something like this

This scenario if you have already loaded your incremented name/value pairs (see my previous example):

In Flash Actionscript

// Declare your variables

x = 1;
position = 0;

while (x <= _root.numberRows) {

// "post"+x being each duplicated clip's new name:

duplicateMovieClip ("_root.movieClip", "post"+x, x);
setProperty ("_root.post"+x, _y, position);
this["post"+x].clip1 = _root.["clip1"+x];
position = position+64;
x = x+1;
}

Reply With Quote
  #6  
Old December 31st, 2001, 05:15 PM
alligatorTim alligatorTim is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 45 alligatorTim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 37 sec
Reputation Power: 8
okay so first i tried cutting your action script into flash 5 but i got syntax errors i couldn't figure out, and it wouldn't let me switch back to normal mode, so then i tried to break apart your post and recreate my own example. clearly i still don't understand some things.

in php4flash_temp.php:

PHP Code:
<?
include("dbconnect_yank.php");
$query "select topic from topics order by date desc";
$result mysql_result($query);
$row mysql_fetch_row($result);

print 
"num_rows=" mysql_num_rows($result);
$x 1;
while (
$row) {
        print 
"value_" $x "=" $row[0];
        
$x $x 1;
        
$row mysql_fetch_row($result);
}
print 
"&loaded=1";
?>


i'm not sure what the variable "&loaded" is supposed to be for yet...

in flash on the main timeline keyframe one there is an instance of a movie clip called "db_text". in it there is a dynamic text field with the variable name "flash_var_name".

also on keyframe one of the main timeline there is the fallowing action script:

count = 1;
position = 0;
loadVariablesNum ("php4flash_temp.php", 0, "POST");

then on keyframe two of the main timeline there is this:

while (count <= num_rows) {
duplicateMovieClip ("db_text", "dup"+count, count);
setProperty ("this.dup"+count, _y, position);
set ("this.dup"+count+".flash_var_name", "value_"+count);
position = position + 64;
count = count + 1;
}
stop ();

am i close???

Last edited by alligatorTim : December 31st, 2001 at 05:18 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > multiple rows from DB to php to flash


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway