Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: FLASH: Question: Loading variable
From: Paul Willoughby
Date: Wed, 6 Sep 2000 16:28:43 +0100

Hi Rainer,

I don't know anything about PHP, but I do know a bit about loading text into
Flash so maybe I can help.

>Is this ok, or should there be a , or ; or & or + instead of the
>blanks? or shoud it be like
>profs1=John
>profs2=Marc
>profs3=Sam

The variables for loading should be connected with an ampersand (&) so it
look like:
profs1=John&profs2=Marc&profs3=Sam

>Now I want to read the variable in the textfield of the button, but the
>problem is that I want to duplicate the button, and textfield should
>be named something like profs&i, in this case the button should be
>duplicated three times and I want that textfield in first button gets
>John, textfield in second buttons gets Marc ...?

Hmmm...not easy. You can't dynamically rename a textfield as far as I know,
but there is quite a good workaround. Make sure your button is embedded in a
movie clip. Then within the button movie clip, add a new layer and in key
frame 1 add the code:

SetVariable: whateveryourtextfieldiscalled = GetProperty("",_name)

This puts the text of the instances name into the textfield. The reason for
doing this is because you can dynamically rename instances. So, if you have
three instances on a timeline without names, Flash will call them instance1,
instance2, instance3.
You can then add code on the main timeline that says something like:

Load Variables ("whatever your file is called")
Set Property ("instance1", Name) = profs1
Set Property ("instance2", Name) = profs2
Set Property ("instance3", Name) = profs3

This is an example to show the mechanics of it, but it would speed this code
up if you used a naming loop like this:

Set Variable: "counter" = "1"
Loop While (counter <= 3)
Set Property ("instance" & counter, Name) = "profs" & counter
Set Variable: "counter" = counter + 1
End Loop

The textfields in your instances will then automatically take on the value
of profs1, profs2 and profs3.
I hope that helps, but like I said I don't know too much about PHP so my
solutiom might not be appropriate. As an aside, I'm keen to learn about PHP
and how it can be used to integrate Flash with databases. Is there any
sites/books you recommend for tutorials? I'd be grateful for any help in
this area.

Paul

-----Original Message-----
From: Rainer Egle [rainer [dot] egleatFH-Reutlingen [dot] DE (mailto:rainer [dot] egleatFH-Reutlingen [dot] DE)]
Sent: 06 September 2000 15:15
To: flasheratchinwag [dot] com
Subject: FLASH: Question: Loading variable


Hi all,

I have a question concerning loading variables in flash. I want to
load an "array" in Flash. Have a table in a database like:

ID Name
1 John
2 Marc
3 Sam

Now I want to use a button in Flash (consists of a graphic and a
textfield).

I get the amount of rows in the database table a variable:

php-code:

<?php
$verbindung = @mysql_connect("localhost","","");
$abfrage = "SELECT Name from Profs1 order by 1";
$erg = mysql_db_query("Profs",$abfrage,$verbindung);
$anzahl = mysql_affected_rows($verbindung);
echo "anzprof=$anzahl";
mysql_close($verbindung);
?>

Now is my question should the php-file for the array should be?

If have this one:

<?php
$verbindung = @mysql_connect("localhost","","");
$abfrage = "SELECT Name from Profs1 order by 1";
$erg = mysql_db_query("Profs",$abfrage,$verbindung);
$i=1;
while (list($Name) = mysql_fetch_row($erg))
{
echo "profs$i=$Name ";
$i=$i+1;
}
mysql_close($verbindung);
?>

which gives me the result

profs1=John profs2=Marc profs3=Sam

Is this ok, or should there be a , or ; or & or + instead of the
blanks? or shoud it be like
profs1=John
profs2=Marc
profs3=Sam

Now I want to read the variable in the textfield of the button, but the
problem is that I want to duplicate the button, and textfield should
be named something like profs&i, in this case the button should be
duplicated three times and I want that textfield in first button gets
John, textfield in second buttons gets Marc ...?

Is this possible in any way? Tips?

Any help is appreciated, but the most important thing to know it
this problem can be solved or not?

Sorry for my bad explaining, English is not my strength.

Rainer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NudeGuru.com is proud to sponsor the Flasher list
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IT'S THE ART OF MONEY, HONEY!
Tips and Advice from some of the most popular Flash
artists + industry power-brokers on how to hold onto
your rights, negotiate contracts and get full value
for your work.http://www.nudeguru.com from Franke James
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NudeGuru.com is proud to sponsor the Flasher list
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IT'S THE ART OF MONEY, HONEY!
Tips and Advice from some of the most popular Flash
artists + industry power-brokers on how to hold onto
your rights, negotiate contracts and get full value
for your work.http://www.nudeguru.com from Franke James
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]